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
This commit is contained in:
Lars Gullik Bjønnes 2000-03-09 03:36:48 +00:00
parent 34924681ca
commit 132fe5e132
102 changed files with 586 additions and 289 deletions

125
ChangeLog
View File

@ -1,3 +1,128 @@
2000-03-07 Kayvan A. Sylvan <kayvan@camel.internal.sylvan.com>
* 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 <larsbj@lyx.org>
* 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 <larsbj@lyx.org>
* 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 <jug@sad.it> 2000-03-08 Juergen Vigna <jug@sad.it>
* src/lyxfunc.C (Dispatch): forgot a break in the LFUN_INSET_ERT * src/lyxfunc.C (Dispatch): forgot a break in the LFUN_INSET_ERT

View File

@ -2,8 +2,7 @@
# Suggested style to write your code: # Suggested style to write your code:
# Within same scrap, lines are separated by new-lines (Ctrl-return), use: # Within same scrap, lines are separated by new-lines (Ctrl-return), use:
# ItemSep 0.4 # ItemSep 0.4
# . disavantage: lyx doesn't allow space on first column, use proteced space # . disavantage: must type ctrl-return every single line
# must type ctrl-return every single line
# . advantage: looks better (IMHO) # . advantage: looks better (IMHO)
# resembles more closelly the produced paper doc. (more WYSIWYG) # resembles more closelly the produced paper doc. (more WYSIWYG)
# #

View File

@ -31,7 +31,7 @@ using std::ifstream;
// Inserts a file into current document // Inserts a file into current document
bool BufferView::insertLyXFile(string const & filen) bool BufferView::insertLyXFile(string const & filen)
// //
// (c) CHT Software Service GmbH // Copyright CHT Software Service GmbH
// Uwe C. Schroeder // Uwe C. Schroeder
// //
// Insert a Lyxformat - file into current buffer // Insert a Lyxformat - file into current buffer

View File

@ -8,7 +8,7 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1997-1998 Allan Rae * Copyright 1997-1998 Allan Rae
* and the LyX Team * and the LyX Team
* *
* ====================================================== */ * ====================================================== */

View File

@ -2,10 +2,10 @@
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * LyX, The Document Processor
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-2000 The LyX Team.
* *
* This file is Copyright (C) 1996-1998 * This file is Copyright 1996-2000
* Lars Gullik Bjønnes * Lars Gullik Bjønnes
* *
* ====================================================== * ======================================================

View File

@ -3,9 +3,10 @@
* ====================================================== * ======================================================
* *
* LyX, The Document Processor * 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 * Lars Gullik Bjønnes
* *
* ====================================================== * ======================================================

View File

@ -6,7 +6,7 @@
* Description: A bitmap table uses a single bitmap to simulate a 2d array * Description: A bitmap table uses a single bitmap to simulate a 2d array
* of bitmap buttons. It can be used to build bitmap menus. * 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 * You are free to use and modify this code under the terms of
* the GNU General Public Licence version 2 or later. * the GNU General Public Licence version 2 or later.

View File

@ -4,8 +4,9 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team * Copyright 1995-2000 The LyX Team
*
* ====================================================== * ======================================================
A few prototypes missing from Sun and SCO 3.2v4 header files */ A few prototypes missing from Sun and SCO 3.2v4 header files */

View File

