diff --git a/boost/ChangeLog b/boost/ChangeLog index ae8177c1a6..88c05a6ad7 100644 --- a/boost/ChangeLog +++ b/boost/ChangeLog @@ -1,3 +1,7 @@ +2001-07-07 Lars Gullik Bjønnes + + * boost/config.hpp: update + 2001-06-07 Lars Gullik Bjønnes * boost/limits.hpp: completely bogus jug addon removed. diff --git a/lib/ChangeLog b/lib/ChangeLog index 9b7cdda516..ce144b685c 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,11 @@ +2001-07-08 Lars Gullik Bjønnes + + * ui/default.ui: comment out tex-mode + + * layouts/stdlayouts.inc: comment out style LaTeX + + * bind/menus.bind: comment out tex-mode + 2001-07-06 Dekel Tsur * layouts/IEEEtran.layout: Add qed box at the end of proof. diff --git a/lib/bind/menus.bind b/lib/bind/menus.bind index aa96abf67f..7d652a9870 100644 --- a/lib/bind/menus.bind +++ b/lib/bind/menus.bind @@ -119,7 +119,7 @@ \bind "M-c p" "font-code" \bind "M-c r" "font-roman" \bind "M-c s" "font-sans" -\bind "M-c t" "tex-mode" +#\bind "M-c t" "tex-mode" \bind "M-c u" "font-underline" \bind "M-c Down" "word-lowcase" diff --git a/lib/layouts/stdlayouts.inc b/lib/layouts/stdlayouts.inc index 14a146d953..92136c4bcb 100644 --- a/lib/layouts/stdlayouts.inc +++ b/lib/layouts/stdlayouts.inc @@ -7,25 +7,25 @@ # quotations and such. # LaTeX style definition -Style LaTeX - Margin Static - LatexType Paragraph - LatexName dummy - NewLine 0 - ParIndent MM - ParSkip 0.4 - ParSep 0.5 - Align Block - AlignPossible Block, Left, Right, Center - LabelType No_Label - FreeSpacing 1 - - # standard font definition - Font - Latex Latex - EndFont - -End +#Style LaTeX +# Margin Static +# LatexType Paragraph +# LatexName dummy +# NewLine 0 +# ParIndent MM +# ParSkip 0.4 +# ParSep 0.5 +# Align Block +# AlignPossible Block, Left, Right, Center +# LabelType No_Label +# FreeSpacing 1 +# +# # standard font definition +# Font +# Latex Latex +# EndFont +# +#End # Quotation style definition Style Quotation diff --git a/lib/ui/default.ui b/lib/ui/default.ui index 7eedb4779a..1035cf9b71 100644 --- a/lib/ui/default.ui +++ b/lib/ui/default.ui @@ -253,7 +253,7 @@ Menuset Item "Emphasize Style|E" "font-emph" Item "Noun Style|N" "font-noun" Item "Bold Style|B" "font-bold" - Item "TeX Style|X" "tex-mode" +# Item "TeX Style|X" "tex-mode" Separator Item "Change Environment Depth|v" "depth-increment" Item "LaTeX Preamble...|L" "layout-preamble" diff --git a/po/POTFILES.in b/po/POTFILES.in index 300a18a53d..336d2f748e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -9,7 +9,6 @@ src/converter.C src/CutAndPaste.C src/debug.C src/exporter.C -src/ext_l10n.h src/figure_form.C src/figureForm.C src/FontLoader.C diff --git a/src/ChangeLog b/src/ChangeLog index aaef9650ba..336f7566a0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2001-07-08 Lars Gullik Bjønnes + + * lyxfont.h: turn NO_LATEX on as default + + * buffer.C (insertErtContents): new methods of tex style compability. + (parseSingleLyXformat2Token): use it several places. + * tabular.C (OldFormatRead): and here + 2001-07-07 Lars Gullik Bjønnes * text2.C: remove some commented code. diff --git a/src/Makefile.am b/src/Makefile.am index 13eed40c4a..48c490fad5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,7 +15,7 @@ lyx_DEPENDENCIES = mathed/libmathed.la insets/libinsets.la \ lyx_LDADD = $(lyx_DEPENDENCIES) @INTLLIBS@ $(LYX_LIBS) $(SIGC_LIBS) \ $(PSPELL_LIBS) @FRONTEND_LDFLAGS@ @FRONTEND_LIBS@ #lyx_LDFLAGS=-Wl,-O1 -EXTRA_DIST = config.h.in stamp-h.in cheaders +EXTRA_DIST = config.h.in stamp-h.in cheaders ext_l10n.h ETAGS_ARGS = --lang=c++ BOOST_INCLUDES = -I$(top_srcdir)/boost INCLUDES = $(SIGC_CFLAGS) $(BOOST_INCLUDES) $(PSPELL_INCLUDES) @FRONTEND_INCLUDES@ @@ -108,7 +108,6 @@ lyx_SOURCES = \ encoding.h \ exporter.C \ exporter.h \ - ext_l10n.h \ figure.h \ figure_form.C \ figure_form.h \ diff --git a/src/buffer.C b/src/buffer.C index 8a0d18603b..b2310f8b6c 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -350,10 +350,28 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par) namespace { string last_inset_read; +string inset_ert_contents; +bool ert_active = false; } // anon +void Buffer::insertErtContents(Paragraph * par, int & pos, + LyXFont const & font, bool set_inactive) +{ + if (!inset_ert_contents.empty()) { + lyxerr[Debug::INSETS] << "ERT contents:\n" + << inset_ert_contents << endl; + Inset * inset = new InsetERT(inset_ert_contents); + par->insertInset(pos++, inset, font); + inset_ert_contents.erase(); + } + if (set_inactive) { + ert_active = false; + } +} + + bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, Paragraph *& return_par, @@ -363,9 +381,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, ) { bool the_end_read = false; -#ifdef NO_LATEX - static string inset_ert_contents; -#endif #ifndef NO_PEXTRA_REALLY // This is super temporary but is needed to get the compability // mode for minipages work correctly together with new tabulars. @@ -377,12 +392,20 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, #endif if (token[0] != '\\') { +#ifdef NO_LATEX + if (ert_active) { + inset_ert_contents += token; + } else { +#endif for (string::const_iterator cit = token.begin(); cit != token.end(); ++cit) { par->insertChar(pos, (*cit), font); ++pos; } checkminipage = true; +#ifdef NO_LATEX + } +#endif } else if (token == "\\i") { Inset * inset = new InsetLatexAccent; inset->read(this, lex); @@ -391,12 +414,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, } else if (token == "\\layout") { #ifdef NO_LATEX // Do the insetert. - if (!inset_ert_contents.empty()) { - Inset * inset = new InsetERT(inset_ert_contents); - par->insertInset(pos, inset, font); - ++pos; - inset_ert_contents.erase(); - } + insertErtContents(par, pos, font); #endif lex.EatLine(); string const layoutname = lex.GetString(); @@ -404,6 +422,11 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, = textclasslist.NumberOfLayout(params.textclass, layoutname); +#ifdef NO_LATEX + if (compare_no_case(layoutname, "latex") == 0) { + ert_active = true; + } +#endif #ifdef USE_CAPTION // The is the compability reading of layout caption. // It can be removed in LyX version 1.3.0. (Lgb) @@ -882,11 +905,13 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, lex.next(); string const tok = lex.GetString(); if (tok == "no_latex") { - ; // nothing + // Do the insetert. + insertErtContents(par, pos, font); } else if (tok == "latex") { - ; // nothing + ert_active = true; } else if (tok == "default") { - ; // nothing + // Do the insetert. + insertErtContents(par, pos, font); } else { lex.printError("Unknown LaTeX font flag " "`$$Token'"); @@ -1004,6 +1029,11 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, } ++pos; } else if (token == "\\newline") { +#ifdef NO_LATEX + // Since we cannot know it this is only a regular newline or a + // tabular cell delimter we have to handle the ERT here. + insertErtContents(par, pos, font, false); +#endif par->insertChar(pos, Paragraph::META_NEWLINE, font); ++pos; } else if (token == "\\LyXTable") { @@ -1039,12 +1069,30 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, } par->bibkey->read(this, lex); } else if (token == "\\backslash") { +#ifdef NO_LATEX + if (ert_active) { + inset_ert_contents += "\\"; + } else { +#endif par->insertChar(pos, '\\', font); ++pos; +#ifdef NO_LATEX + } +#endif } else if (token == "\\the_end") { +#ifdef NO_LATEX + // If we still have some ert active here we have to insert + // it so we don't loose it. (Lgb) + insertErtContents(par, pos, font); +#endif the_end_read = true; minipar = parBeforeMinipage = 0; } else { +#ifdef NO_LATEX + if (ert_active) { + inset_ert_contents += token; + } else { +#endif // This should be insurance for the future: (Asger) lex.printError("Unknown token `$$Token'. " "Inserting as text."); @@ -1054,6 +1102,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par, par->insertChar(pos, (*cit), font); ++pos; } +#ifdef NO_LATEX + } +#endif } #ifndef NO_PEXTRA_REALLY // now check if we have a minipage paragraph as at this diff --git a/src/buffer.h b/src/buffer.h index 47d94282ea..bf384d4615 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -124,6 +124,10 @@ public: string const & token, int & pos, Paragraph::depth_type & depth, LyXFont &); + /// + void insertErtContents(Paragraph * par, int & pos, + LyXFont const & font, + bool set_inactive = true); private: /// Parse a single inset. void readInset(LyXLex &, Paragraph *& par, int & pos, LyXFont &); diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 558189bbd4..c7efdd2a9d 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2001-07-08 Lars Gullik Bjønnes + + * insetert.C (InsetERT): new contructor + 2001-07-06 Juergen Vigna * a lot of files: added implementation of the below new functions diff --git a/src/insets/insetert.C b/src/insets/insetert.C index 2cc6e304f2..fbe04f7bfe 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -26,9 +26,25 @@ using std::ostream; InsetERT::InsetERT() : InsetCollapsable() { setLabel(_("666")); -#ifndef NO_LATEX + //LyXFont font(LyXFont::ALL_SANE); + //font.setLatex (LyXFont::ON); + labelfont = LyXFont(LyXFont::ALL_SANE); + labelfont.decSize(); + labelfont.decSize(); + labelfont.setColor(LColor::latex); + setAutoCollapse(false); + setInsetName("ERT"); +} + + +InsetERT::InsetERT(string const & contents) +{ + setLabel(_("666")); LyXFont font(LyXFont::ALL_SANE); - font.setLatex (LyXFont::ON); +#ifndef NO_LATEX + font.setLatex(LyXFont::ON); +#else + font.setColor(LColor::latex); #endif labelfont = LyXFont(LyXFont::ALL_SANE); labelfont.decSize(); @@ -36,6 +52,13 @@ InsetERT::InsetERT() : InsetCollapsable() labelfont.setColor(LColor::latex); setAutoCollapse(false); setInsetName("ERT"); + + string::const_iterator cit = contents.begin(); + string::const_iterator end = contents.end(); + Paragraph::size_type pos = 0; + for (; cit != end; ++cit) { + inset.paragraph()->insertChar(pos++, *cit, font); + } } diff --git a/src/insets/insetert.h b/src/insets/insetert.h index eddcd292c7..650abb5ade 100644 --- a/src/insets/insetert.h +++ b/src/insets/insetert.h @@ -30,6 +30,8 @@ public: /// InsetERT(); /// + InsetERT(string const & contents); + /// virtual void write(Buffer const * buf, std::ostream & os) const; /// virtual Inset * clone(Buffer const &, bool same_id = false) const; diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 95699d7a93..a343e41cd9 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -1494,11 +1494,10 @@ void InsetTabular::setFont(BufferView * bv, LyXFont const & font, bool tall, sel_cell_end = tabular->GetNumberOfCells() - 1; } if (hasSelection()) { - bool frozen; setUndo(bv, Undo::EDIT, bv->text->cursor.par(), bv->text->cursor.par()->next()); - frozen = undo_frozen; + bool frozen = undo_frozen; if (!frozen) freezeUndo(); // apply the fontchange on the whole selection diff --git a/src/lyx_main.C b/src/lyx_main.C index 7b260e2af7..3332523282 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -42,6 +42,10 @@ #include "converter.h" #include "language.h" #include "support/os.h" +// for NO_LATEX +#if 1 +#include "lyxfont.h" +#endif using std::endl; diff --git a/src/lyxfont.h b/src/lyxfont.h index 11543c87f3..c690f19e3f 100644 --- a/src/lyxfont.h +++ b/src/lyxfont.h @@ -26,7 +26,7 @@ class LyXLex; class BufferParams; -//#define NO_LATEX 1 +#define NO_LATEX 1 /// class LyXFont { diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 5668ed7bcd..cd1cadf1a3 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -150,7 +150,7 @@ int const latex_mathenv_num = sizeof(latex_mathenv)/sizeof(latex_mathenv[0]); void mathPrintError(string const & msg) { - lyxerr << "Line ~" << yylineno << ": Math parse error: " << msg << endl; + lyxerr[Debug::MATHED] << "Line ~" << yylineno << ": Math parse error: " << msg << endl; } @@ -197,7 +197,7 @@ unsigned char LexGetArg(unsigned char lf, bool accept_spaces = false) if (!lf) lf = c; else if (c != lf) { - lyxerr << "Math parse error: unexpected '" << c << "'" << endl; + lyxerr[Debug::MATHED] << "Math parse error: unexpected '" << c << "'" << endl; return '\0'; } break; @@ -208,7 +208,7 @@ unsigned char LexGetArg(unsigned char lf, bool accept_spaces = false) if (lf == '[') rg = ']'; if (lf == '(') rg = ')'; if (!rg) { - lyxerr << "Math parse error: unknown bracket '" << lf << "'" << endl; + lyxerr[Debug::MATHED] << "Math parse error: unknown bracket '" << lf << "'" << endl; return '\0'; } yytext.erase(); @@ -307,7 +307,7 @@ int yylex() } if (yyis->good()) yyis->putback(c); - lyxerr << "reading: text '" << yytext << "'\n"; + lyxerr[Debug::MATHED] << "reading: text '" << yytext << "'\n"; latexkeys const * l = in_word_set(yytext); if (!l) return LM_TK_UNDEF; @@ -475,13 +475,13 @@ MathInset * mathed_parse() p = new MathMacroTemplate(name, na); mathed_parse(p->cell(0), FLAG_BRACE | FLAG_BRACE_LAST); - lyxerr << "LM_TK_NEWCOMMAND: name: " << name << " na: " << na << "\n"; + lyxerr[Debug::MATHED] << "LM_TK_NEWCOMMAND: name: " << name << " na: " << na << "\n"; break; } case LM_TK_BEGIN: { int i = yylval.i; - lyxerr << "reading math environment " << i << " " + lyxerr[Debug::MATHED] << "reading math environment " << i << " " << latex_mathenv[i].name << "\n"; MathInsetTypes typ = latex_mathenv[i].typ; @@ -516,14 +516,14 @@ MathInset * mathed_parse() case LM_OT_ALIGNAT: { LexGetArg('{'); //int c = atoi(yytext.c_str()); - lyxerr << "LM_OT_ALIGNAT: not implemented\n"; + lyxerr[Debug::MATHED] << "LM_OT_ALIGNAT: not implemented\n"; mathed_parse_lines(p, 2, latex_mathenv[i].numbered, true); - lyxerr << "LM_OT_ALIGNAT: par: " << *p << "\n"; + lyxerr[Debug::MATHED] << "LM_OT_ALIGNAT: par: " << *p << "\n"; break; } default: - lyxerr << "1: unknown math environment: " << typ << "\n"; + lyxerr[Debug::MATHED] << "1: unknown math environment: " << typ << "\n"; } p->SetName(latex_mathenv[i].basename); @@ -532,7 +532,7 @@ MathInset * mathed_parse() } default: - lyxerr << "2 unknown math environment: " << t << "\n"; + lyxerr[Debug::MATHED] << "2 unknown math environment: " << t << "\n"; } return p; @@ -680,7 +680,7 @@ void mathed_parse(MathArray & array, unsigned flags) --plevel; return; } - lyxerr << "found tab unexpectedly, array: '" << array << "'\n"; + lyxerr[Debug::MATHED] << "found tab unexpectedly, array: '" << array << "'\n"; break; } @@ -691,7 +691,7 @@ void mathed_parse(MathArray & array, unsigned flags) --plevel; return; } - lyxerr << "found newline unexpectedly, array: '" << array << "'\n"; + lyxerr[Debug::MATHED] << "found newline unexpectedly, array: '" << array << "'\n"; break; } @@ -790,7 +790,7 @@ void mathed_parse(MathArray & array, unsigned flags) case LM_TK_STY: { - lyxerr << "LM_TK_STY not implemented\n"; + lyxerr[Debug::MATHED] << "LM_TK_STY not implemented\n"; //MathArray tmp = array; //MathSizeInset * p = new MathSizeInset(MathStyles(yylval.l->id)); //array.push_back(p); @@ -866,7 +866,7 @@ void mathed_parse(MathArray & array, unsigned flags) //lyxerr << "read matrix " << *mm << "\n"; break; } else - lyxerr << "unknow math inset " << typ << "\n"; + lyxerr[Debug::MATHED] << "unknow math inset " << typ << "\n"; break; } @@ -880,7 +880,7 @@ void mathed_parse(MathArray & array, unsigned flags) if (rg != '}') { mathPrintError("Expected '{'"); // debug info - lyxerr << "[" << yytext << "]" << endl; + lyxerr[Debug::MATHED] << "[" << yytext << "]" << endl; panic = true; break; } @@ -891,7 +891,7 @@ void mathed_parse(MathArray & array, unsigned flags) default: mathPrintError("Unrecognized token"); - lyxerr << "[" << t << " " << yytext << "]" << endl; + lyxerr[Debug::MATHED] << "[" << t << " " << yytext << "]" << endl; break; } // end of big switch @@ -938,7 +938,7 @@ MathInset * mathed_parse(LyXLex & lex) lex.nextToken(); if (lex.GetString() == "\\end_inset") break; - lyxerr << "InsetFormula::Read: Garbage before \\end_inset," + lyxerr[Debug::MATHED] << "InsetFormula::Read: Garbage before \\end_inset," " or missing \\end_inset!" << endl; } diff --git a/src/tabular.C b/src/tabular.C index 86091c6e36..183b2f2e68 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -1504,6 +1504,10 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl) || token == "\\end_float" || token == "\\end_deeper") { lex.pushToken(token); + // Here we need to insert the inset_ert_contents into the last + // cell of the tabular. + owner_->bufferOwner()->insertErtContents(par, pos, font); + break; } if (owner_->bufferOwner()->parseSingleLyXformat2Token(lex, par,