make NO_LATEX default, set ut compability stuff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2205 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-07-08 12:52:16 +00:00
parent 196aa56606
commit 3aa411d883
18 changed files with 167 additions and 58 deletions

View 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.

View 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.

View File

@ -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"

View 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

View 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"

View 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

View 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.

View 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 \

View 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

View 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 &);

View 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

View 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);
#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);
}
}

View 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;

View 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

View File

@ -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;

View File

@ -26,7 +26,7 @@ class LyXLex;
class BufferParams;
//#define NO_LATEX 1
#define NO_LATEX 1
///
class LyXFont {

View 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;
}

View 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,