@ -919,11 +919,39 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
par->SetFont(pos, font); par->SetFont(pos, font);
++pos; ++pos;
} else if (token == "\\SpecialChar") { } else if (token == "\\SpecialChar") {
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 = new InsetSpecialChar;
inset->Read(lex); inset->Read(lex);
par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset); par->InsertInset(pos, inset);
par->SetFont(pos, font); par->SetFont(pos, font);
}
++pos; ++pos;
} else if (token == "\\Figure") { } else if (token == "\\Figure") {
inset = new InsetFig(100, 100, this); inset = new InsetFig(100, 100, this);
@ -951,10 +979,19 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
++pos; ++pos;
} else if (token == "\\protected_separator") { // obsolete } else if (token == "\\protected_separator") { // obsolete
#if 1 #if 1
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); inset = new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
par->InsertChar(pos, LyXParagraph::META_INSET); par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset); par->InsertInset(pos, inset);
par->SetFont(pos, font); par->SetFont(pos, font);
}
#else #else
par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR); par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR);
par->SetFont(pos, font); par->SetFont(pos, font);
@ -1292,6 +1329,11 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
noparbreak = 1; noparbreak = 1;
} }
LyXLayout const & layout =
textclasslist.Style(params.textclass,
par->GetLayout());
bool free_spc = layout.free_spacing;
/* It might be a table */ /* It might be a table */
if (par->table){ if (par->table){
#if 0 #if 0
@ -1307,6 +1349,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
cells = par->table->columns; cells = par->table->columns;
clen = new int [cells]; clen = new int [cells];
memset(clen, 0, sizeof(int) * cells); memset(clen, 0, sizeof(int) * cells);
for (i = 0, j = 0, h = 1; i < par->size(); ++i, ++h) { for (i = 0, j = 0, h = 1; i < par->size(); ++i, ++h) {
c = par->GetChar(i); c = par->GetChar(i);
if (c == LyXParagraph::META_INSET) { if (c == LyXParagraph::META_INSET) {
@ -1314,11 +1357,11 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
#if 1 #if 1
#ifdef HAVE_SSTREAM #ifdef HAVE_SSTREAM
ostringstream ost; ostringstream ost;
inset->Latex(ost, -1); inset->Latex(ost, -1, free_spc);
h += ost.str().length(); h += ost.str().length();
#else #else
ostrstream ost; ostrstream ost;
inset->Latex(ost, -1); inset->Latex(ost, -1, free_spc);
ost << '\0'; ost << '\0';
char * tmp = ost.str(); char * tmp = ost.str();
string tstr(tmp); string tstr(tmp);
@ -1331,7 +1374,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
WriteFSAlert(_("Error: Cannot open temporary file:"), fname1); WriteFSAlert(_("Error: Cannot open temporary file:"), fname1);
return; return;
} }
inset->Latex(fs, -1); inset->Latex(fs, -1, free_spc);
h += fs.tellp() - 1; h += fs.tellp() - 1;
::remove(fname1.c_str()); ::remove(fname1.c_str());
#endif #endif
@ -1416,7 +1459,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
case LyXParagraph::META_INSET: case LyXParagraph::META_INSET:
if ((inset = par->GetInset(i))) { if ((inset = par->GetInset(i))) {
fpos = ofs.tellp(); fpos = ofs.tellp();
inset->Latex(ofs, -1); inset->Latex(ofs, -1, free_spc);
currlinelen += (ofs.tellp() - fpos); currlinelen += (ofs.tellp() - fpos);
actpos += (ofs.tellp() - fpos) - 1; actpos += (ofs.tellp() - fpos) - 1;
} }
@ -2839,6 +2882,9 @@ void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag,
string extra_par; string extra_par;
SimpleDocBookOnePar(os, extra_par, tpar, SimpleDocBookOnePar(os, extra_par, tpar,
desc_on, depth + 2); desc_on, depth + 2);
sgmlCloseTag(os, depth+1, inner_tag);
if(!extra_par.empty())
os << extra_par;
#else #else
string tmp_par, extra_par; string tmp_par, extra_par;
SimpleDocBookOnePar(tmp_par, extra_par, tpar, 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 = strip(tmp_par);
tmp_par = frontStrip(tmp_par); tmp_par = frontStrip(tmp_par);
os << tmp_par; os << tmp_par;
#endif
sgmlCloseTag(os, depth+1, inner_tag); sgmlCloseTag(os, depth+1, inner_tag);
if(!extra_par.empty()) if(!extra_par.empty())
os << extra_par; os << extra_par;
#endif
} }
} }
@ -2862,9 +2908,7 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
bool inner_span = false; bool inner_span = false;
int desc_on = 4; int desc_on = 4;
// This is not how I like to see enums. They should not be anonymous // Someone should give this enum a proper name (Lgb)
// and variables of its type should not be declared right after the
// last brace. (Lgb)
enum SOME_ENUM { enum SOME_ENUM {
NO_ONE, NO_ONE,
FOOTNOTE_LIKE, FOOTNOTE_LIKE,
@ -2881,8 +2925,8 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
if(!tmp_par.empty()) { if(!tmp_par.empty()) {
os << tmp_par; os << tmp_par;
tmp_par.clear(); tmp_par.clear();
sgmlCloseTag(os, depth+1, inner_tag); sgmlCloseTag(os, depth + 1, inner_tag);
sgmlOpenTag(os, depth+1, inner_tag); sgmlOpenTag(os, depth + 1, inner_tag);
} }
} }
else else
@ -2934,7 +2978,8 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
} }
} }
// ignore all caption here, we processed them above!!! // ignore all caption here, we processed them above!!!
if (par->layout != textclasslist.NumberOfLayout(params.textclass, if (par->layout != textclasslist
.NumberOfLayout(params.textclass,
"Caption").second) { "Caption").second) {
#ifdef USE_OSTREAM_ONLY #ifdef USE_OSTREAM_ONLY
#ifdef HAVE_SSTREAM #ifdef HAVE_SSTREAM
@ -3159,7 +3204,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
if (font2.latex() == LyXFont::ON) { if (font2.latex() == LyXFont::ON) {
// "TeX"-Mode on == > SGML-Mode on. // "TeX"-Mode on == > SGML-Mode on.
if (c!= '\0') if (c != '\0')
os << c; // see LaTeX-Generation... os << c; // see LaTeX-Generation...
++char_line_count; ++char_line_count;
} else if (c == LyXParagraph::META_INSET) { } else if (c == LyXParagraph::META_INSET) {
@ -3546,54 +3591,50 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
par->SimpleDocBookOneTablePar(os, extra, desc_on, depth); par->SimpleDocBookOneTablePar(os, extra, desc_on, depth);
return; return;
} }
LyXFont font1, font2;
char c;
Inset * inset;
LyXParagraph::size_type main_body;
int j;
//string emph = "emphasis";
bool emph_flag = false; bool emph_flag = false;
int char_line_count = 0;
LyXLayout const & style = textclasslist.Style(params.textclass, LyXLayout const & style = textclasslist.Style(params.textclass,
par->GetLayout()); par->GetLayout());
LyXParagraph::size_type main_body;
if (style.labeltype != LABEL_MANUAL) if (style.labeltype != LABEL_MANUAL)
main_body = 0; main_body = 0;
else else
main_body = par->BeginningOfMainBody(); main_body = par->BeginningOfMainBody();
// gets paragraph main font // gets paragraph main font
if (main_body > 0) //if (main_body > 0)
font1 = style.labelfont; // font1 = style.labelfont;
else //else
font1 = style.font; // font1 = style.font;
LyXFont font1 = main_body > 0 ? style.labelfont : style.font;
char_line_count = depth; int char_line_count = depth;
if(!style.free_spacing) if(!style.free_spacing)
for (j = 0; j < depth; ++j) for (int j = 0; j < depth; ++j)
os << ' '; os << ' ';
// parsing main loop // parsing main loop
for (LyXParagraph::size_type i = 0; for (LyXParagraph::size_type i = 0;
i < par->size(); ++i) { i < par->size(); ++i) {
font2 = par->getFont(i); LyXFont font2 = par->getFont(i);
// handle <emphasis> tag // handle <emphasis> tag
if (font1.emph() != font2.emph() && i) { if (font1.emph() != font2.emph() && i) {
if (font2.emph() == LyXFont::ON) { if (font2.emph() == LyXFont::ON) {
os << "<emphasis>"; os << "<emphasis>";
emph_flag= true; emph_flag = true;
}else { }else {
os << "</emphasis>"; os << "</emphasis>";
emph_flag= false; emph_flag = false;
} }
} }
c = par->GetChar(i); char c = par->GetChar(i);
if (c == LyXParagraph::META_INSET) { if (c == LyXParagraph::META_INSET) {
inset = par->GetInset(i); Inset * inset = par->GetInset(i);
#ifdef HAVE_SSTREAM #ifdef HAVE_SSTREAM
ostringstream ost; ostringstream ost;
inset->DocBook(ost); inset->DocBook(ost);
@ -3628,7 +3669,7 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
} }
} else if (font2.latex() == LyXFont::ON) { } else if (font2.latex() == LyXFont::ON) {
// "TeX"-Mode on ==> SGML-Mode on. // "TeX"-Mode on ==> SGML-Mode on.
if (c!= '\0') if (c != '\0')
os << c; os << c;
++char_line_count; ++char_line_count;
} }
@ -3688,7 +3729,6 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
int j; int j;
string emph= "emphasis"; string emph= "emphasis";
bool emph_flag= false; bool emph_flag= false;
int char_line_count= 0;
LyXLayout const & style = textclasslist.Style(params.textclass, LyXLayout const & style = textclasslist.Style(params.textclass,
par->GetLayout()); par->GetLayout());
@ -3704,7 +3744,7 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
else else
font1 = style.font; font1 = style.font;
char_line_count = depth; int char_line_count = depth;
if(!style.free_spacing) if(!style.free_spacing)
for (j = 0; j < depth; ++j) for (j = 0; j < depth; ++j)
file += ' '; file += ' ';
@ -3729,23 +3769,9 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
if (c == LyXParagraph::META_INSET) { if (c == LyXParagraph::META_INSET) {
inset = par->GetInset(i); 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; string tmp_out;
inset->DocBook(tmp_out); inset->DocBook(tmp_out);
#endif
// //
// This code needs some explanation: // This code needs some explanation:
// Two insets are treated specially // Two insets are treated specially

View File

@ -4,7 +4,7 @@
* encapsulated to get a combobox-like object. All XForms * encapsulated to get a combobox-like object. All XForms
* functions are hidden. * functions are hidden.
* *
* GNU Copyleft (C) 1996 Alejandro Aguilar Sierra <asierra@servidor.unam.mx> * GNU Copyleft 1996 Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
* and the LyX Team. * and the LyX Team.
* *
* Dependencies: Only XForms, but created to be used with LyX. * Dependencies: Only XForms, but created to be used with LyX.

View File

@ -4,7 +4,7 @@
* encapsulated to get a combobox-like object. All XForms * encapsulated to get a combobox-like object. All XForms
* functions are hidden. * functions are hidden.
* *
* GNU Copyleft (C) 1996 Alejandro Aguilar Sierra <asierra@servidor.unam.mx> * GNU Copyleft 1996 Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
* and the LyX Team. * and the LyX Team.
* *
* Dependencies: Only XForms, but created to be used with LyX. * Dependencies: Only XForms, but created to be used with LyX.

View File

@ -47,7 +47,7 @@ FD_copyright *create_form_copyright(void)
fdui->copyright = fl_bgn_form(FL_NO_BOX, 450, 430); fdui->copyright = fl_bgn_form(FL_NO_BOX, 450, 430);
obj = fl_add_box(FL_UP_BOX, 0, 0, 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_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);

View File

@ -3,7 +3,7 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1999 The LyX Team. * Copyright 1999-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -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(); Regenerate();
if (!cmd.empty()) os << cmd << " "; if (!cmd.empty()) os << cmd << " ";
@ -1203,7 +1203,7 @@ int InsetFig::Latex(ostream & os, signed char /* fragile*/ ) const
#ifndef USE_OSTREAM_ONLY #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(); Regenerate();
file += cmd + ' '; file += cmd + ' ';

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
/* /*
figinset.h - Figure inset header - part of LyX project figinset.h - Figure inset header - part of LyX project
(C)1996 by Ivan Schreter Copyright 1996 by Ivan Schreter
*/ */
#ifndef FIGINSET_H #ifndef FIGINSET_H
@ -38,10 +38,10 @@ public:
/// ///
void Read(LyXLex & lex); 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 #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; int Linuxdoc(string & file) const;
/// ///

View File

@ -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 #ifdef USE_OSTREAM_ONLY
// this looks like an horrible hack and it is :) The problem // 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 #else
string bib; string bib;
signed char dummy = 0; signed char dummy = 0;
int result = Latex(bib, dummy); int result = Latex(bib, dummy, 0);
os << bib; os << bib;
return result; return result;
#endif #endif
@ -369,7 +369,7 @@ int InsetBibtex::Latex(ostream & os, signed char /*fragile*/) const
#ifndef USE_OSTREAM_ONLY #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 // this looks like an horrible hack and it is :) The problem
// is that owner is not initialized correctly when the bib // is that owner is not initialized correctly when the bib

View File

@ -127,10 +127,10 @@ public:
/// ///
void Edit(BufferView *, int x, int y, unsigned int button); 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 #ifndef USE_OSTREAM_ONLY
/// ///
int Latex(string & file, signed char fragile) const; int Latex(string & file, signed char fragile, bool) const;
#endif #endif
/// ///
string getKeys(char delim); string getKeys(char delim);

View File

@ -4,7 +4,7 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 2000 The LyX Team. * Copyright 2000 The LyX Team.
* *
*====================================================== *======================================================
*/ */

View File

@ -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(); os << getCommand();
return 0; return 0;
@ -252,7 +252,7 @@ int InsetCommand::Latex(ostream & os, signed char /*fragile*/) const
#ifndef USE_OSTREAM_ONLY #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(); file += getCommand();
return 0; return 0;

View File

@ -47,10 +47,10 @@ public:
/// Will not be used when lyxf3 /// Will not be used when lyxf3
void Read(LyXLex & lex); 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 #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; virtual int Linuxdoc(string & file) const;
/// ///

View File

@ -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; return 0;
} }
#ifndef USE_OSTREAM_ONLY #ifndef USE_OSTREAM_ONLY
int InsetError::Latex(string &, signed char /*fragile*/) const int InsetError::Latex(string &, signed char /*fragile*/, bool /*fs*/) const
{ {
return 0; return 0;
} }

View File

@ -47,10 +47,10 @@ public:
/// ///
void Read(LyXLex & lex); 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 #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; int Linuxdoc(string & file) const;
/// ///

View File

@ -62,7 +62,7 @@ int InsetFoot::Latex(string & l, signed char fragile) const
} }
#endif #endif
int InsetFoot::Latex(ostream & os, signed char fragile) const int InsetFoot::Latex(ostream & os, signed char fragile, bool fp) const
{ {
int i; int i;
@ -71,7 +71,7 @@ int InsetFoot::Latex(ostream & os, signed char fragile) const
else else
os << "\\footnote{"; os << "\\footnote{";
i = InsetText::Latex(os, fragile); i = InsetText::Latex(os, fragile, fp);
os << "}"; os << "}";
return i; return i;

View File

@ -4,7 +4,7 @@
* *
* LyX, The Document Processor * 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; int Latex(string &, signed char) const;
#endif #endif
/// ///
int Latex(ostream &, signed char) const; int Latex(ostream &, signed char, bool fp) const;
/// ///
void Write(ostream &) const; void Write(ostream &) const;
/// ///

View File

@ -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 // MISSING: We have to decide how to do the order of the options
// that is depentant of order, like witdth, height, andlge. Should // 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 #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; return 0;
} }

