From 132fe5e1322fbc86a32692df51eba78d6b4e479c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Thu, 9 Mar 2000 03:36:48 +0000 Subject: [PATCH] the freespacing patch from Kayvan, draw the math empty delim with onoffdash, asure that the tables passed to lyxlex is sorted and sort them if not, use std::lower_bound to search in lyxlex tables, use binary search in stead of linear in math_delim::search_deco, we also sort the math_deco_table upon startup. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@594 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 125 ++++++++++++++++++++++++++++ lib/layouts/literate-scrap.inc | 3 +- src/BufferView2.C | 2 +- src/Bullet.C | 2 +- src/DepTable.C | 6 +- src/DepTable.h | 5 +- src/bmtable.h | 2 +- src/broken_headers.h | 5 +- src/buffer.C | 144 +++++++++++++++++++-------------- src/combox.C | 2 +- src/combox.h | 2 +- src/credits_form.C | 2 +- src/debug.C | 2 +- src/insets/figinset.C | 4 +- src/insets/figinset.h | 6 +- src/insets/insetbib.C | 6 +- src/insets/insetbib.h | 4 +- src/insets/insetcollapsable.h | 2 +- src/insets/insetcommand.C | 4 +- src/insets/insetcommand.h | 4 +- src/insets/inseterror.C | 4 +- src/insets/inseterror.h | 4 +- src/insets/insetfoot.C | 4 +- src/insets/insetfoot.h | 4 +- src/insets/insetgraphics.C | 4 +- src/insets/insetgraphics.h | 4 +- src/insets/insetinclude.C | 6 +- src/insets/insetinclude.h | 6 +- src/insets/insetinfo.C | 4 +- src/insets/insetinfo.h | 4 +- src/insets/insetlabel.C | 4 +- src/insets/insetlabel.h | 4 +- src/insets/insetlatex.C | 4 +- src/insets/insetlatex.h | 4 +- src/insets/insetlatexaccent.C | 4 +- src/insets/insetlatexaccent.h | 4 +- src/insets/insetloa.C | 4 +- src/insets/insetparent.C | 10 +-- src/insets/insetparent.h | 4 +- src/insets/insetquotes.C | 6 +- src/insets/insetquotes.h | 4 +- src/insets/insetref.C | 4 +- src/insets/insetref.h | 6 +- src/insets/insetspecialchar.C | 12 +-- src/insets/insetspecialchar.h | 6 +- src/insets/insettext.C | 9 ++- src/insets/insettext.h | 4 +- src/insets/inseturl.C | 6 +- src/insets/inseturl.h | 4 +- src/insets/lyxinset.h | 7 +- src/lyx_cb.C | 2 +- src/lyx_sty.h | 3 +- src/lyxcursor.h | 3 +- src/lyxfunc.C | 14 +++- src/lyxlex.C | 86 +++++++++++++------- src/lyxlex.h | 12 +-- src/lyxlookup.h | 4 +- src/lyxrc.C | 6 +- src/lyxserver.h | 4 +- src/mathed/array.h | 2 +- src/mathed/formula.C | 13 ++- src/mathed/formula.h | 6 +- src/mathed/formulamacro.C | 2 +- src/mathed/formulamacro.h | 2 +- src/mathed/math_cursor.C | 2 +- src/mathed/math_cursor.h | 2 +- src/mathed/math_defs.h | 2 +- src/mathed/math_delim.C | 75 +++++++++++++---- src/mathed/math_draw.C | 2 +- src/mathed/math_inset.C | 2 +- src/mathed/math_inset.h | 2 +- src/mathed/math_iter.C | 2 +- src/mathed/math_iter.h | 2 +- src/mathed/math_macro.C | 2 +- src/mathed/math_macro.h | 2 +- src/mathed/math_panel.C | 2 +- src/mathed/math_panel.h | 2 +- src/mathed/math_parser.C | 2 +- src/mathed/math_parser.h | 2 +- src/mathed/math_root.C | 2 +- src/mathed/math_root.h | 2 +- src/mathed/math_symbols.C | 2 +- src/mathed/math_utils.C | 2 +- src/mathed/math_write.C | 2 +- src/menus.h | 4 +- src/os2_defines.h | 3 +- src/os2_errortable.h | 3 +- src/paragraph.C | 5 +- src/support/LIstream.h | 4 +- src/support/LOstream.h | 4 +- src/support/LSubstring.h | 4 +- src/support/Makefile.am | 1 + src/support/lstrings.C | 1 + src/support/lyxalgo.h | 40 +++++++++ src/support/lyxlib.h | 4 +- src/support/textutils.h | 3 +- src/table.h | 3 +- src/texrow.C | 4 +- src/text.C | 24 ++---- src/text2.C | 5 ++ src/toolbar.C | 2 +- src/vms_defines.h | 3 +- 102 files changed, 586 insertions(+), 289 deletions(-) create mode 100644 src/support/lyxalgo.h diff --git a/ChangeLog b/ChangeLog index 520dc1506f..e94c6eaad0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,128 @@ +2000-03-07 Kayvan A. Sylvan + + * lib/layouts/literate-scrap.inc: Fixed initial comment. Now we + can add multiple spaces in Scrap (literate programming) styles... + which, by the way, is how I got hooked on LyX to begin with. + + * src/mathed/formula.C (Write): Added dummy variable to an + inset::Latex() call. + (Latex): Add free_spacing boolean to inset::Latex() + + * src/mathed/formula.h (Latex): Added free_spacing boolean arg. + + * src/insets/lyxinset.h: Changed definition of the inset::Latex() + virtual function to include the free_spacing boolean from + the containing paragraph's style. + + * src/insets/inseturl.C, src/insets/inseturl.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/insettext.C, src/insets/insettext.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/insetspecialchar.C, src/insets/insetspecialchar.h (Latex): + Added free_spacing boolean and made sure that if in a free_spacing + paragraph, that we output normal space if there is a protected space. + + * src/insets/insetref.C, src/insets/insetref.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/insetquotes.C, src/insets/insetquotes.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/insetparent.C, src/insets/insetparent.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/insetlatexaccent.C, src/insets/insetlatexaccent.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/insetlatex.C, src/insets/insetlatex.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/insetlabel.C, src/insets/insetlabel.h (Latex): Added + free_spacing boolean arg to match inset.h + + * src/insets/insetinfo.C, src/insets/insetinfo.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/insetinclude.C, src/insets/insetinclude.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/insetgraphics.C, src/insets/insetgraphics.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/inseterror.C, src/insets/inseterror.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/insetcommand.C, src/insets/insetcommand.h (Latex): + Added free_spacing boolean arg to match inset.h + + * src/insets/insetbib.C, src/insets/insetbib.h (Latex): Added + free_spacing boolean arg to match inset.h + + * src/insets/figinset.C, src/insets/figinset.h (Latex): Added + free_spacing boolean arg to match inset.h + + * src/text2.C (DeleteEmptyParagraphMechanism): Fix this to + ignore free_spacing paragraphs. The user's spaces are left + alone. + + * src/text.C (InsertChar): Fixed the free_spacing layout + attribute behavior. Now, if free_spacing is set, you can + add multiple spaces in a paragraph with impunity (and they + get output verbatim). + (SelectSelectedWord): Added dummy argument to inset::Latex() + call. + + * src/paragraph.C (TeXOnePar): Added dummy args to inset::Latex(...) + calls. + + * src/lyxfunc.C (Dispatch): Hard-spaces input in free_spacing + paragraph layouts now only input a simple space instead. + Special character insets don't make any sense in free-spacing + paragraphs. + + * src/buffer.C (parseSingleLyXformat2Token): Code to convert + hard-spaces in the *input* file to simple spaces if the layout + is free-spacing. This converts old files which had to have + hard-spaces in free-spacing layouts where a simple space was + preferrable. + (writeFileAscii): Added free_spacing check to pass to the newly + reworked inset::Latex(...) methods. The inset::Latex() code + ensures that hard-spaces in free-spacing paragraphs get output + as spaces (rather than "~"). + +2000-03-09 Lars Gullik Bjønnes + + * src/mathed/math_delim.C (draw): draw the empty placeholder + delims with a onoffdash line. + (struct math_deco_compare): struct that holds the "functors" used + for the sort and the binary search in math_deco_table. + (class init_deco_table): class used for initial sort of the + math_deco_table. + (search_deco): use lower_bound to do a binary search in the + math_deco_table. + +2000-03-08 Lars Gullik Bjønnes + + * src/lyxrc.C: a small secret thingie... + + * src/lyxlex.C (printTable): changed to take a ostream as paramter + and to not flush the stream as often as it used to. + + * src/support/lyxalgo.h: new file + (sorted): template function used for checking if a sequence is + sorted or not. Two versions with and without user supplied + compare. Uses same compare as std::sort. + + * src/lyxlex.C (LyXLex): check if the table is sorted, if not sort + it and give warning on lyxerr. + (pushTable): ditto + (struct compare_tags): struct with function operators used for + checking if sorted, sorting and lower_bound. + (search_kw): use lower_bound instead of manually implemented + binary search. + 2000-03-08 Juergen Vigna * src/lyxfunc.C (Dispatch): forgot a break in the LFUN_INSET_ERT diff --git a/lib/layouts/literate-scrap.inc b/lib/layouts/literate-scrap.inc index 63eb3fedb4..96ebde0abe 100644 --- a/lib/layouts/literate-scrap.inc +++ b/lib/layouts/literate-scrap.inc @@ -2,8 +2,7 @@ # Suggested style to write your code: # Within same scrap, lines are separated by new-lines (Ctrl-return), use: # ItemSep 0.4 -# . disavantage: lyx doesn't allow space on first column, use proteced space -# must type ctrl-return every single line +# . disavantage: must type ctrl-return every single line # . advantage: looks better (IMHO) # resembles more closelly the produced paper doc. (more WYSIWYG) # diff --git a/src/BufferView2.C b/src/BufferView2.C index 6cc7c8b456..817da11066 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -31,7 +31,7 @@ using std::ifstream; // Inserts a file into current document bool BufferView::insertLyXFile(string const & filen) // - // (c) CHT Software Service GmbH + // Copyright CHT Software Service GmbH // Uwe C. Schroeder // // Insert a Lyxformat - file into current buffer diff --git a/src/Bullet.C b/src/Bullet.C index be6db83efe..c466bd75d3 100644 --- a/src/Bullet.C +++ b/src/Bullet.C @@ -8,7 +8,7 @@ * * LyX, The Document Processor * - * Copyright (C) 1997-1998 Allan Rae + * Copyright 1997-1998 Allan Rae * and the LyX Team * * ====================================================== */ diff --git a/src/DepTable.C b/src/DepTable.C index 16b5905e09..60b6e65e97 100644 --- a/src/DepTable.C +++ b/src/DepTable.C @@ -2,10 +2,10 @@ * ====================================================== * * LyX, The Document Processor - * Copyright (C) 1995 Matthias Ettrich - * Copyright (C) 1995-1998 The LyX Team. + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. * - * This file is Copyright (C) 1996-1998 + * This file is Copyright 1996-2000 * Lars Gullik Bjønnes * * ====================================================== diff --git a/src/DepTable.h b/src/DepTable.h index 784c04a8a2..f195999629 100644 --- a/src/DepTable.h +++ b/src/DepTable.h @@ -3,9 +3,10 @@ * ====================================================== * * LyX, The Document Processor - * Copyright (C) 1995 Matthias Ettrich + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. * - * This file is Copyright (C) 1996-1998 + * This file is Copyright 1996-2000 * Lars Gullik Bjønnes * * ====================================================== diff --git a/src/bmtable.h b/src/bmtable.h index 4d5a7864e9..687baa1bd8 100644 --- a/src/bmtable.h +++ b/src/bmtable.h @@ -6,7 +6,7 @@ * Description: A bitmap table uses a single bitmap to simulate a 2d array * of bitmap buttons. It can be used to build bitmap menus. * - * Copyright (C) 1995, 1996 Alejandro Aguilar Sierra + * Copyright 1995, 1996 Alejandro Aguilar Sierra * * You are free to use and modify this code under the terms of * the GNU General Public Licence version 2 or later. diff --git a/src/broken_headers.h b/src/broken_headers.h index ed82f78f14..a8a253312d 100644 --- a/src/broken_headers.h +++ b/src/broken_headers.h @@ -4,8 +4,9 @@ * * LyX, The Document Processor * -* Copyright (C) 1995 Matthias Ettrich -* Copyright (C) 1995-1998 The LyX Team +* Copyright 1995 Matthias Ettrich +* Copyright 1995-2000 The LyX Team +* * ====================================================== A few prototypes missing from Sun and SCO 3.2v4 header files */ diff --git a/src/buffer.C b/src/buffer.C index 25ebd02585..41ff8b4f93 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -919,11 +919,39 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, par->SetFont(pos, font); ++pos; } else if (token == "\\SpecialChar") { - inset = new InsetSpecialChar; - inset->Read(lex); - par->InsertChar(pos, LyXParagraph::META_INSET); - par->InsertInset(pos, inset); - par->SetFont(pos, font); + LyXLayout const & layout = + textclasslist.Style(params.textclass, + par->GetLayout()); + + // Insets don't make sense in a free-spacing context! ---Kayvan + if (layout.free_spacing) + { + if (lex.IsOK()) { + string next_token; + lex.next(); + next_token = lex.GetString(); + if (next_token == "\\-") { + par->InsertChar(pos, '-'); + par->SetFont(pos, font); + } else if (next_token == "\\protected_separator") { + par->InsertChar(pos, ' '); + par->SetFont(pos, font); + } else { + lex.printError("Token `$$Token' " + "is in free space " + "paragraph layout!"); + pos--; + } + } + } + else + { + inset = new InsetSpecialChar; + inset->Read(lex); + par->InsertChar(pos, LyXParagraph::META_INSET); + par->InsertInset(pos, inset); + par->SetFont(pos, font); + } ++pos; } else if (token == "\\Figure") { inset = new InsetFig(100, 100, this); @@ -951,10 +979,19 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, ++pos; } else if (token == "\\protected_separator") { // obsolete #if 1 - inset = new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR); - par->InsertChar(pos, LyXParagraph::META_INSET); - par->InsertInset(pos, inset); - par->SetFont(pos, font); + LyXLayout const & layout = + textclasslist.Style(params.textclass, + par->GetLayout()); + + if (layout.free_spacing) { + par->InsertChar(pos, ' '); + par->SetFont(pos, font); + } else { + inset = new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR); + par->InsertChar(pos, LyXParagraph::META_INSET); + par->InsertInset(pos, inset); + par->SetFont(pos, font); + } #else par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR); par->SetFont(pos, font); @@ -1292,6 +1329,11 @@ void Buffer::writeFileAscii(string const & fname, int linelen) noparbreak = 1; } + LyXLayout const & layout = + textclasslist.Style(params.textclass, + par->GetLayout()); + bool free_spc = layout.free_spacing; + /* It might be a table */ if (par->table){ #if 0 @@ -1307,6 +1349,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen) cells = par->table->columns; clen = new int [cells]; memset(clen, 0, sizeof(int) * cells); + for (i = 0, j = 0, h = 1; i < par->size(); ++i, ++h) { c = par->GetChar(i); if (c == LyXParagraph::META_INSET) { @@ -1314,11 +1357,11 @@ void Buffer::writeFileAscii(string const & fname, int linelen) #if 1 #ifdef HAVE_SSTREAM ostringstream ost; - inset->Latex(ost, -1); + inset->Latex(ost, -1, free_spc); h += ost.str().length(); #else ostrstream ost; - inset->Latex(ost, -1); + inset->Latex(ost, -1, free_spc); ost << '\0'; char * tmp = ost.str(); string tstr(tmp); @@ -1331,7 +1374,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen) WriteFSAlert(_("Error: Cannot open temporary file:"), fname1); return; } - inset->Latex(fs, -1); + inset->Latex(fs, -1, free_spc); h += fs.tellp() - 1; ::remove(fname1.c_str()); #endif @@ -1416,7 +1459,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen) case LyXParagraph::META_INSET: if ((inset = par->GetInset(i))) { fpos = ofs.tellp(); - inset->Latex(ofs, -1); + inset->Latex(ofs, -1, free_spc); currlinelen += (ofs.tellp() - fpos); actpos += (ofs.tellp() - fpos) - 1; } @@ -2839,6 +2882,9 @@ void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag, string extra_par; SimpleDocBookOnePar(os, extra_par, tpar, desc_on, depth + 2); + sgmlCloseTag(os, depth+1, inner_tag); + if(!extra_par.empty()) + os << extra_par; #else string tmp_par, extra_par; SimpleDocBookOnePar(tmp_par, extra_par, tpar, @@ -2846,10 +2892,10 @@ void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag, tmp_par = strip(tmp_par); tmp_par = frontStrip(tmp_par); os << tmp_par; -#endif sgmlCloseTag(os, depth+1, inner_tag); if(!extra_par.empty()) os << extra_par; +#endif } } @@ -2862,9 +2908,7 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par, bool inner_span = false; int desc_on = 4; - // This is not how I like to see enums. They should not be anonymous - // and variables of its type should not be declared right after the - // last brace. (Lgb) + // Someone should give this enum a proper name (Lgb) enum SOME_ENUM { NO_ONE, FOOTNOTE_LIKE, @@ -2881,8 +2925,8 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par, if(!tmp_par.empty()) { os << tmp_par; tmp_par.clear(); - sgmlCloseTag(os, depth+1, inner_tag); - sgmlOpenTag(os, depth+1, inner_tag); + sgmlCloseTag(os, depth + 1, inner_tag); + sgmlOpenTag(os, depth + 1, inner_tag); } } else @@ -2934,8 +2978,9 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par, } } // ignore all caption here, we processed them above!!! - if (par->layout != textclasslist.NumberOfLayout(params.textclass, - "Caption").second) { + if (par->layout != textclasslist + .NumberOfLayout(params.textclass, + "Caption").second) { #ifdef USE_OSTREAM_ONLY #ifdef HAVE_SSTREAM ostringstream ost; @@ -3159,7 +3204,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par, if (font2.latex() == LyXFont::ON) { // "TeX"-Mode on == > SGML-Mode on. - if (c!= '\0') + if (c != '\0') os << c; // see LaTeX-Generation... ++char_line_count; } else if (c == LyXParagraph::META_INSET) { @@ -3546,54 +3591,50 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra, par->SimpleDocBookOneTablePar(os, extra, desc_on, depth); return; } - LyXFont font1, font2; - char c; - Inset * inset; - LyXParagraph::size_type main_body; - int j; - //string emph = "emphasis"; + bool emph_flag = false; - int char_line_count = 0; LyXLayout const & style = textclasslist.Style(params.textclass, par->GetLayout()); + LyXParagraph::size_type main_body; if (style.labeltype != LABEL_MANUAL) main_body = 0; else main_body = par->BeginningOfMainBody(); // gets paragraph main font - if (main_body > 0) - font1 = style.labelfont; - else - font1 = style.font; - - char_line_count = depth; + //if (main_body > 0) + // font1 = style.labelfont; + //else + // font1 = style.font; + LyXFont font1 = main_body > 0 ? style.labelfont : style.font; + + int char_line_count = depth; if(!style.free_spacing) - for (j = 0; j < depth; ++j) + for (int j = 0; j < depth; ++j) os << ' '; // parsing main loop for (LyXParagraph::size_type i = 0; i < par->size(); ++i) { - font2 = par->getFont(i); + LyXFont font2 = par->getFont(i); // handle tag if (font1.emph() != font2.emph() && i) { if (font2.emph() == LyXFont::ON) { os << ""; - emph_flag= true; + emph_flag = true; }else { os << ""; - emph_flag= false; + emph_flag = false; } } - c = par->GetChar(i); + char c = par->GetChar(i); if (c == LyXParagraph::META_INSET) { - inset = par->GetInset(i); + Inset * inset = par->GetInset(i); #ifdef HAVE_SSTREAM ostringstream ost; inset->DocBook(ost); @@ -3628,7 +3669,7 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra, } } else if (font2.latex() == LyXFont::ON) { // "TeX"-Mode on ==> SGML-Mode on. - if (c!= '\0') + if (c != '\0') os << c; ++char_line_count; } @@ -3688,7 +3729,6 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra, int j; string emph= "emphasis"; bool emph_flag= false; - int char_line_count= 0; LyXLayout const & style = textclasslist.Style(params.textclass, par->GetLayout()); @@ -3704,7 +3744,7 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra, else font1 = style.font; - char_line_count = depth; + int char_line_count = depth; if(!style.free_spacing) for (j = 0; j < depth; ++j) file += ' '; @@ -3729,23 +3769,9 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra, if (c == LyXParagraph::META_INSET) { inset = par->GetInset(i); -#ifdef USE_OSTREAM_ONLY -#ifdef HAVE_SSTREAM - ostringstream ost; - inset->DocBook(ost); - string tmp_out = ost.str().c_str(); -#else - ostrstream ost; - inset->DocBook(ost); - ost << '\0'; - char * ctmp = ost.str(); - string tmp_out(ctmp); - delete [] ctmp; -#endif -#else string tmp_out; inset->DocBook(tmp_out); -#endif + // // This code needs some explanation: // Two insets are treated specially diff --git a/src/combox.C b/src/combox.C index 329cc54e62..9286f6f05a 100644 --- a/src/combox.C +++ b/src/combox.C @@ -4,7 +4,7 @@ * encapsulated to get a combobox-like object. All XForms * functions are hidden. * - * GNU Copyleft (C) 1996 Alejandro Aguilar Sierra + * GNU Copyleft 1996 Alejandro Aguilar Sierra * and the LyX Team. * * Dependencies: Only XForms, but created to be used with LyX. diff --git a/src/combox.h b/src/combox.h index ba5c2502f3..981f51ddb0 100644 --- a/src/combox.h +++ b/src/combox.h @@ -4,7 +4,7 @@ * encapsulated to get a combobox-like object. All XForms * functions are hidden. * - * GNU Copyleft (C) 1996 Alejandro Aguilar Sierra + * GNU Copyleft 1996 Alejandro Aguilar Sierra * and the LyX Team. * * Dependencies: Only XForms, but created to be used with LyX. diff --git a/src/credits_form.C b/src/credits_form.C index 77213176e9..e98b16ef0a 100644 --- a/src/credits_form.C +++ b/src/credits_form.C @@ -47,7 +47,7 @@ FD_copyright *create_form_copyright(void) fdui->copyright = fl_bgn_form(FL_NO_BOX, 450, 430); obj = fl_add_box(FL_UP_BOX, 0, 0, 450, 430, ""); - obj = fl_add_text(FL_NORMAL_TEXT, 10, 10, 430, 50, _("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-1999 LyX Team")); + obj = fl_add_text(FL_NORMAL_TEXT, 10, 10, 430, 50, _("LyX is Copyright 1995 by Matthias Ettrich,\n1995-2000 LyX Team")); fl_set_object_boxtype(obj, FL_FRAME_BOX); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); diff --git a/src/debug.C b/src/debug.C index f30249405f..5f8f536b7e 100644 --- a/src/debug.C +++ b/src/debug.C @@ -3,7 +3,7 @@ * * LyX, The Document Processor * -* Copyright (C) 1999 The LyX Team. +* Copyright 1999-2000 The LyX Team. * * ====================================================== */ diff --git a/src/insets/figinset.C b/src/insets/figinset.C index 58697d0dfc..201443e639 100644 --- a/src/insets/figinset.C +++ b/src/insets/figinset.C @@ -1194,7 +1194,7 @@ void InsetFig::Read(LyXLex & lex) } -int InsetFig::Latex(ostream & os, signed char /* fragile*/ ) const +int InsetFig::Latex(ostream & os, signed char /* fragile*/, bool /* fs*/) const { Regenerate(); if (!cmd.empty()) os << cmd << " "; @@ -1203,7 +1203,7 @@ int InsetFig::Latex(ostream & os, signed char /* fragile*/ ) const #ifndef USE_OSTREAM_ONLY -int InsetFig::Latex(string & file, signed char /* fragile*/ ) const +int InsetFig::Latex(string & file, signed char /* fragile*/, bool/* fs*/) const { Regenerate(); file += cmd + ' '; diff --git a/src/insets/figinset.h b/src/insets/figinset.h index d06e404e64..412019ea9d 100644 --- a/src/insets/figinset.h +++ b/src/insets/figinset.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* figinset.h - Figure inset header - part of LyX project - (C)1996 by Ivan Schreter + Copyright 1996 by Ivan Schreter */ #ifndef FIGINSET_H @@ -38,10 +38,10 @@ public: /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_space) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_space) const; /// int Linuxdoc(string & file) const; /// diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index fdc0998b35..b687eb65ed 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -321,7 +321,7 @@ string InsetBibtex::getScreenLabel() const } -int InsetBibtex::Latex(ostream & os, signed char /*fragile*/) const +int InsetBibtex::Latex(ostream & os, signed char /*fragile*/, bool/*fs*/) const { #ifdef USE_OSTREAM_ONLY // this looks like an horrible hack and it is :) The problem @@ -361,7 +361,7 @@ int InsetBibtex::Latex(ostream & os, signed char /*fragile*/) const #else string bib; signed char dummy = 0; - int result = Latex(bib, dummy); + int result = Latex(bib, dummy, 0); os << bib; return result; #endif @@ -369,7 +369,7 @@ int InsetBibtex::Latex(ostream & os, signed char /*fragile*/) const #ifndef USE_OSTREAM_ONLY -int InsetBibtex::Latex(string & file, signed char /*fragile*/) const +int InsetBibtex::Latex(string & file, signed char /*fragile*/, bool/*fs*/) const { // this looks like an horrible hack and it is :) The problem // is that owner is not initialized correctly when the bib diff --git a/src/insets/insetbib.h b/src/insets/insetbib.h index da680c2889..10754316ba 100644 --- a/src/insets/insetbib.h +++ b/src/insets/insetbib.h @@ -127,10 +127,10 @@ public: /// void Edit(BufferView *, int x, int y, unsigned int button); /// - int Latex(ostream &, signed char) const; + int Latex(ostream &, signed char, bool) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool) const; #endif /// string getKeys(char delim); diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 1dedc0f652..ec92ccb988 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -4,7 +4,7 @@ * * LyX, The Document Processor * - * Copyright (C) 2000 The LyX Team. + * Copyright 2000 The LyX Team. * *====================================================== */ diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 2615799453..cb9838acd0 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -244,7 +244,7 @@ void InsetCommand::Read(LyXLex & lex) } -int InsetCommand::Latex(ostream & os, signed char /*fragile*/) const +int InsetCommand::Latex(ostream & os, signed char /*fragile*/, bool/*fs*/) const { os << getCommand(); return 0; @@ -252,7 +252,7 @@ int InsetCommand::Latex(ostream & os, signed char /*fragile*/) const #ifndef USE_OSTREAM_ONLY -int InsetCommand::Latex(string & file, signed char /*fragile*/) const +int InsetCommand::Latex(string & file, signed char /*fragile*/, bool/*fs*/) const { file += getCommand(); return 0; diff --git a/src/insets/insetcommand.h b/src/insets/insetcommand.h index afdbcb98c4..91a9619de1 100644 --- a/src/insets/insetcommand.h +++ b/src/insets/insetcommand.h @@ -47,10 +47,10 @@ public: /// Will not be used when lyxf3 void Read(LyXLex & lex); /// - virtual int Latex(ostream &, signed char fragile) const; + virtual int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - virtual int Latex(string & file, signed char fragile) const; + virtual int Latex(string & file, signed char fragile, bool free_spc) const; /// virtual int Linuxdoc(string & file) const; /// diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index 8385c4bf84..97cd20f489 100644 --- a/src/insets/inseterror.C +++ b/src/insets/inseterror.C @@ -101,14 +101,14 @@ void InsetError::Read(LyXLex &) } -int InsetError::Latex(ostream &, signed char /*fragile*/) const +int InsetError::Latex(ostream &, signed char /*fragile*/, bool /*fs*/) const { return 0; } #ifndef USE_OSTREAM_ONLY -int InsetError::Latex(string &, signed char /*fragile*/) const +int InsetError::Latex(string &, signed char /*fragile*/, bool /*fs*/) const { return 0; } diff --git a/src/insets/inseterror.h b/src/insets/inseterror.h index ede6b82fcc..71731121f1 100644 --- a/src/insets/inseterror.h +++ b/src/insets/inseterror.h @@ -47,10 +47,10 @@ public: /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; /// int Linuxdoc(string & file) const; /// diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index 2b01a0e826..3d7e768062 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -62,7 +62,7 @@ int InsetFoot::Latex(string & l, signed char fragile) const } #endif -int InsetFoot::Latex(ostream & os, signed char fragile) const +int InsetFoot::Latex(ostream & os, signed char fragile, bool fp) const { int i; @@ -71,7 +71,7 @@ int InsetFoot::Latex(ostream & os, signed char fragile) const else os << "\\footnote{"; - i = InsetText::Latex(os, fragile); + i = InsetText::Latex(os, fragile, fp); os << "}"; return i; diff --git a/src/insets/insetfoot.h b/src/insets/insetfoot.h index 2fd833a818..c162375f78 100644 --- a/src/insets/insetfoot.h +++ b/src/insets/insetfoot.h @@ -4,7 +4,7 @@ * * LyX, The Document Processor * - * Copyright (C) 1998 The LyX Team. + * Copyright 1998 The LyX Team. * *====================================================== */ @@ -41,7 +41,7 @@ public: int Latex(string &, signed char) const; #endif /// - int Latex(ostream &, signed char) const; + int Latex(ostream &, signed char, bool fp) const; /// void Write(ostream &) const; /// diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index a61086ec3a..97475ee6a4 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -83,7 +83,7 @@ void InsetGraphics::Read(LyXLex & /*lex*/) } -int InsetGraphics::Latex(ostream & os, signed char /*fragile*/) const +int InsetGraphics::Latex(ostream & os, signed char /*fragile*/, bool/*fs*/) const { // MISSING: We have to decide how to do the order of the options // that is depentant of order, like witdth, height, andlge. Should @@ -226,7 +226,7 @@ int InsetGraphics::Latex(ostream & os, signed char /*fragile*/) const #ifndef USE_OSTREAM_ONLY -int InsetGraphics::Latex(string & /*file*/, signed char /*fragile*/) const +int InsetGraphics::Latex(string & /*file*/, signed char /*fragile*/, bool/*fs*/) const { return 0; } diff --git a/src/insets/insetgraphics.h b/src/insets/insetgraphics.h index 0d184f4d7a..3225df6132 100644 --- a/src/insets/insetgraphics.h +++ b/src/insets/insetgraphics.h @@ -45,10 +45,10 @@ public: fragile != 0 means, that the inset should take care about fragile commands by adding a \protect before. */ - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; /// int Linuxdoc(string & /*file*/) const; /// diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 1007ea6eef..49df77bd33 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -315,7 +315,7 @@ bool InsetInclude::loadIfNeeded() const } -int InsetInclude::Latex(ostream & os, signed char /*fragile*/) const +int InsetInclude::Latex(ostream & os, signed char /*fragile*/, bool /*fs*/) const { #ifdef USE_OSTREAM_ONLY // Do nothing if no file name has been specified @@ -386,7 +386,7 @@ int InsetInclude::Latex(ostream & os, signed char /*fragile*/) const #else string include_file; signed char dummy = 0; - Latex(include_file, dummy); + Latex(include_file, dummy, 0); os << include_file; return 0; #endif @@ -394,7 +394,7 @@ int InsetInclude::Latex(ostream & os, signed char /*fragile*/) const #ifndef USE_OSTREAM_ONLY -int InsetInclude::Latex(string & file, signed char /*fragile*/) const +int InsetInclude::Latex(string & file, signed char /*fragile*/, bool /*fs*/) const { // Do nothing if no file name has been specified if (contents.empty()) diff --git a/src/insets/insetinclude.h b/src/insets/insetinclude.h index 94179bdbe3..30383ebab8 100644 --- a/src/insets/insetinclude.h +++ b/src/insets/insetinclude.h @@ -4,7 +4,7 @@ * * LyX, The Document Processor * - * Copyright (C) 1997 LyX Team (this file was created this year) + * Copyright 1997 LyX Team (this file was created this year) * * ====================================================== */ @@ -58,10 +58,10 @@ public: /// void Read(LyXLex &); /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; #endif /// void Validate(LaTeXFeatures &) const; diff --git a/src/insets/insetinfo.C b/src/insets/insetinfo.C index 9e0d9f5755..0292e0790a 100644 --- a/src/insets/insetinfo.C +++ b/src/insets/insetinfo.C @@ -126,14 +126,14 @@ void InsetInfo::Read(LyXLex & lex) } -int InsetInfo::Latex(ostream &, signed char /*fragile*/) const +int InsetInfo::Latex(ostream &, signed char /*fragile*/, bool /*free_spc*/) const { return 0; } #ifndef USE_OSTREAM_ONLY -int InsetInfo::Latex(string &, signed char /*fragile*/) const +int InsetInfo::Latex(string &, signed char /*fragile*/, bool /*free_spc*/) const { return 0; } diff --git a/src/insets/insetinfo.h b/src/insets/insetinfo.h index 2ff60dde43..a738b15956 100644 --- a/src/insets/insetinfo.h +++ b/src/insets/insetinfo.h @@ -49,10 +49,10 @@ public: /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; /// int Linuxdoc(string & file) const; /// diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index 0a2a94f044..0bcfeae9bf 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -43,7 +43,7 @@ string InsetLabel::getLabel(int) const } -int InsetLabel::Latex(ostream & os, signed char /*fragile*/) const +int InsetLabel::Latex(ostream & os, signed char /*fragile*/, bool /*fs*/) const { os << escape(getCommand()); return 0; @@ -51,7 +51,7 @@ int InsetLabel::Latex(ostream & os, signed char /*fragile*/) const #ifndef USE_OSTREAM_ONLY -int InsetLabel::Latex(string & file, signed char /*fragile*/) const +int InsetLabel::Latex(string & file, signed char /*fragile*/, bool /*fs*/) const { file += escape(getCommand()); return 0; diff --git a/src/insets/insetlabel.h b/src/insets/insetlabel.h index 9932bdfdba..71aae7729d 100644 --- a/src/insets/insetlabel.h +++ b/src/insets/insetlabel.h @@ -39,10 +39,10 @@ public: /// EDITABLE Editable() const { return NOT_EDITABLE; } /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; /// int Linuxdoc(string & file) const; /// diff --git a/src/insets/insetlatex.C b/src/insets/insetlatex.C index a60f7b9ddb..0761f3f030 100644 --- a/src/insets/insetlatex.C +++ b/src/insets/insetlatex.C @@ -92,14 +92,14 @@ void InsetLatex::Read(LyXLex & lex) } -int InsetLatex::Latex(FILE * file, signed char /*fragile*/) +int InsetLatex::Latex(FILE * file, signed char /*fragile*/, bool /*fs*/) { fprintf(file, "%s", contents.c_str()); return 0; } -int InsetLatex::Latex(string & file, signed char /*fragile*/) +int InsetLatex::Latex(string & file, signed char /*fragile*/, bool /*fs*/) { file += contents; return 0; diff --git a/src/insets/insetlatex.h b/src/insets/insetlatex.h index cb7f7e4b1d..591c8eefd8 100644 --- a/src/insets/insetlatex.h +++ b/src/insets/insetlatex.h @@ -45,9 +45,9 @@ public: /// void Read(LyXLex & lex); /// - int Latex(FILE * file, signed char fragile); + int Latex(FILE * file, signed char fragile, bool free_spc); /// - int Latex(string & file, signed char fragile); + int Latex(string & file, signed char fragile, bool free_spc); /// int Linuxdoc(string & file); /// diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index 661ba931cb..b98fd082c3 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -745,7 +745,7 @@ void InsetLatexAccent::Read(LyXLex & lex) } -int InsetLatexAccent::Latex(ostream & os, signed char /*fragile*/) const +int InsetLatexAccent::Latex(ostream & os, signed char /*fragile*/, bool/*fs*/) const { os << contents; return 0; @@ -753,7 +753,7 @@ int InsetLatexAccent::Latex(ostream & os, signed char /*fragile*/) const #ifndef USE_OSTREAM_ONLY -int InsetLatexAccent::Latex(string & file, signed char /*fragile*/) const +int InsetLatexAccent::Latex(string & file, signed char /*fragile*/, bool /*fs*/) const { file += contents; return 0; diff --git a/src/insets/insetlatexaccent.h b/src/insets/insetlatexaccent.h index affb09a110..40448ca9e5 100644 --- a/src/insets/insetlatexaccent.h +++ b/src/insets/insetlatexaccent.h @@ -53,10 +53,10 @@ public: /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; /// int Linuxdoc(string & file) const; /// diff --git a/src/insets/insetloa.C b/src/insets/insetloa.C index 826f1bdcf8..86c7c501a5 100644 --- a/src/insets/insetloa.C +++ b/src/insets/insetloa.C @@ -4,8 +4,8 @@ * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich - * Copyright (C) 1996-1999 The LyX Team. + * Copyright 1995 Matthias Ettrich + * Copyright 1996-2000 The LyX Team. * * ====================================================== */ diff --git a/src/insets/insetparent.C b/src/insets/insetparent.C index fb06667f8f..cc1075d339 100644 --- a/src/insets/insetparent.C +++ b/src/insets/insetparent.C @@ -3,7 +3,7 @@ * * LyX, The Document Processor * - * Copyright (C) 1997-1999 LyX Team + * Copyright 1997-2000 The LyX Team. * * ====================================================== */ @@ -43,20 +43,20 @@ void InsetParent::Edit(BufferView * bv, int, int, unsigned int) // LaTeX must just ignore this command -int InsetParent::Latex(ostream & os, signed char fragile) const +int InsetParent::Latex(ostream & os, signed char fragile, bool free_spc) const { os << "%%#{lyx}"; - InsetCommand::Latex(os, fragile); + InsetCommand::Latex(os, fragile, free_spc); return 0; } #ifndef USE_OSTREAM_ONLY // LaTeX must just ignore this command -int InsetParent::Latex(string & file, signed char fragile) const +int InsetParent::Latex(string & file, signed char fragile, bool free_spc) const { file += "%%#{lyx}"; - InsetCommand::Latex(file, fragile); + InsetCommand::Latex(file, fragile, free_spc); return 0; } #endif diff --git a/src/insets/insetparent.h b/src/insets/insetparent.h index 745b3b8749..ab40f302a8 100644 --- a/src/insets/insetparent.h +++ b/src/insets/insetparent.h @@ -32,10 +32,10 @@ public: /// InsetParent(string const & fn, Buffer * owner = 0); /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; #endif /// Inset * Clone() const { return new InsetParent(getContents()); } diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 05e029d7ca..2b90fc3d1c 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -224,7 +224,7 @@ void InsetQuotes::Read(LyXLex & lex) } -int InsetQuotes::Latex(ostream & os, signed char /*fragile*/) const +int InsetQuotes::Latex(ostream & os, signed char /*fragile*/, bool) const { #ifdef USE_OSTREAM_ONLY string doclang = @@ -264,7 +264,7 @@ int InsetQuotes::Latex(ostream & os, signed char /*fragile*/) const return 0; #else string quote; - int res = Latex(quote, 0); + int res = Latex(quote, 0, 0); os << quote; return res; #endif @@ -272,7 +272,7 @@ int InsetQuotes::Latex(ostream & os, signed char /*fragile*/) const #ifndef USE_OSTREAM_ONLY -int InsetQuotes::Latex(string & file, signed char /*fragile*/) const +int InsetQuotes::Latex(string & file, signed char /*fragile*/, bool /*free_spc*/) const { string doclang = current_view->buffer()->GetLanguage(); diff --git a/src/insets/insetquotes.h b/src/insets/insetquotes.h index 515a8168d1..dbc8c7a7de 100644 --- a/src/insets/insetquotes.h +++ b/src/insets/insetquotes.h @@ -85,10 +85,10 @@ public: /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; /// int Linuxdoc(string & file) const; /// diff --git a/src/insets/insetref.C b/src/insets/insetref.C index 0a13720d03..8b31405bb7 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -67,7 +67,7 @@ string InsetRef::getScreenLabel() const } -int InsetRef::Latex(ostream & os, signed char /*fragile*/) const +int InsetRef::Latex(ostream & os, signed char /*fragile*/, bool /*fs*/) const { if(getOptions().empty()) os << escape(getCommand()); @@ -82,7 +82,7 @@ int InsetRef::Latex(ostream & os, signed char /*fragile*/) const #ifndef USE_OSTREAM_ONLY -int InsetRef::Latex(string & file, signed char /*fragile*/) const +int InsetRef::Latex(string & file, signed char /*fragile*/, bool /*fs*/) const { if(getOptions().empty()) file += escape(getCommand()); diff --git a/src/insets/insetref.h b/src/insets/insetref.h index 2e6f990f3e..3469445056 100644 --- a/src/insets/insetref.h +++ b/src/insets/insetref.h @@ -4,7 +4,7 @@ * * LyX, The Document Processor * - * Copyright (C) 1997 LyX Team (this file was created this year) + * Copyright 1997 LyX Team (this file was created this year) * * ====================================================== */ @@ -61,10 +61,10 @@ public: /// void gotoLabel(); /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; /// int Linuxdoc(string & file) const; /// diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index d094285022..87b4fb2cb6 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -188,7 +188,8 @@ void InsetSpecialChar::Read(LyXLex & lex) } -int InsetSpecialChar::Latex(ostream & os, signed char /*fragile*/) const +int InsetSpecialChar::Latex(ostream & os, signed char /*fragile*/, + bool free_space) const { #ifdef USE_OSTREAM_ONLY switch (kind) { @@ -196,13 +197,13 @@ int InsetSpecialChar::Latex(ostream & os, signed char /*fragile*/) const case END_OF_SENTENCE: os << "\\@."; break; case LDOTS: os << "\\ldots{}"; break; case MENU_SEPARATOR: os << "\\lyxarrow{}"; break; - case PROTECTED_SEPARATOR: os << "~"; break; + case PROTECTED_SEPARATOR: os << (free_space ? " " : "~"); break; } return 0; #else string command; signed char dummy = 0; - Latex(command, dummy); + Latex(command, dummy, free_space); os << command; return 0; #endif @@ -210,14 +211,15 @@ int InsetSpecialChar::Latex(ostream & os, signed char /*fragile*/) const #ifndef USE_OSTREAM_ONLY -int InsetSpecialChar::Latex(string & file, signed char /*fragile*/) const +int InsetSpecialChar::Latex(string & file, signed char /*fragile*/, + bool free_space) const { switch (kind) { case HYPHENATION: file += "\\-"; break; case END_OF_SENTENCE: file += "\\@."; break; case LDOTS: file += "\\ldots{}"; break; case MENU_SEPARATOR: file += "\\lyxarrow{}"; break; - case PROTECTED_SEPARATOR: file += "~"; break; + case PROTECTED_SEPARATOR: file += (free_space ? " " : "~"); break; } return 0; } diff --git a/src/insets/insetspecialchar.h b/src/insets/insetspecialchar.h index d591dc5943..327dc9efbe 100644 --- a/src/insets/insetspecialchar.h +++ b/src/insets/insetspecialchar.h @@ -4,7 +4,7 @@ * * LyX, The Document Processor * - * Copyright (C) 1997 Asger Alstrup + * Copyright 1997 Asger Alstrup * * ====================================================== */ @@ -59,10 +59,10 @@ public: /// Will not be used when lyxf3 void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; /// int Linuxdoc(string & file) const; /// diff --git a/src/insets/insettext.C b/src/insets/insettext.C index b029c52dd9..f7703842b4 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -584,7 +584,12 @@ InsetText::LocalDispatch(BufferView * bv, } -int InsetText::Latex(ostream & os, signed char /*fragile*/) const +int InsetText::Latex(ostream & os, signed char /*fragile*/, +#ifdef USE_OSTREAM_ONLY + bool) const +#else + bool free_spc) const +#endif { #ifdef USE_OSTREAM_ONLY TexRow texrow; @@ -593,7 +598,7 @@ int InsetText::Latex(ostream & os, signed char /*fragile*/) const #else string fstr; - int i = Latex(fstr, fragile); + int i = Latex(fstr, fragile, free_spc); os << fstr; return i; #endif diff --git a/src/insets/insettext.h b/src/insets/insettext.h index c616616d14..dff8829384 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -77,10 +77,10 @@ public: /// UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &); /// - int Latex(ostream &, signed char) const; + int Latex(ostream &, signed char, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string &, signed char) const; + int Latex(string &, signed char, bool free_spc) const; /// int Linuxdoc(string &) const { return 0; } /// diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index 540ac5bf45..efffb87f99 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -166,7 +166,7 @@ string InsetUrl::getScreenLabel() const } -int InsetUrl::Latex(ostream & os, signed char fragile) const +int InsetUrl::Latex(ostream & os, signed char fragile, bool free_spc) const { #ifdef USE_OSTREAM_ONLY if (!getOptions().empty()) @@ -177,7 +177,7 @@ int InsetUrl::Latex(ostream & os, signed char fragile) const return 0; #else string latex_output; - int res = Latex(latex_output, fragile); + int res = Latex(latex_output, fragile, free_spc); os << latex_output; return res; @@ -186,7 +186,7 @@ int InsetUrl::Latex(ostream & os, signed char fragile) const #ifndef USE_OSTREAM_ONLY -int InsetUrl::Latex(string & file, signed char fragile) const +int InsetUrl::Latex(string & file, signed char fragile, bool /*free_spc*/) const { if (!getOptions().empty()) file += getOptions() + ' '; diff --git a/src/insets/inseturl.h b/src/insets/inseturl.h index fc6835b81e..9016efc2a1 100644 --- a/src/insets/inseturl.h +++ b/src/insets/inseturl.h @@ -70,10 +70,10 @@ public: /// void gotoLabel(); /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; /// int Linuxdoc(string & file) const; /// diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index 2938f87601..840ca4b62f 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -123,11 +123,14 @@ public: /** returns the number of rows (\n's) of generated tex code. fragile != 0 means, that the inset should take care about fragile commands by adding a \protect before. + If the freee_spc (freespacing) variable is set, then this inset + is in a free-spacing paragraph. */ - virtual int Latex(ostream &, signed char fragile) const = 0; + virtual int Latex(ostream &, signed char fragile, bool free_spc) const = 0; + #ifndef USE_OSTREAM_ONLY /// - virtual int Latex(string & file, signed char fragile) const = 0; + virtual int Latex(string & file, signed char fragile, bool free_spc) const = 0; /// virtual int Linuxdoc(string & /*file*/) const = 0; /// diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 1d213ea05b..b332c74ca9 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -1091,7 +1091,7 @@ void AutoSave() // -// (c) CHT Software Service GmbH +// Copyright CHT Software Service GmbH // Uwe C. Schroeder // // create new file with template diff --git a/src/lyx_sty.h b/src/lyx_sty.h index a9a74d976c..eafab288db 100644 --- a/src/lyx_sty.h +++ b/src/lyx_sty.h @@ -5,7 +5,8 @@ LyX, The Document Processor - Copyright (C) 1995 Matthias Ettrich + Copyright 1995 Matthias Ettrich + copyright 1995-2000 The LyX Team. ====================================================== */ diff --git a/src/lyxcursor.h b/src/lyxcursor.h index fc0e832d33..d8c7303c20 100644 --- a/src/lyxcursor.h +++ b/src/lyxcursor.h @@ -4,7 +4,8 @@ * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 54d86baf64..7a74f32a63 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1643,7 +1643,19 @@ string LyXFunc::Dispatch(int ac, case LFUN_PROTECTEDSPACE: #if 1 - owner->view()->protectedBlank(); + { + LyXLayout const & style = + textclasslist.Style(owner->view()->buffer()->params.textclass, + owner->view()->text->cursor.par->GetLayout()); + + if (style.free_spacing) { + owner->view()->text->InsertChar(' '); + owner->view()->update(-1); + } else { + owner->view()->protectedBlank(); + } + moveCursorUpdate(false); + } #else owner->view()->beforeChange(); owner->view()->text-> diff --git a/src/lyxlex.C b/src/lyxlex.C index 88d7466476..c352465505 100644 --- a/src/lyxlex.C +++ b/src/lyxlex.C @@ -2,10 +2,11 @@ // It can be used for simple syntax parsers, like lyxrc, // texclass and others to come. [asierra30/03/96] // -// (C) 1996 Lyx Team. +// Copyright 1996 Lyx Team. #include +#include #include #ifdef __GNUG__ @@ -15,15 +16,47 @@ #include "lyxlex.h" #include "debug.h" #include "support/filetools.h" +#include "support/lyxalgo.h" using std::ios; +using std::lower_bound; +using std::sort; + + +// namespace { +struct compare_tags { + // used by lower_bound + inline + int operator()(keyword_item const & a, char const * const tag) const { + return compare_no_case(a.tag, tag) < 0; + } + // used by sorted and sort + inline + int operator()(keyword_item const & a, keyword_item const & b) const { + return compare_no_case(a.tag, b.tag) < 0; + } +}; +// } // end of anon namespace + LyXLex::LyXLex(keyword_item * tab, int num) : is(&fb__), table(tab), no_items(num) { - - status = 0; + status = 0; pushed = 0; + // Check if the table is sorted and if not, sort it. + if (table && !sorted(table, table + no_items, compare_tags())) { + lyxerr << "The table passed to LyXLex is not sorted!!\n" + << "Tell the developers to fix it!" << endl; + // We sort it anyway to avoid problems. + lyxerr << "\nUnsorted:\n"; + printTable(lyxerr); + + sort(table, table + no_items, + compare_tags()); + lyxerr << "\nSorted:\n"; + printTable(lyxerr); + } } @@ -36,6 +69,18 @@ void LyXLex::pushTable(keyword_item * tab, int num) pushed = tmppu; table = tab; no_items = num; + // Check if the table is sorted and if not, sort it. + if (table && !sorted(table, table + no_items, compare_tags())) { + lyxerr << "The table passed to LyXLex is not sorted!!\n" + << "Tell the developers to fix it!" << endl; + // We sort it anyway to avoid problems. + lyxerr << "\nUnsorted:\n"; + printTable(lyxerr); + + sort(table, table + no_items, compare_tags()); + lyxerr << "\nSorted:\n"; + printTable(lyxerr); + } } @@ -54,14 +99,14 @@ void LyXLex::popTable() } -void LyXLex::printTable() +void LyXLex::printTable(ostream & os) { - lyxerr << "\nNumber of tags: " << no_items << endl; + os << "\nNumber of tags: " << no_items << '\n'; for(int i= 0; i < no_items; ++i) - lyxerr << "table[" << i - << "]: tag: `" << table[i].tag - << "' code:" << table[i].code << endl; - lyxerr << endl; + os << "table[" << i + << "]: tag: `" << table[i].tag + << "' code:" << table[i].code << '\n'; + os.flush(); } @@ -227,25 +272,10 @@ bool LyXLex::EatLine() int LyXLex::search_kw(char const * const tag) const { - int m, k = 0 , l = 0, r = no_items; - - while (l < r) { - m = (l + r) / 2; - - if (lyxerr.debugging(Debug::PARSER)) { - lyxerr << "LyXLex::search_kw: elem " << m - << " tag " << table[m].tag - << " search tag " << tag - << endl; - } - - if (table[m].tag) - k = compare_no_case(table[m].tag, tag); - if (k == 0) - return table[m].code; - else - if (k < 0) l = m + 1; else r = m; - } + keyword_item * res = + lower_bound(table, table + no_items, tag, compare_tags()); + if (res != table + no_items && !compare_no_case(res->tag, tag)) + return res->code; return LEX_UNDEF; } diff --git a/src/lyxlex.h b/src/lyxlex.h index 87d207d8c7..dcfca5eb9b 100644 --- a/src/lyxlex.h +++ b/src/lyxlex.h @@ -3,7 +3,7 @@ // It can be used for simple syntax parsers, like lyxrc, // texclass and others to come. [asierra30/03/96] // -// (C) 1996 Lyx Team. +// Copyright 1996 Lyx Team. #ifndef LYXLEX_H #define LYXLEX_H @@ -84,14 +84,14 @@ public: string GetString() const; /// get a long string, ended by the tag `endtag' - string getLongString(string const & endtoken); + string getLongString(string const & endtag); /// bool EatLine(); /// - int FindToken(char const * string[]); + int FindToken(char const * str[]); /// - int CheckToken(char const * string[], int print_error); + int CheckToken(char const * str[], int print_error); /// char const * text() const { return &buff[0]; } @@ -112,9 +112,9 @@ public: void printError(string const & message) const; /** - Prints the current token table on cerr. + Prints the current token table on the supplied ostream. */ - void printTable(); + void printTable(ostream &); protected: /// enum { diff --git a/src/lyxlookup.h b/src/lyxlookup.h index 44adec6998..582a13db35 100644 --- a/src/lyxlookup.h +++ b/src/lyxlookup.h @@ -3,8 +3,8 @@ * * LyX, The Document Processor * -* Copyright (C) 1995-1997 Matthias Ettrich -* & The LyX team +* Copyright 1995 Matthias Ettrich +* Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lyxrc.C b/src/lyxrc.C index cda4e56621..18dbfb0bf7 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -232,8 +232,8 @@ keyword_item lyxrcTags[] = { { "\\view_dvi_command", RC_VIEWDVI_COMMAND }, { "\\view_dvi_paper_option", RC_VIEWDVI_PAPEROPTION }, { "\\view_pdf_command", RC_VIEWPDF_COMMAND }, - { "\\view_ps_command", RC_VIEWPS_COMMAND }, - { "\\view_pspic_command", RC_VIEWPSPIC_COMMAND } + { "\\view_pspic_command", RC_VIEWPSPIC_COMMAND }, + { "\\view_ps_command", RC_VIEWPS_COMMAND } }; /* Let the range depend of the size of lyxrcTags. Alejandro 240596 */ @@ -357,7 +357,7 @@ int LyXRC::read(string const & filename) LyXLex lexrc(lyxrcTags, lyxrcCount); if (lyxerr.debugging(Debug::PARSER)) - lexrc.printTable(); + lexrc.printTable(lyxerr); lexrc.setFile(filename); if (!lexrc.IsOK()) return -2; diff --git a/src/lyxserver.h b/src/lyxserver.h index e9ddba0b90..1e58cd9065 100644 --- a/src/lyxserver.h +++ b/src/lyxserver.h @@ -4,8 +4,8 @@ * * LyX, The Document Processor * -* Copyright (C) 1995 Matthias Ettrich -* Copyright (C) 1995-1998 The LyX Team. +* Copyright 1995 Matthias Ettrich +* Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/mathed/array.h b/src/mathed/array.h index 9b10bd54df..91d3620625 100644 --- a/src/mathed/array.h +++ b/src/mathed/array.h @@ -7,7 +7,7 @@ * * Dependencies: None (almost) * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * 1997 The LyX Team! * * You are free to use and modify this code under the terms of diff --git a/src/mathed/formula.C b/src/mathed/formula.C index c5696e0496..b3286f288a 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -5,7 +5,7 @@ * Created: January 1996 * Description: Allows the edition of math paragraphs inside Lyx. * - * Copyright: (c) 1996-1998 Alejandro Aguilar Sierra + * Copyright: 1996-1998 Alejandro Aguilar Sierra * * Version: 0.4, Lyx project. * @@ -295,11 +295,16 @@ Inset * InsetFormula::Clone() const void InsetFormula::Write(ostream & os) const { os << "Formula "; - Latex(os, 0); + Latex(os, 0, 0); } -int InsetFormula::Latex(ostream & os, signed char fragile) const +int InsetFormula::Latex(ostream & os, signed char fragile, +#ifdef USE_OSTREAM_ONLY + bool) const +#else + bool free_spc) const +#endif { int ret = 0; //#warning Alejandro, the number of lines is not returned in this case @@ -312,7 +317,7 @@ int InsetFormula::Latex(ostream & os, signed char fragile) const #else string output; - InsetFormula::Latex(output, fragile); + InsetFormula::Latex(output, fragile, free_spc); os << output; #endif return ret; diff --git a/src/mathed/formula.h b/src/mathed/formula.h index 22d35af33e..91b250ef04 100644 --- a/src/mathed/formula.h +++ b/src/mathed/formula.h @@ -6,7 +6,7 @@ * Created: January 1996 * Description: Allows the edition of math paragraphs inside Lyx. * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * * Version: 0.4, Lyx project. * @@ -49,10 +49,10 @@ public: /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile) const; + int Latex(ostream &, signed char fragile, bool free_spc) const; #ifndef USE_OSTREAM_ONLY /// - int Latex(string & file, signed char fragile) const; + int Latex(string & file, signed char fragile, bool free_spc) const; /// int Linuxdoc(string & file) const; /// diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C index 031ecc1d1c..cb40a7bcd0 100644 --- a/src/mathed/formulamacro.C +++ b/src/mathed/formulamacro.C @@ -5,7 +5,7 @@ * Created: January 1996 * Description: Allows the edition of math paragraphs inside Lyx. * - * Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra + * Copyright: 1996, 1997 Alejandro Aguilar Sierra * * Version: 0.4, Lyx project. * diff --git a/src/mathed/formulamacro.h b/src/mathed/formulamacro.h index 8aa623e240..741f8dabfe 100644 --- a/src/mathed/formulamacro.h +++ b/src/mathed/formulamacro.h @@ -6,7 +6,7 @@ * Created: January 1996 * Description: Allows the edition of math paragraphs inside Lyx. * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * * Version: 0.4, Lyx project. * diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 8cf4eb34ec..a9469947a7 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -7,7 +7,7 @@ * * Dependencies: Xlib, XForms * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * * Version: 0.8beta, Mathed & Lyx project. * diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index b6a2dfed85..9603884dd7 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -8,7 +8,7 @@ * * Dependencies: Xlib, XForms * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * * Version: 0.8beta, Mathed & Lyx project. * diff --git a/src/mathed/math_defs.h b/src/mathed/math_defs.h index 40acc3a004..515027ab20 100644 --- a/src/mathed/math_defs.h +++ b/src/mathed/math_defs.h @@ -8,7 +8,7 @@ * * Dependencies: Xlib * - * Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra + * Copyright: 1996, 1997 Alejandro Aguilar Sierra * * Version: 0.8beta, Mathed & Lyx project. * diff --git a/src/mathed/math_delim.C b/src/mathed/math_delim.C index 9f09cb3511..b47d4e9efe 100644 --- a/src/mathed/math_delim.C +++ b/src/mathed/math_delim.C @@ -7,7 +7,7 @@ * * Dependencies: Xlib, XForms * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * * Version: 0.8beta, Mathed & Lyx project. * @@ -18,12 +18,16 @@ #include #include FORMS_H_LOCATION +#include #include #include "symbol_def.h" #include "math_inset.h" #include "LColor.h" #include "Painter.h" +using std::sort; +using std::lower_bound; + /* * Internal struct of a drawing: code n x1 y1 ... xn yn, where code is: * 0 = end, 1 = line, 2 = polyline, 3 = square line, 4= square polyline @@ -164,9 +168,14 @@ static float tilde[] = { 0.0 }; -static struct math_deco_struct { - int code; float *data; int angle; -} math_deco_table[] = { +struct math_deco_struct { + int code; + float * data; + int angle; +}; + +static +math_deco_struct math_deco_table[] = { // Decorations { LM_widehat, &angle[0], 3 }, @@ -219,9 +228,7 @@ static struct math_deco_struct { { LM_ldots, &hline3[0], 0 }, { LM_cdots, &hline3[0], 0 }, { LM_vdots, &hline3[0], 1 }, - { LM_ddots, &dline3[0], 0 }, - - { 0, 0, 0 } + { LM_ddots, &dline3[0], 0 } }; @@ -289,14 +296,52 @@ void Matriz::transf(float xp, float yp, float & x, float & y) } +struct math_deco_compare { + /// for use by sort + inline + int operator()(math_deco_struct const & a, + math_deco_struct const & b) const { + return a.code < b.code; + } + /// for use by lower_bound + inline + int operator()(math_deco_struct const & a, int b) const { + return a.code < b; + } +}; + + +static +int const math_deco_table_size = sizeof(math_deco_table) /sizeof(math_deco_struct); + +class init_deco_table { +public: + init_deco_table() { + if (!init) { + sort(math_deco_table, + math_deco_table + math_deco_table_size, + math_deco_compare()); + init_deco_table::init == true; + } + } +private: + static bool init; +}; + +bool init_deco_table::init = false; +static init_deco_table idt; + static int search_deco(int code) { - int i = 0; - - while (math_deco_table[i].code && math_deco_table[i].code != code) ++i; - if (!math_deco_table[i].code) i = -1; - return i; + math_deco_struct * res = + lower_bound(math_deco_table, + math_deco_table + math_deco_table_size, + code, math_deco_compare()); + if (res != math_deco_table + math_deco_table_size && + res->code == code) + return res - math_deco_table; + return -1; } @@ -375,14 +420,14 @@ MathDelimInset::draw(Painter & pain, int x, int y) if (left == '.') { pain.line(x + 4, yo - ascent, x + 4, yo + descent, - LColor::mathcursor); + LColor::mathcursor, Painter::line_onoffdash); } else mathed_draw_deco(pain, x, y - ascent, dw, Height(), left); - x += Width()-dw-2; + x += Width() - dw - 2; if (right == '.') { pain.line(x + 4, yo - ascent, x + 4, yo + descent, - LColor::mathcursor); + LColor::mathcursor, Painter::line_onoffdash); } else mathed_draw_deco(pain, x, y-ascent, dw, Height(), right); } diff --git a/src/mathed/math_draw.C b/src/mathed/math_draw.C index 630b1337b5..e476e52ace 100644 --- a/src/mathed/math_draw.C +++ b/src/mathed/math_draw.C @@ -7,7 +7,7 @@ * * Dependencies: Xlib, XForms * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * * Version: 0.8beta, Mathed & Lyx project. * diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index 2ab5f8c320..8b872a0af0 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -7,7 +7,7 @@ * * Dependencies: Xlib, XForms * - * Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra + * Copyright: 1996, 1997 Alejandro Aguilar Sierra * * Version: 0.8beta. * diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index 1deccae322..bee3ffb0a5 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -8,7 +8,7 @@ * * Dependencies: Xlib, XForms * - * Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra + * Copyright: 1996, 1997 Alejandro Aguilar Sierra * * Version: 0.8beta, Mathed & Lyx project. * diff --git a/src/mathed/math_iter.C b/src/mathed/math_iter.C index efa4cb108e..20f506af8c 100644 --- a/src/mathed/math_iter.C +++ b/src/mathed/math_iter.C @@ -7,7 +7,7 @@ * * Dependencies: Xlib, XForms * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * * Version: 0.8beta. * diff --git a/src/mathed/math_iter.h b/src/mathed/math_iter.h index 2b495e8bd5..15a5132d47 100644 --- a/src/mathed/math_iter.h +++ b/src/mathed/math_iter.h @@ -8,7 +8,7 @@ * * Dependencies: Xlib * - * Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra + * Copyright: 1996, 1997 Alejandro Aguilar Sierra * * Version: 0.8beta, Mathed & Lyx project. * diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index 6fcd845ad7..bfd5b5cb75 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -8,7 +8,7 @@ * * Dependencies: Mathed * - * Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra + * Copyright: 1996, 1997 Alejandro Aguilar Sierra * * Version: 0.2, Mathed & Lyx project. * diff --git a/src/mathed/math_macro.h b/src/mathed/math_macro.h index 587fe4778f..5bb7036692 100644 --- a/src/mathed/math_macro.h +++ b/src/mathed/math_macro.h @@ -8,7 +8,7 @@ * * Dependencies: Mathed * - * Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra + * Copyright: 1996, 1997 Alejandro Aguilar Sierra * * Version: 0.2, Mathed & Lyx project. * diff --git a/src/mathed/math_panel.C b/src/mathed/math_panel.C index a5804d7b43..a97cb9f3ce 100644 --- a/src/mathed/math_panel.C +++ b/src/mathed/math_panel.C @@ -6,7 +6,7 @@ * * Dependencies: Xlib, Xpm, XForms, Lyx * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * * You are free to use and modify it under the terms of * the GNU General Public Licence version 2 or later. diff --git a/src/mathed/math_panel.h b/src/mathed/math_panel.h index de617892cf..b6ce86ca5a 100644 --- a/src/mathed/math_panel.h +++ b/src/mathed/math_panel.h @@ -7,7 +7,7 @@ * * Dependencies: Xlib, Xpm, XForms, Lyx * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * * You are free to use and modify it under the terms of * the GNU General Public Licence version 2 or later. diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 0ca6a7f6e7..bed701268e 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -7,7 +7,7 @@ * * Dependencies: Xlib, XForms * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * * Version: 0.8beta. * diff --git a/src/mathed/math_parser.h b/src/mathed/math_parser.h index 913aad0212..84410087da 100644 --- a/src/mathed/math_parser.h +++ b/src/mathed/math_parser.h @@ -8,7 +8,7 @@ * * Dependencies: Xlib, XForms * - * Copyright: (c) 1996, Alejandro Aguilar Sierra + * Copyright: 1996, Alejandro Aguilar Sierra * * Version: 0.8beta. * diff --git a/src/mathed/math_root.C b/src/mathed/math_root.C index f37fe0518c..5afecc6826 100644 --- a/src/mathed/math_root.C +++ b/src/mathed/math_root.C @@ -6,7 +6,7 @@ * Created: January 1999 * Description: Root math object * - * Copyright: (c) 1999 Alejandro Aguilar Sierra + * Copyright: 1999 Alejandro Aguilar Sierra * * You are free to use and modify this code under the terms of * the GNU General Public Licence version 2 or later. diff --git a/src/mathed/math_root.h b/src/mathed/math_root.h index 5123fbf5cc..ee2d30c311 100644 --- a/src/mathed/math_root.h +++ b/src/mathed/math_root.h @@ -6,7 +6,7 @@ * Created: January 1999 * Description: Root math object * - * Copyright: (c) 1999 Alejandro Aguilar Sierra + * Copyright: 1999 Alejandro Aguilar Sierra * * You are free to use and modify this code under the terms of * the GNU General Public Licence version 2 or later. diff --git a/src/mathed/math_symbols.C b/src/mathed/math_symbols.C index 5b01fc2ae8..f1c9ea79e1 100644 --- a/src/mathed/math_symbols.C +++ b/src/mathed/math_symbols.C @@ -9,7 +9,7 @@ * * Dependencies: Xlib, XForms, Lyx * - * Copyright: (c) 1995, 1996, Alejandro Aguilar Sierra + * Copyright: 1995, 1996, Alejandro Aguilar Sierra * * You are free to use and modify it under the terms of * the GNU General Public Licence version 2 or later. diff --git a/src/mathed/math_utils.C b/src/mathed/math_utils.C index d13408c8ff..0d9c61c1e4 100644 --- a/src/mathed/math_utils.C +++ b/src/mathed/math_utils.C @@ -4,7 +4,7 @@ * Author: Alejandro Aguilar Sierra * Created: August 1996 * - * Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra + * Copyright: 1996, 1997 Alejandro Aguilar Sierra * * License: GNU GPL version 2 or later */ diff --git a/src/mathed/math_write.C b/src/mathed/math_write.C index 10f91d4dfe..c0d4f3dd6b 100644 --- a/src/mathed/math_write.C +++ b/src/mathed/math_write.C @@ -7,7 +7,7 @@ * * Dependencies: Xlib, XForms * - * Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra + * Copyright: 1996, 1997 Alejandro Aguilar Sierra * * Version: 0.8beta, Mathed & Lyx project. * diff --git a/src/menus.h b/src/menus.h index 84c9540d79..92350d6241 100644 --- a/src/menus.h +++ b/src/menus.h @@ -4,8 +4,8 @@ * * LyX, The Document Processor * -* Copyright (C) 1995 1996 Matthias Ettrich -* and the LyX Team. +* Copyright 1995 Matthias Ettrich +* Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/os2_defines.h b/src/os2_defines.h index c3a5d98a27..7a3cb1d47c 100644 --- a/src/os2_defines.h +++ b/src/os2_defines.h @@ -4,7 +4,8 @@ * * LyX, The Document Processor * -* Copyright (C) 1995, 1996 Matthias Ettrich +* Copyright 1995 Matthias Ettrich +* Copyright 1995-2000 The LyX Team. * * ====================================================== A few prototypes and definitions needed for OS/2 */ diff --git a/src/os2_errortable.h b/src/os2_errortable.h index d3782a75f2..997f55dbc5 100644 --- a/src/os2_errortable.h +++ b/src/os2_errortable.h @@ -4,7 +4,8 @@ * * LyX, The Document Processor * -* Copyright (C) 1995, 1996 Matthias Ettrich +* Copyright 1995 Matthias Ettrich +* Copyright 1995-2000 The LyX Team. * * ====================================================== A table for translating OS/2 API return code into errno. diff --git a/src/paragraph.C b/src/paragraph.C index ca58a7546b..3fd61f0ca9 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1936,7 +1936,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(ostream & os, TexRow & texrow, break; case LATEX_ITEM_ENVIRONMENT: if (bibkey) { - bibkey->Latex(os, false); + bibkey->Latex(os, false, false); } else os << "\\item "; break; @@ -4003,7 +4003,8 @@ void LyXParagraph::SimpleTeXSpecialChars(ostream & os, TexRow & texrow, close = true; } - int tmp = inset->Latex(os, style.isCommand()); + int tmp = inset->Latex(os, style.isCommand(), + style.free_spacing); if (close) os << "}"; diff --git a/src/support/LIstream.h b/src/support/LIstream.h index 0abcb7490d..427acf29bd 100644 --- a/src/support/LIstream.h +++ b/src/support/LIstream.h @@ -4,8 +4,8 @@ * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich - * Copyright (C) 1995-1999 The LyX Team. + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/support/LOstream.h b/src/support/LOstream.h index 7b44bb7ae2..32eba7d65d 100644 --- a/src/support/LOstream.h +++ b/src/support/LOstream.h @@ -4,8 +4,8 @@ * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich - * Copyright (C) 1995-1999 The LyX Team. + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/support/LSubstring.h b/src/support/LSubstring.h index f5ec98b8f9..1f82069139 100644 --- a/src/support/LSubstring.h +++ b/src/support/LSubstring.h @@ -4,8 +4,8 @@ * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich - * Copyright (C) 1995-1998 The LyX Team. + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/support/Makefile.am b/src/support/Makefile.am index c4bac76195..570077fbf1 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -36,6 +36,7 @@ libsupport_la_SOURCES = \ kill.C \ lstrings.C \ lstrings.h \ + lyxalgo.h \ lyxlib.h \ lyxmanip.h \ $(LYXSTRING) lyxsum.C \ diff --git a/src/support/lstrings.C b/src/support/lstrings.C index 86c1d36e33..6ac6cbb293 100644 --- a/src/support/lstrings.C +++ b/src/support/lstrings.C @@ -18,6 +18,7 @@ using std::transform; using std::tolower; using std::toupper; + int compare_no_case(string const & s, string const & s2) { // ANSI C diff --git a/src/support/lyxalgo.h b/src/support/lyxalgo.h new file mode 100644 index 0000000000..27cae60bb5 --- /dev/null +++ b/src/support/lyxalgo.h @@ -0,0 +1,40 @@ +// -*- C++ -*- + +#ifndef LYX_ALGO_H +#define LYX_ALGO_H + +#include + +using std::less; + +// Both these functions should ideally be placed into namespace lyx. +// Also the using std::less should not be used. + +//namespace lyx { + +/// Returns true if the sequence first,last is sorted, false if not. +template +bool sorted(For first, For last) +{ + if (first == last) return true; + For tmp = first; + while (++tmp != last) { + if (less(*tmp, *first++)) return false; + } + return true; +} + +/// Cmp is the same Cmp as you would pass to std::sort. +template +bool sorted(For first, For last, Cmp cmp) +{ + if (first == last) return true; + For tmp = first; + while (++tmp != last) { + if (cmp(*tmp, *first++)) return false; + } + return true; +} + +// } // end of namespace lyx +#endif diff --git a/src/support/lyxlib.h b/src/support/lyxlib.h index 5d75f098c6..3933cf0b63 100644 --- a/src/support/lyxlib.h +++ b/src/support/lyxlib.h @@ -4,8 +4,8 @@ * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich - * Copyright (C) 1995-1999 The LyX Team. + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/support/textutils.h b/src/support/textutils.h index a50a762baf..4c07ee308d 100644 --- a/src/support/textutils.h +++ b/src/support/textutils.h @@ -4,7 +4,8 @@ * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/table.h b/src/table.h index cedac0fc88..396f9e0f5f 100644 --- a/src/table.h +++ b/src/table.h @@ -4,7 +4,8 @@ * * LyX, The Document Processor * - * Copyright (C) 1995, 1996 Matthias Ettrich + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ #ifndef TABLE_H diff --git a/src/texrow.C b/src/texrow.C index 702f68b8c0..260517cdd7 100644 --- a/src/texrow.C +++ b/src/texrow.C @@ -3,8 +3,8 @@ * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich - * Copyright (C) 1995-2000 The LyX Team. + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/text.C b/src/text.C index b74e690bc8..d13e3b62ff 100644 --- a/src/text.C +++ b/src/text.C @@ -2404,24 +2404,12 @@ void LyXText::InsertChar(char c) cursor.par->ParFromPos(cursor.pos)->next); /* When the free-spacing option is set for the current layout, - * all spaces are converted to protected spaces. */ - // Thinko! -#warning think about this -#if 0 - bool freeSpacingBo = + * disable the double-space checking */ + + bool freeSpacing = textclasslist.Style(parameters->textclass, cursor.row->par->GetLayout()).free_spacing; - // Thinkee: (not done) - // It seems that we should insert a InsetSpecialChar, do we really - // have to? I don't know the free spacing politics too deeply. - // Some others should have a look at this. - if (freeSpacingBo && IsLineSeparatorChar(c) - && (!cursor.pos || cursor.par->IsLineSeparator(cursor.pos - 1))) { - c = LyXParagraph::META_PROTECTED_SEPARATOR; - } -#endif - /* table stuff -- begin*/ if (cursor.par->table) { InsertCharInTable(c); @@ -2456,7 +2444,7 @@ void LyXText::InsertChar(char c) bool jumped_over_space = false; - if (IsLineSeparatorChar(c)) { + if (!freeSpacing && IsLineSeparatorChar(c)) { #ifndef FIX_DOUBLE_SPACE if (cursor.pos < lastpos && cursor.par->IsLineSeparator(cursor.pos)) { @@ -2993,7 +2981,7 @@ char * LyXText::SelectNextWord(float & value) && (cursor.par->IsLetter(cursor.pos)) || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET && cursor.par->GetInset(cursor.pos) != 0 - && cursor.par->GetInset(cursor.pos)->Latex(latex, 0) == 0 + && cursor.par->GetInset(cursor.pos)->Latex(latex, 0, false) == 0 #ifdef USE_OSTREAM_ONLY #ifdef HAVE_SSTREAM && latex.str() == "\\-" @@ -3051,7 +3039,7 @@ void LyXText::SelectSelectedWord() && (cursor.par->IsLetter(cursor.pos) || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET && cursor.par->GetInset(cursor.pos) != 0 - && cursor.par->GetInset(cursor.pos)->Latex(latex, 0) == 0 + && cursor.par->GetInset(cursor.pos)->Latex(latex, 0, false) == 0 #ifdef USE_OSTREAM_ONLY #ifdef HAVE_SSTREAM && latex.str() == "\\-" diff --git a/src/text2.C b/src/text2.C index f8979be1aa..55e8221ec7 100644 --- a/src/text2.C +++ b/src/text2.C @@ -3248,6 +3248,11 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const // this is the delete-empty-paragraph-mechanism. if (selection) return; + // if free-spacing, then return also. + if (textclasslist.Style(parameters->textclass, + old_cursor.row->par->GetLayout()).free_spacing) + return; + #ifdef FIX_DOUBLE_SPACE /* Ok I'll put some comments here about what is missing. I have fixed BackSpace (and thus Delete) to not delete diff --git a/src/toolbar.C b/src/toolbar.C index 254b23d23c..73ae92a97b 100644 --- a/src/toolbar.C +++ b/src/toolbar.C @@ -600,7 +600,7 @@ void Toolbar::read(LyXLex & lex) lex.pushTable(toolTags, TO_LAST - 1); if (lyxerr.debugging(Debug::PARSER)) - lex.printTable(); + lex.printTable(lyxerr); while (lex.IsOK() && !quit) { diff --git a/src/vms_defines.h b/src/vms_defines.h index 92545f732c..93e82469a4 100644 --- a/src/vms_defines.h +++ b/src/vms_defines.h @@ -4,7 +4,8 @@ * * LyX, the High Level Word Processor * -* Copyright (C) 1995, 1996 Matthias Ettrich +* Copyright 1995 Matthias Ettrich +* Copyright 1995-2000 The LyX Team. * * ====================================================== A few prototypes and definitions needed for VMS / OpenVMS */