]> git.lyx.org Git - features.git/commitdiff
make NO_LATEX default, set ut compability stuff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sun, 8 Jul 2001 12:52:16 +0000 (12:52 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sun, 8 Jul 2001 12:52:16 +0000 (12:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2205 a592a061-630c-0410-9148-cb99ea01b6c8

18 files changed:
boost/ChangeLog
lib/ChangeLog
lib/bind/menus.bind
lib/layouts/stdlayouts.inc
lib/ui/default.ui
po/POTFILES.in
src/ChangeLog
src/Makefile.am
src/buffer.C
src/buffer.h
src/insets/ChangeLog
src/insets/insetert.C
src/insets/insetert.h
src/insets/insettabular.C
src/lyx_main.C
src/lyxfont.h
src/mathed/math_parser.C
src/tabular.C

index ae8177c1a666f319bbbe3e36875395739db3190b..88c05a6ad747366ccbcee578dac206c5dad1a08d 100644 (file)
@@ -1,3 +1,7 @@
+2001-07-07  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * boost/config.hpp: update
+
 2001-06-07  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
        * boost/limits.hpp: completely bogus jug addon removed.
index 9b7cdda516421fb4f4f10367aed5b2be5b7b4826..ce144b685cc10f0d3c1aa470bbc3b7bbdeed5cba 100644 (file)
@@ -1,3 +1,11 @@
+2001-07-08  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * 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  <dekelts@tau.ac.il>
 
        * layouts/IEEEtran.layout: Add qed box at the end of proof.
index aa96abf67f79cba3973a01db3e741efc909dc4ec..7d652a9870e657d2d92f112bf5bee06f2679e805 100644 (file)
 \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"
index 14a146d95370c1ee0893e8d9bc80dc57a2983fdf..92136c4bcbe19f864509de4611b7b846450af636 100644 (file)
@@ -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
index 7eedb4779ac45242fd7d0bf112d8d42413aafc2a..1035cf9b7195e228206f9c52330b7974f6c5bde7 100644 (file)
@@ -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"
index 300a18a53dbc3f31c72a0295744ef0fd59ab2ed8..336d2f748ec1f159a7c2ea9e3d0dc2227e8a1a9c 100644 (file)
@@ -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
index aaef9650baf453983e27797fd6079285aedc845c..336f7566a0fac56af1037fdf017423bbd76773f5 100644 (file)
@@ -1,3 +1,11 @@
+2001-07-08  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * 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  <larsbj@birdstep.com>
 
        * text2.C: remove some commented code.
index 13eed40c4a15442ab4db61a89f80efa743cbb640..48c490fad5d6c03c6e1cc0cd7150100dfd2d1357 100644 (file)
@@ -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 \
index 8a0d18603b43a8daa650960b2745cd220b70ab84..b2310f8b6c811b5c257f91676e700b7a2bb9e7c0 100644 (file)
@@ -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
index 47d94282eaa51b0f2ac6bb9f3399e8c224f5ea3f..bf384d461517fca035c69ae7b0e972744fefa302 100644 (file)
@@ -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 &);
index 558189bbd40de48551d80b6cc58ecf11ec6aa2b7..c7efdd2a9d4341db41a0e6b3ceebdec8ad9f5b9f 100644 (file)
@@ -1,3 +1,7 @@
+2001-07-08  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * insetert.C (InsetERT): new contructor
+
 2001-07-06  Juergen Vigna  <jug@sad.it>
 
        * a lot of files: added implementation of the below new functions
index 2cc6e304f2c1a9fe5f629cf93348aec97c06d396..fbe04f7bfe725502e95aacdfe6d10d904b51cb72 100644 (file)
@@ -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);
+       }
 }
 
 
index eddcd292c7a8ce58b0588570b552bd2688780bdd..650abb5ade410b1df6bc8d7f584167230a91aa3f 100644 (file)
@@ -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;
index 95699d7a9333cb39e8c4572f53f6e6b8ac6bb62b..a343e41cd93c52344afd1a701967aa38b7698883 100644 (file)
@@ -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
index 7b260e2af7125c5da93388f2d08527fcc85df65a..3332523282335668f59dcf855fe008caa0d1952c 100644 (file)
 #include "converter.h"
 #include "language.h"
 #include "support/os.h"
+// for NO_LATEX
+#if 1
+#include "lyxfont.h"
+#endif
 
 using std::endl;
 
index 11543c87f3275801bf3bf486a31a74cfb319430c..c690f19e3f33646a2870570da2da130fc819cf67 100644 (file)
@@ -26,7 +26,7 @@ class LyXLex;
 class BufferParams;
 
 
-//#define NO_LATEX 1
+#define NO_LATEX 1
 
 ///
 class LyXFont {
index 5668ed7bcd6ee6aa8a0b2444e521c9e8c26a4b87..cd1cadf1a3d511a338c8e5eea937b0e197527d7d 100644 (file)
@@ -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;
        }
 
index 86091c6e36a02486ec4f65ffa911810f50349877..183b2f2e68fd5d40a80e37b63db5784ec82c34ae 100644 (file)
@@ -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,