View File

@ -45,10 +45,10 @@ public:
fragile != 0 means, that the inset should take care about fragile != 0 means, that the inset should take care about
fragile commands by adding a \protect before. 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 #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; int Linuxdoc(string & /*file*/) const;
/// ///

View File

@ -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 #ifdef USE_OSTREAM_ONLY
// Do nothing if no file name has been specified // Do nothing if no file name has been specified
@ -386,7 +386,7 @@ int InsetInclude::Latex(ostream & os, signed char /*fragile*/) const
#else #else
string include_file; string include_file;
signed char dummy = 0; signed char dummy = 0;
Latex(include_file, dummy); Latex(include_file, dummy, 0);
os << include_file; os << include_file;
return 0; return 0;
#endif #endif
@ -394,7 +394,7 @@ int InsetInclude::Latex(ostream & os, signed char /*fragile*/) const
#ifndef USE_OSTREAM_ONLY #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 // Do nothing if no file name has been specified
if (contents.empty()) if (contents.empty())

View File

@ -4,7 +4,7 @@
* *
* LyX, The Document Processor * 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 &); void Read(LyXLex &);
/// ///
int Latex(ostream &, signed char fragile) const; int Latex(ostream &, signed char fragile, bool free_spc) const;
#ifndef USE_OSTREAM_ONLY #ifndef USE_OSTREAM_ONLY
/// ///
int Latex(string & file, signed char fragile) const; int Latex(string & file, signed char fragile, bool free_spc) const;
#endif #endif
/// ///
void Validate(LaTeXFeatures &) const; void Validate(LaTeXFeatures &) const;

View File

@ -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; return 0;
} }
#ifndef USE_OSTREAM_ONLY #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; return 0;
} }

View File

@ -49,10 +49,10 @@ public:
/// ///
void Read(LyXLex & lex); 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 #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; int Linuxdoc(string & file) const;
/// ///

View File

@ -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()); os << escape(getCommand());
return 0; return 0;
@ -51,7 +51,7 @@ int InsetLabel::Latex(ostream & os, signed char /*fragile*/) const
#ifndef USE_OSTREAM_ONLY #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()); file += escape(getCommand());
return 0; return 0;

View File

@ -39,10 +39,10 @@ public:
/// ///
EDITABLE Editable() const { return NOT_EDITABLE; } 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 #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; int Linuxdoc(string & file) const;
/// ///

View File

@ -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()); fprintf(file, "%s", contents.c_str());
return 0; return 0;
} }
int InsetLatex::Latex(string & file, signed char /*fragile*/) int InsetLatex::Latex(string & file, signed char /*fragile*/, bool /*fs*/)
{ {
file += contents; file += contents;
return 0; return 0;

View File

@ -45,9 +45,9 @@ public:
/// ///
void Read(LyXLex & lex); 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); int Linuxdoc(string & file);
/// ///

View File

@ -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; os << contents;
return 0; return 0;
@ -753,7 +753,7 @@ int InsetLatexAccent::Latex(ostream & os, signed char /*fragile*/) const
#ifndef USE_OSTREAM_ONLY #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; file += contents;
return 0; return 0;

View File

@ -53,10 +53,10 @@ public:
/// ///
void Read(LyXLex & lex); 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 #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; int Linuxdoc(string & file) const;
/// ///

View File

@ -4,8 +4,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1996-1999 The LyX Team. * Copyright 1996-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -3,7 +3,7 @@
* *
* LyX, The Document Processor * 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 // 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}"; os << "%%#{lyx}";
InsetCommand::Latex(os, fragile); InsetCommand::Latex(os, fragile, free_spc);
return 0; return 0;
} }
#ifndef USE_OSTREAM_ONLY #ifndef USE_OSTREAM_ONLY
// LaTeX must just ignore this command // 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}"; file += "%%#{lyx}";
InsetCommand::Latex(file, fragile); InsetCommand::Latex(file, fragile, free_spc);
return 0; return 0;
} }
#endif #endif

View File

@ -32,10 +32,10 @@ public:
/// ///
InsetParent(string const & fn, Buffer * owner = 0); 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 #ifndef USE_OSTREAM_ONLY
/// ///
int Latex(string & file, signed char fragile) const; int Latex(string & file, signed char fragile, bool free_spc) const;
#endif #endif
/// ///
Inset * Clone() const { return new InsetParent(getContents()); } Inset * Clone() const { return new InsetParent(getContents()); }

View File

@ -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 #ifdef USE_OSTREAM_ONLY
string doclang = string doclang =
@ -264,7 +264,7 @@ int InsetQuotes::Latex(ostream & os, signed char /*fragile*/) const
return 0; return 0;
#else #else
string quote; string quote;
int res = Latex(quote, 0); int res = Latex(quote, 0, 0);
os << quote; os << quote;
return res; return res;
#endif #endif
@ -272,7 +272,7 @@ int InsetQuotes::Latex(ostream & os, signed char /*fragile*/) const
#ifndef USE_OSTREAM_ONLY #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 = string doclang =
current_view->buffer()->GetLanguage(); current_view->buffer()->GetLanguage();

View File

@ -85,10 +85,10 @@ public:
/// ///
void Read(LyXLex & lex); 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 #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; int Linuxdoc(string & file) const;
/// ///

View File

@ -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()) if(getOptions().empty())
os << escape(getCommand()); os << escape(getCommand());
@ -82,7 +82,7 @@ int InsetRef::Latex(ostream & os, signed char /*fragile*/) const
#ifndef USE_OSTREAM_ONLY #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()) if(getOptions().empty())
file += escape(getCommand()); file += escape(getCommand());

View File

@ -4,7 +4,7 @@
* *
* LyX, The Document Processor * 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(); void gotoLabel();
/// ///
int Latex(ostream &, signed char fragile) const; int Latex(ostream &, signed char fragile, bool free_spc) const;
#ifndef USE_OSTREAM_ONLY #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; int Linuxdoc(string & file) const;
/// ///

View File

@ -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 #ifdef USE_OSTREAM_ONLY
switch (kind) { switch (kind) {
@ -196,13 +197,13 @@ int InsetSpecialChar::Latex(ostream & os, signed char /*fragile*/) const
case END_OF_SENTENCE: os << "\\@."; break; case END_OF_SENTENCE: os << "\\@."; break;
case LDOTS: os << "\\ldots{}"; break; case LDOTS: os << "\\ldots{}"; break;
case MENU_SEPARATOR: os << "\\lyxarrow{}"; break; case MENU_SEPARATOR: os << "\\lyxarrow{}"; break;
case PROTECTED_SEPARATOR: os << "~"; break; case PROTECTED_SEPARATOR: os << (free_space ? " " : "~"); break;
} }
return 0; return 0;
#else #else
string command; string command;
signed char dummy = 0; signed char dummy = 0;
Latex(command, dummy); Latex(command, dummy, free_space);
os << command; os << command;
return 0; return 0;
#endif #endif
@ -210,14 +211,15 @@ int InsetSpecialChar::Latex(ostream & os, signed char /*fragile*/) const
#ifndef USE_OSTREAM_ONLY #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) { switch (kind) {
case HYPHENATION: file += "\\-"; break; case HYPHENATION: file += "\\-"; break;
case END_OF_SENTENCE: file += "\\@."; break; case END_OF_SENTENCE: file += "\\@."; break;
case LDOTS: file += "\\ldots{}"; break; case LDOTS: file += "\\ldots{}"; break;
case MENU_SEPARATOR: file += "\\lyxarrow{}"; break; case MENU_SEPARATOR: file += "\\lyxarrow{}"; break;
case PROTECTED_SEPARATOR: file += "~"; break; case PROTECTED_SEPARATOR: file += (free_space ? " " : "~"); break;
} }
return 0; return 0;
} }

View File

@ -4,7 +4,7 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1997 Asger Alstrup * Copyright 1997 Asger Alstrup
* *
* ====================================================== */ * ====================================================== */
@ -59,10 +59,10 @@ public:
/// Will not be used when lyxf3 /// Will not be used when lyxf3
void Read(LyXLex & lex); 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 #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; int Linuxdoc(string & file) const;
/// ///

View File

@ -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 #ifdef USE_OSTREAM_ONLY
TexRow texrow; TexRow texrow;
@ -593,7 +598,7 @@ int InsetText::Latex(ostream & os, signed char /*fragile*/) const
#else #else
string fstr; string fstr;
int i = Latex(fstr, fragile); int i = Latex(fstr, fragile, free_spc);
os << fstr; os << fstr;
return i; return i;
#endif #endif

View File

@ -77,10 +77,10 @@ public:
/// ///
UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &); 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 #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; } int Linuxdoc(string &) const { return 0; }
/// ///

View File

@ -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 #ifdef USE_OSTREAM_ONLY
if (!getOptions().empty()) if (!getOptions().empty())
@ -177,7 +177,7 @@ int InsetUrl::Latex(ostream & os, signed char fragile) const
return 0; return 0;
#else #else
string latex_output; string latex_output;
int res = Latex(latex_output, fragile); int res = Latex(latex_output, fragile, free_spc);
os << latex_output; os << latex_output;
return res; return res;
@ -186,7 +186,7 @@ int InsetUrl::Latex(ostream & os, signed char fragile) const
#ifndef USE_OSTREAM_ONLY #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()) if (!getOptions().empty())
file += getOptions() + ' '; file += getOptions() + ' ';

View File

@ -70,10 +70,10 @@ public:
/// ///
void gotoLabel(); void gotoLabel();
/// ///
int Latex(ostream &, signed char fragile) const; int Latex(ostream &, signed char fragile, bool free_spc) const;
#ifndef USE_OSTREAM_ONLY #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; int Linuxdoc(string & file) const;
/// ///

View File

@ -123,11 +123,14 @@ public:
/** returns the number of rows (\n's) of generated tex code. /** returns the number of rows (\n's) of generated tex code.
fragile != 0 means, that the inset should take care about fragile != 0 means, that the inset should take care about
fragile commands by adding a \protect before. 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 #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; virtual int Linuxdoc(string & /*file*/) const = 0;
/// ///

View File

@ -1091,7 +1091,7 @@ void AutoSave()
// //
// (c) CHT Software Service GmbH // Copyright CHT Software Service GmbH
// Uwe C. Schroeder // Uwe C. Schroeder
// //
// create new file with template // create new file with template

View File

@ -5,7 +5,8 @@
LyX, The Document Processor LyX, The Document Processor
Copyright (C) 1995 Matthias Ettrich Copyright 1995 Matthias Ettrich
copyright 1995-2000 The LyX Team.
====================================================== ======================================================
*/ */

View File

@ -4,7 +4,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -1643,7 +1643,19 @@ string LyXFunc::Dispatch(int ac,
case LFUN_PROTECTEDSPACE: case LFUN_PROTECTEDSPACE:
#if 1 #if 1
{
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(); owner->view()->protectedBlank();
}
moveCursorUpdate(false);
}
#else #else
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->text-> owner->view()->text->

View File

@ -2,10 +2,11 @@
// It can be used for simple syntax parsers, like lyxrc, // It can be used for simple syntax parsers, like lyxrc,
// texclass and others to come. [asierra30/03/96] // texclass and others to come. [asierra30/03/96]
// //
// (C) 1996 Lyx Team. // Copyright 1996 Lyx Team.
#include <config.h> #include <config.h>
#include <algorithm>
#include <cstdlib> #include <cstdlib>
#ifdef __GNUG__ #ifdef __GNUG__
@ -15,15 +16,47 @@
#include "lyxlex.h" #include "lyxlex.h"
#include "debug.h" #include "debug.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lyxalgo.h"
using std::ios; 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) LyXLex::LyXLex(keyword_item * tab, int num)
: is(&fb__), table(tab), no_items(num) : is(&fb__), table(tab), no_items(num)
{ {
status = 0; status = 0;
pushed = 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; pushed = tmppu;
table = tab; table = tab;
no_items = num; 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) for(int i= 0; i < no_items; ++i)
lyxerr << "table[" << i os << "table[" << i
<< "]: tag: `" << table[i].tag << "]: tag: `" << table[i].tag
<< "' code:" << table[i].code << endl; << "' code:" << table[i].code << '\n';
lyxerr << endl; os.flush();
} }
@ -227,25 +272,10 @@ bool LyXLex::EatLine()
int LyXLex::search_kw(char const * const tag) const int LyXLex::search_kw(char const * const tag) const
{ {
int m, k = 0 , l = 0, r = no_items; keyword_item * res =
lower_bound(table, table + no_items, tag, compare_tags());
while (l < r) { if (res != table + no_items && !compare_no_case(res->tag, tag))
m = (l + r) / 2; return res->code;
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;
}
return LEX_UNDEF; return LEX_UNDEF;
} }

View File

@ -3,7 +3,7 @@
// It can be used for simple syntax parsers, like lyxrc, // It can be used for simple syntax parsers, like lyxrc,
// texclass and others to come. [asierra30/03/96] // texclass and others to come. [asierra30/03/96]
// //
// (C) 1996 Lyx Team. // Copyright 1996 Lyx Team.
#ifndef LYXLEX_H #ifndef LYXLEX_H
#define LYXLEX_H #define LYXLEX_H
@ -84,14 +84,14 @@ public:
string GetString() const; string GetString() const;
/// get a long string, ended by the tag `endtag' /// get a long string, ended by the tag `endtag'
string getLongString(string const & endtoken); string getLongString(string const & endtag);
/// ///
bool EatLine(); 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]; } char const * text() const { return &buff[0]; }
@ -112,9 +112,9 @@ public:
void printError(string const & message) const; 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: protected:
/// ///
enum { enum {

View File

@ -3,8 +3,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995-1997 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* & The LyX team * Copyright 1995-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -232,8 +232,8 @@ keyword_item lyxrcTags[] = {
{ "\\view_dvi_command", RC_VIEWDVI_COMMAND }, { "\\view_dvi_command", RC_VIEWDVI_COMMAND },
{ "\\view_dvi_paper_option", RC_VIEWDVI_PAPEROPTION }, { "\\view_dvi_paper_option", RC_VIEWDVI_PAPEROPTION },
{ "\\view_pdf_command", RC_VIEWPDF_COMMAND }, { "\\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 */ /* 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); LyXLex lexrc(lyxrcTags, lyxrcCount);
if (lyxerr.debugging(Debug::PARSER)) if (lyxerr.debugging(Debug::PARSER))
lexrc.printTable(); lexrc.printTable(lyxerr);
lexrc.setFile(filename); lexrc.setFile(filename);
if (!lexrc.IsOK()) return -2; if (!lexrc.IsOK()) return -2;

View File

@ -4,8 +4,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -7,7 +7,7 @@
* *
* Dependencies: None (almost) * Dependencies: None (almost)
* *
* Copyright: (c) 1996, Alejandro Aguilar Sierra * Copyright: 1996, Alejandro Aguilar Sierra
* 1997 The LyX Team! * 1997 The LyX Team!
* *
* You are free to use and modify this code under the terms of * You are free to use and modify this code under the terms of

View File

@ -5,7 +5,7 @@
* Created: January 1996 * Created: January 1996
* Description: Allows the edition of math paragraphs inside Lyx. * 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. * Version: 0.4, Lyx project.
* *
@ -295,11 +295,16 @@ Inset * InsetFormula::Clone() const
void InsetFormula::Write(ostream & os) const void InsetFormula::Write(ostream & os) const
{ {
os << "Formula "; 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; int ret = 0;
//#warning Alejandro, the number of lines is not returned in this case //#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 #else
string output; string output;
InsetFormula::Latex(output, fragile); InsetFormula::Latex(output, fragile, free_spc);
os << output; os << output;
#endif #endif
return ret; return ret;

View File

@ -6,7 +6,7 @@
* Created: January 1996 * Created: January 1996
* Description: Allows the edition of math paragraphs inside Lyx. * 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. * Version: 0.4, Lyx project.
* *
@ -49,10 +49,10 @@ public:
/// ///
void Read(LyXLex & lex); 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 #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; int Linuxdoc(string & file) const;
/// ///

View File

@ -5,7 +5,7 @@
* Created: January 1996 * Created: January 1996
* Description: Allows the edition of math paragraphs inside Lyx. * 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. * Version: 0.4, Lyx project.
* *

View File

@ -6,7 +6,7 @@
* Created: January 1996 * Created: January 1996
* Description: Allows the edition of math paragraphs inside Lyx. * 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. * Version: 0.4, Lyx project.
* *

View File

@ -7,7 +7,7 @@
* *
* Dependencies: Xlib, XForms * Dependencies: Xlib, XForms
* *
* Copyright: (c) 1996, Alejandro Aguilar Sierra * Copyright: 1996, Alejandro Aguilar Sierra
* *
* Version: 0.8beta, Mathed & Lyx project. * Version: 0.8beta, Mathed & Lyx project.
* *

View File

@ -8,7 +8,7 @@
* *
* Dependencies: Xlib, XForms * Dependencies: Xlib, XForms
* *
* Copyright: (c) 1996, Alejandro Aguilar Sierra * Copyright: 1996, Alejandro Aguilar Sierra
* *
* Version: 0.8beta, Mathed & Lyx project. * Version: 0.8beta, Mathed & Lyx project.
* *

View File

@ -8,7 +8,7 @@
* *
* Dependencies: Xlib * Dependencies: Xlib
* *
* Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra * Copyright: 1996, 1997 Alejandro Aguilar Sierra
* *
* Version: 0.8beta, Mathed & Lyx project. * Version: 0.8beta, Mathed & Lyx project.
* *

View File

@ -7,7 +7,7 @@
* *
* Dependencies: Xlib, XForms * Dependencies: Xlib, XForms
* *
* Copyright: (c) 1996, Alejandro Aguilar Sierra * Copyright: 1996, Alejandro Aguilar Sierra
* *
* Version: 0.8beta, Mathed & Lyx project. * Version: 0.8beta, Mathed & Lyx project.
* *
@ -18,12 +18,16 @@
#include <config.h> #include <config.h>
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
#include <algorithm>
#include <cstdlib> #include <cstdlib>
#include "symbol_def.h" #include "symbol_def.h"
#include "math_inset.h" #include "math_inset.h"
#include "LColor.h" #include "LColor.h"
#include "Painter.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: * 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 * 0 = end, 1 = line, 2 = polyline, 3 = square line, 4= square polyline
@ -164,9 +168,14 @@ static float tilde[] = {
0.0 0.0
}; };
static struct math_deco_struct { struct math_deco_struct {
int code; float *data; int angle; int code;
} math_deco_table[] = { float * data;
int angle;
};
static
math_deco_struct math_deco_table[] = {
// Decorations // Decorations
{ LM_widehat, &angle[0], 3 }, { LM_widehat, &angle[0], 3 },
@ -219,9 +228,7 @@ static struct math_deco_struct {
{ LM_ldots, &hline3[0], 0 }, { LM_ldots, &hline3[0], 0 },
{ LM_cdots, &hline3[0], 0 }, { LM_cdots, &hline3[0], 0 },
{ LM_vdots, &hline3[0], 1 }, { LM_vdots, &hline3[0], 1 },
{ LM_ddots, &dline3[0], 0 }, { LM_ddots, &dline3[0], 0 }
{ 0, 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 static
int search_deco(int code) int search_deco(int code)
{ {
int i = 0; math_deco_struct * res =
lower_bound(math_deco_table,
while (math_deco_table[i].code && math_deco_table[i].code != code) ++i; math_deco_table + math_deco_table_size,
if (!math_deco_table[i].code) i = -1; code, math_deco_compare());
return i; 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 == '.') { if (left == '.') {
pain.line(x + 4, yo - ascent, pain.line(x + 4, yo - ascent,
x + 4, yo + descent, x + 4, yo + descent,
LColor::mathcursor); LColor::mathcursor, Painter::line_onoffdash);
} else } else
mathed_draw_deco(pain, x, y - ascent, dw, Height(), left); mathed_draw_deco(pain, x, y - ascent, dw, Height(), left);
x += Width()-dw-2; x += Width() - dw - 2;
if (right == '.') { if (right == '.') {
pain.line(x + 4, yo - ascent, pain.line(x + 4, yo - ascent,
x + 4, yo + descent, x + 4, yo + descent,
LColor::mathcursor); LColor::mathcursor, Painter::line_onoffdash);
} else } else
mathed_draw_deco(pain, x, y-ascent, dw, Height(), right); mathed_draw_deco(pain, x, y-ascent, dw, Height(), right);
} }

View File

@ -7,7 +7,7 @@
* *
* Dependencies: Xlib, XForms * Dependencies: Xlib, XForms
* *
* Copyright: (c) 1996, Alejandro Aguilar Sierra * Copyright: 1996, Alejandro Aguilar Sierra
* *
* Version: 0.8beta, Mathed & Lyx project. * Version: 0.8beta, Mathed & Lyx project.
* *

View File

@ -7,7 +7,7 @@
* *
* Dependencies: Xlib, XForms * Dependencies: Xlib, XForms
* *
* Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra * Copyright: 1996, 1997 Alejandro Aguilar Sierra
* *
* Version: 0.8beta. * Version: 0.8beta.
* *

View File

@ -8,7 +8,7 @@
* *
* Dependencies: Xlib, XForms * Dependencies: Xlib, XForms
* *
* Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra * Copyright: 1996, 1997 Alejandro Aguilar Sierra
* *
* Version: 0.8beta, Mathed & Lyx project. * Version: 0.8beta, Mathed & Lyx project.
* *

View File

@ -7,7 +7,7 @@
* *
* Dependencies: Xlib, XForms * Dependencies: Xlib, XForms
* *
* Copyright: (c) 1996, Alejandro Aguilar Sierra * Copyright: 1996, Alejandro Aguilar Sierra
* *
* Version: 0.8beta. * Version: 0.8beta.
* *

View File

@ -8,7 +8,7 @@
* *
* Dependencies: Xlib * Dependencies: Xlib
* *
* Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra * Copyright: 1996, 1997 Alejandro Aguilar Sierra
* *
* Version: 0.8beta, Mathed & Lyx project. * Version: 0.8beta, Mathed & Lyx project.
* *

View File

@ -8,7 +8,7 @@
* *
* Dependencies: Mathed * Dependencies: Mathed
* *
* Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra * Copyright: 1996, 1997 Alejandro Aguilar Sierra
* *
* Version: 0.2, Mathed & Lyx project. * Version: 0.2, Mathed & Lyx project.
* *

View File

@ -8,7 +8,7 @@
* *
* Dependencies: Mathed * Dependencies: Mathed
* *
* Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra * Copyright: 1996, 1997 Alejandro Aguilar Sierra
* *
* Version: 0.2, Mathed & Lyx project. * Version: 0.2, Mathed & Lyx project.
* *

View File

@ -6,7 +6,7 @@
* *
* Dependencies: Xlib, Xpm, XForms, Lyx * 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 * You are free to use and modify it under the terms of
* the GNU General Public Licence version 2 or later. * the GNU General Public Licence version 2 or later.

View File

@ -7,7 +7,7 @@
* *
* Dependencies: Xlib, Xpm, XForms, Lyx * 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 * You are free to use and modify it under the terms of
* the GNU General Public Licence version 2 or later. * the GNU General Public Licence version 2 or later.

View File

@ -7,7 +7,7 @@
* *
* Dependencies: Xlib, XForms * Dependencies: Xlib, XForms
* *
* Copyright: (c) 1996, Alejandro Aguilar Sierra * Copyright: 1996, Alejandro Aguilar Sierra
* *
* Version: 0.8beta. * Version: 0.8beta.
* *

View File

@ -8,7 +8,7 @@
* *
* Dependencies: Xlib, XForms * Dependencies: Xlib, XForms
* *
* Copyright: (c) 1996, Alejandro Aguilar Sierra * Copyright: 1996, Alejandro Aguilar Sierra
* *
* Version: 0.8beta. * Version: 0.8beta.
* *

View File

@ -6,7 +6,7 @@
* Created: January 1999 * Created: January 1999
* Description: Root math object * 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 * You are free to use and modify this code under the terms of
* the GNU General Public Licence version 2 or later. * the GNU General Public Licence version 2 or later.

View File

@ -6,7 +6,7 @@
* Created: January 1999 * Created: January 1999
* Description: Root math object * 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 * You are free to use and modify this code under the terms of
* the GNU General Public Licence version 2 or later. * the GNU General Public Licence version 2 or later.

View File

@ -9,7 +9,7 @@
* *
* Dependencies: Xlib, XForms, Lyx * 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 * You are free to use and modify it under the terms of
* the GNU General Public Licence version 2 or later. * the GNU General Public Licence version 2 or later.

View File

@ -4,7 +4,7 @@
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx> * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
* Created: August 1996 * Created: August 1996
* *
* Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra * Copyright: 1996, 1997 Alejandro Aguilar Sierra
* *
* License: GNU GPL version 2 or later * License: GNU GPL version 2 or later
*/ */

View File

@ -7,7 +7,7 @@
* *
* Dependencies: Xlib, XForms * Dependencies: Xlib, XForms
* *
* Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra * Copyright: 1996, 1997 Alejandro Aguilar Sierra
* *
* Version: 0.8beta, Mathed & Lyx project. * Version: 0.8beta, Mathed & Lyx project.
* *

View File

@ -4,8 +4,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 1996 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* and the LyX Team. * Copyright 1995-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -4,7 +4,8 @@
* *
* LyX, The Document Processor * 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 */ A few prototypes and definitions needed for OS/2 */

View File

@ -4,7 +4,8 @@
* *
* LyX, The Document Processor * 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. A table for translating OS/2 API return code into errno.

View File

@ -1936,7 +1936,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(ostream & os, TexRow & texrow,
break; break;
case LATEX_ITEM_ENVIRONMENT: case LATEX_ITEM_ENVIRONMENT:
if (bibkey) { if (bibkey) {
bibkey->Latex(os, false); bibkey->Latex(os, false, false);
} else } else
os << "\\item "; os << "\\item ";
break; break;
@ -4003,7 +4003,8 @@ void LyXParagraph::SimpleTeXSpecialChars(ostream & os, TexRow & texrow,
close = true; close = true;
} }
int tmp = inset->Latex(os, style.isCommand()); int tmp = inset->Latex(os, style.isCommand(),
style.free_spacing);
if (close) if (close)
os << "}"; os << "}";

View File

@ -4,8 +4,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1999 The LyX Team. * Copyright 1995-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -4,8 +4,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1999 The LyX Team. * Copyright 1995-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -4,8 +4,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1998 The LyX Team. * Copyright 1995-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -36,6 +36,7 @@ libsupport_la_SOURCES = \
kill.C \ kill.C \
lstrings.C \ lstrings.C \
lstrings.h \ lstrings.h \
lyxalgo.h \
lyxlib.h \ lyxlib.h \
lyxmanip.h \ lyxmanip.h \
$(LYXSTRING) lyxsum.C \ $(LYXSTRING) lyxsum.C \

View File

@ -18,6 +18,7 @@ using std::transform;
using std::tolower; using std::tolower;
using std::toupper; using std::toupper;
int compare_no_case(string const & s, string const & s2) int compare_no_case(string const & s, string const & s2)
{ {
// ANSI C // ANSI C

40
src/support/lyxalgo.h Normal file
View File

@ -0,0 +1,40 @@
// -*- C++ -*-
#ifndef LYX_ALGO_H
#define LYX_ALGO_H
#include <algorithm>
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 <class For>
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 <class For, class Cmp>
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

View File

@ -4,8 +4,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-1999 The LyX Team. * Copyright 1995-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -4,7 +4,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -4,7 +4,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995, 1996 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */
#ifndef TABLE_H #ifndef TABLE_H

View File

@ -3,8 +3,8 @@
* *
* LyX, The Document Processor * LyX, The Document Processor
* *
* Copyright (C) 1995 Matthias Ettrich * Copyright 1995 Matthias Ettrich
* Copyright (C) 1995-2000 The LyX Team. * Copyright 1995-2000 The LyX Team.
* *
* ====================================================== */ * ====================================================== */

View File

@ -2404,24 +2404,12 @@ void LyXText::InsertChar(char c)
cursor.par->ParFromPos(cursor.pos)->next); cursor.par->ParFromPos(cursor.pos)->next);
/* When the free-spacing option is set for the current layout, /* When the free-spacing option is set for the current layout,
* all spaces are converted to protected spaces. */ * disable the double-space checking */
// Thinko!
#warning think about this bool freeSpacing =
#if 0
bool freeSpacingBo =
textclasslist.Style(parameters->textclass, textclasslist.Style(parameters->textclass,
cursor.row->par->GetLayout()).free_spacing; 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*/ /* table stuff -- begin*/
if (cursor.par->table) { if (cursor.par->table) {
InsertCharInTable(c); InsertCharInTable(c);
@ -2456,7 +2444,7 @@ void LyXText::InsertChar(char c)
bool jumped_over_space = false; bool jumped_over_space = false;
if (IsLineSeparatorChar(c)) { if (!freeSpacing && IsLineSeparatorChar(c)) {
#ifndef FIX_DOUBLE_SPACE #ifndef FIX_DOUBLE_SPACE
if (cursor.pos < lastpos if (cursor.pos < lastpos
&& cursor.par->IsLineSeparator(cursor.pos)) { && cursor.par->IsLineSeparator(cursor.pos)) {
@ -2993,7 +2981,7 @@ char * LyXText::SelectNextWord(float & value)
&& (cursor.par->IsLetter(cursor.pos)) && (cursor.par->IsLetter(cursor.pos))
|| (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET
&& cursor.par->GetInset(cursor.pos) != 0 && 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 USE_OSTREAM_ONLY
#ifdef HAVE_SSTREAM #ifdef HAVE_SSTREAM
&& latex.str() == "\\-" && latex.str() == "\\-"
@ -3051,7 +3039,7 @@ void LyXText::SelectSelectedWord()
&& (cursor.par->IsLetter(cursor.pos) && (cursor.par->IsLetter(cursor.pos)
|| (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET
&& cursor.par->GetInset(cursor.pos) != 0 && 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 USE_OSTREAM_ONLY
#ifdef HAVE_SSTREAM #ifdef HAVE_SSTREAM
&& latex.str() == "\\-" && latex.str() == "\\-"

View File

@ -3248,6 +3248,11 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
// this is the delete-empty-paragraph-mechanism. // this is the delete-empty-paragraph-mechanism.
if (selection) return; 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 #ifdef FIX_DOUBLE_SPACE
/* Ok I'll put some comments here about what is missing. /* Ok I'll put some comments here about what is missing.
I have fixed BackSpace (and thus Delete) to not delete I have fixed BackSpace (and thus Delete) to not delete

Some files were not shown because too many files have changed in this diff Show More