From 0088121bd8c3fc7f2109e8dc9b22b73ca193f20e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Thu, 16 Mar 2000 04:29:22 +0000 Subject: [PATCH] make text private in LyXParagraph some changes to import ascii file git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@608 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 24 +++++++++++++ po/POTFILES.in | 2 ++ src/BufferView.C | 4 +-- src/Chktex.C | 2 +- src/ImportLaTeX.C | 2 +- src/ImportNoweb.C | 2 +- src/LString.h | 2 +- src/LaTeX.C | 4 +-- src/LaTeXFeatures.C | 2 +- src/Literate.C | 2 +- src/LyXAction.C | 2 +- src/LyXView.C | 2 +- src/Painter.h | 4 +-- src/WorkArea.C | 4 +++ src/buffer.C | 6 ++-- src/bufferparams.C | 2 +- src/filedlg.C | 2 +- src/filedlg.h | 2 +- src/insets/inset.C | 2 +- src/insets/insetcommand.C | 2 +- src/insets/inseterror.C | 2 +- src/insets/insetindex.h | 2 +- src/insets/insetinfo.C | 2 +- src/insets/insetinfo.h | 2 +- src/insets/insetlabel.C | 2 +- src/insets/insetlabel.h | 2 +- src/insets/insetloa.h | 2 +- src/insets/insetlof.h | 2 +- src/insets/insetlot.h | 2 +- src/insets/insetparent.h | 2 +- src/insets/insetquotes.C | 2 +- src/insets/insetquotes.h | 2 +- src/insets/insettoc.h | 2 +- src/insets/lyxinset.h | 2 +- src/intl.C | 2 +- src/lastfiles.C | 2 +- src/lastfiles.h | 2 +- src/layout.C | 2 +- src/layout.h | 2 +- src/lyx_cb.C | 21 +++++------ src/lyx_gui.C | 2 +- src/lyx_gui_misc.C | 2 +- src/lyx_gui_misc.h | 2 +- src/lyx_sty.C | 2 +- src/lyxfont.C | 2 +- src/lyxfr0.C | 2 +- src/lyxfr1.C | 2 +- src/lyxfunc.C | 7 ++-- src/lyxlex.h | 1 + src/lyxlookup.C | 2 +- src/lyxparagraph.h | 21 +++++++++-- src/lyxrc.C | 4 ++- src/lyxrow.h | 2 +- src/lyxserver.C | 2 +- src/lyxtext.h | 10 ++---- src/minibuffer.C | 2 +- src/paragraph.C | 11 ------ src/print_form.h | 2 +- src/stl_string_fwd.h | 2 +- src/support/DebugStream.h | 2 +- src/support/FileInfo.C | 2 +- src/support/FileInfo.h | 2 +- src/support/LSubstring.C | 2 +- src/support/filetools.h | 2 +- src/support/lstrings.C | 9 +++-- src/support/lyxstring.C | 2 +- src/support/lyxstring.h | 2 +- src/text.C | 14 ++++---- src/text2.C | 73 +++++++++++++++------------------------ src/toolbar.C | 2 +- src/undo.C | 2 +- src/undo.h | 2 +- 72 files changed, 172 insertions(+), 157 deletions(-) diff --git a/ChangeLog b/ChangeLog index 395da9fbdd..9721f52c23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2000-03-16 Lars Gullik Bjønnes + + * src/support/lstrings.C (compare_no_case): some change to make it + compile with gcc 2.95.2 and stdlibc++-v3 + + * src/text2.C (MeltFootnoteEnvironment): change type o + first_footnote_par_is_not_empty to bool. + + * src/lyxparagraph.h: make text private. Changes in other files + because of this. + (fitToSize): new function + (setContentsFromPar): new function + (clearContents): new function + (SetChar): new function + + * src/paragraph.C (readSimpleWholeFile): deleted. + + * src/lyx_cb.C (InsertAsciiFile): don't use a LyXParagraph to hold + the file, just use a simple string instead. Also read the file in + a more maintainable manner. + + * src/text2.C (InsertStringA): deleted. + (InsertStringB): deleted. + 2000-03-15 Lars Gullik Bjønnes * src/text2.C (DeleteEmptyParagraphMechanism): don't run, diff --git a/po/POTFILES.in b/po/POTFILES.in index c294a0f54a..01a4988ba5 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -28,6 +28,7 @@ src/insets/figinset.h src/insets/form_graphics.C src/insets/form_url.C src/insets/insetbib.C +src/insets/inseteditor.C src/insets/inseterror.C src/insets/inseterror.h src/insets/insetert.C @@ -50,6 +51,7 @@ src/insets/inseturl.h src/insets/lyxinset.h src/intl.C src/kbsequence.C +src/language.C src/LaTeX.C src/LaTeXLog.C src/latexoptions.C diff --git a/src/BufferView.C b/src/BufferView.C index b1134650ad..fd4ea68708 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -1252,9 +1252,9 @@ void BufferView::workAreaSelectionNotify(Window win, XEvent * event) string clb = fromClipboard(win, event); if (!clb.empty()) { if (!ascii_type) - text->InsertStringA(clb.c_str()); + text->InsertStringA(clb); else - text->InsertStringB(clb.c_str()); + text->InsertStringB(clb); update(1); diff --git a/src/Chktex.C b/src/Chktex.C index 9b112ed1f5..7779e14e2f 100644 --- a/src/Chktex.C +++ b/src/Chktex.C @@ -3,7 +3,7 @@ * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * This file is Copyright 1997-1998 * Asger Alstrup diff --git a/src/ImportLaTeX.C b/src/ImportLaTeX.C index 8083ea5e85..0ada1dc76f 100644 --- a/src/ImportLaTeX.C +++ b/src/ImportLaTeX.C @@ -3,7 +3,7 @@ * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * This file is Copyright 1998 * Asger Alstrup diff --git a/src/ImportNoweb.C b/src/ImportNoweb.C index 6af54667ab..dfee627f82 100644 --- a/src/ImportNoweb.C +++ b/src/ImportNoweb.C @@ -3,7 +3,7 @@ * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * This file is Copyright 1999 * Kayvan A. Sylvan diff --git a/src/LString.h b/src/LString.h index 46ec80c097..0f2eccc8cd 100644 --- a/src/LString.h +++ b/src/LString.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/LaTeX.C b/src/LaTeX.C index 7018a24737..f4224242c3 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -3,9 +3,9 @@ * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * - * This file is Copyright 1996-1999 + * This file is Copyright 1996-2000 * Lars Gullik Bjønnes * * ====================================================== diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index 0adfcbcb98..90c752cad7 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 the LyX Team. + * Copyright 1995-2000 the LyX Team. * * ====================================================== */ diff --git a/src/Literate.C b/src/Literate.C index 0aa06d5ece..7ae33243b2 100644 --- a/src/Literate.C +++ b/src/Literate.C @@ -3,7 +3,7 @@ * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/LyXAction.C b/src/LyXAction.C index a1077e2ab5..51ed29f183 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/LyXView.C b/src/LyXView.C index 7875922b7b..8631660466 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/Painter.h b/src/Painter.h index 780aad225b..bb2048395c 100644 --- a/src/Painter.h +++ b/src/Painter.h @@ -4,7 +4,7 @@ * * LyX, The Document Processor * - * Copyright 1999-2000 The LyX Team + * Copyright 1995-2000 The LyX Team * * ======================================================*/ @@ -25,7 +25,7 @@ #include "PainterBase.h" #include "LColor.h" -using std::less; +//using std::less; class LyXFont; class WorkArea; diff --git a/src/WorkArea.C b/src/WorkArea.C index 8059d8a3c4..b6b8231370 100644 --- a/src/WorkArea.C +++ b/src/WorkArea.C @@ -24,6 +24,10 @@ FL_OBJECT * figinset_canvas; +// need to make the c++ compiler fint the correct version of abs. +// This is at least true for g++. +using std::abs; + static inline void waitForX() { diff --git a/src/buffer.C b/src/buffer.C index cbb04c2793..daf0403f1b 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * This file is Copyright 1996-1999 * Lars Gullik Bjønnes @@ -305,7 +305,7 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, if (!return_par) return_par = par; else { - par->text.resize(par->text.size()); + par->fitToSize(); par = new LyXParagraph(par); } pos = 0; @@ -336,7 +336,7 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, if (!return_par) return_par = par; else { - par->text.resize(par->text.size()); + par->fitToSize(); par = new LyXParagraph(par); } footnotekind = LyXParagraph::FOOTNOTE; diff --git a/src/bufferparams.C b/src/bufferparams.C index b81d1395cf..9ab6982ac9 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/filedlg.C b/src/filedlg.C index 80dc5fd49c..043e17ca97 100644 --- a/src/filedlg.C +++ b/src/filedlg.C @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/filedlg.h b/src/filedlg.h index 79a9058a4a..a68a2a107a 100644 --- a/src/filedlg.h +++ b/src/filedlg.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/insets/inset.C b/src/insets/inset.C index d0da2ce83a..fa452cb95f 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 576b307779..ae90a45ccf 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index 2b34768f0a..aae2d7c7c3 100644 --- a/src/insets/inseterror.C +++ b/src/insets/inseterror.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/insets/insetindex.h b/src/insets/insetindex.h index 4b9610b844..87148cf7fb 100644 --- a/src/insets/insetindex.h +++ b/src/insets/insetindex.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1996-1999 the LyX Team. + * Copyright 1996-2000 the LyX Team. * * ====================================================== */ diff --git a/src/insets/insetinfo.C b/src/insets/insetinfo.C index 0cb762b2db..53f580e230 100644 --- a/src/insets/insetinfo.C +++ b/src/insets/insetinfo.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/insets/insetinfo.h b/src/insets/insetinfo.h index b01321acce..8b436325b8 100644 --- a/src/insets/insetinfo.h +++ b/src/insets/insetinfo.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 the LyX Team. + * Copyright 1995-2000 the LyX Team. * * ====================================================== */ diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index 200b52ee19..977cb58f52 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/insets/insetlabel.h b/src/insets/insetlabel.h index a3f0614d75..e906b866c9 100644 --- a/src/insets/insetlabel.h +++ b/src/insets/insetlabel.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team + * Copyright 1995-2000 The LyX Team * * ====================================================== */ diff --git a/src/insets/insetloa.h b/src/insets/insetloa.h index 6853205e0a..1341d0b860 100644 --- a/src/insets/insetloa.h +++ b/src/insets/insetloa.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1996-1999 the LyX Team. + * Copyright 1996-2000 the LyX Team. * * ====================================================== */ diff --git a/src/insets/insetlof.h b/src/insets/insetlof.h index 4eea16c155..3259c16d85 100644 --- a/src/insets/insetlof.h +++ b/src/insets/insetlof.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1996-1999 the LyX Team. + * Copyright 1996-2000 the LyX Team. * * ====================================================== */ diff --git a/src/insets/insetlot.h b/src/insets/insetlot.h index ba6ce17f79..4fffb7ba4d 100644 --- a/src/insets/insetlot.h +++ b/src/insets/insetlot.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1996-1999 LyX Team + * Copyright 1996-2000 LyX Team * * ====================================================== */ diff --git a/src/insets/insetparent.h b/src/insets/insetparent.h index 3b746b3987..a3302987fa 100644 --- a/src/insets/insetparent.h +++ b/src/insets/insetparent.h @@ -4,7 +4,7 @@ * * LyX, The Document Processor * - * Copyright 1997-1999 LyX Team + * Copyright 1997-2000 LyX Team * * ====================================================== */ diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 0982214fe2..9d98098b47 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/insets/insetquotes.h b/src/insets/insetquotes.h index 968dc2557b..99dedc71ec 100644 --- a/src/insets/insetquotes.h +++ b/src/insets/insetquotes.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team + * Copyright 1995-2000 The LyX Team * * ====================================================== */ diff --git a/src/insets/insettoc.h b/src/insets/insettoc.h index 8bdf50b256..794c49ffe6 100644 --- a/src/insets/insettoc.h +++ b/src/insets/insettoc.h @@ -5,7 +5,7 @@ * LyX, The Document Word Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1996-1999 The LyX Team. + * Copyright 1996-2000 The LyX Team. * * ====================================================== */ diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index cf2857c9d7..6665370371 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 the LyX Team. + * Copyright 1995-2000 the LyX Team. * * ====================================================== */ diff --git a/src/intl.C b/src/intl.C index 868500ca67..19a4fefd5e 100644 --- a/src/intl.C +++ b/src/intl.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lastfiles.C b/src/lastfiles.C index 82365f5eac..144066da60 100644 --- a/src/lastfiles.C +++ b/src/lastfiles.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lastfiles.h b/src/lastfiles.h index 163ba40a11..487fcffc92 100644 --- a/src/lastfiles.h +++ b/src/lastfiles.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/layout.C b/src/layout.C index b36c1c47e8..06e0113318 100644 --- a/src/layout.C +++ b/src/layout.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/layout.h b/src/layout.h index 530943defe..9125c3fc44 100644 --- a/src/layout.h +++ b/src/layout.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 326dfd8b6e..973504fecb 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -11,6 +11,7 @@ #include #include + using std::ifstream; #include "LString.h" @@ -1154,26 +1155,22 @@ void InsertAsciiFile(string const & f, bool asParagraph) MakeDisplayPath(fname, 50)); return; } - LyXParagraph * tmppar = new LyXParagraph; - tmppar->readSimpleWholeFile(ifs); - - // set the end of the string -#ifdef WITH_WARNINGS -#warning why do we do this? -#endif - // I don't think this is needed. Actually it might be plain wrong. - tmppar->InsertChar(tmppar->text.size() - 1, '\0'); + ifs.unsetf(std::ios::skipws); + std::istream_iterator ii(ifs); + std::istream_iterator end; + string tmpstr(ii, end); // yet a reason for using std::string + // alternate approach to get the file into a string: + //copy(ii, end, back_inserter(tmpstr)); // insert the string current_view->hideCursor(); // clear the selection current_view->beforeChange(); if (!asParagraph) - current_view->text->InsertStringA(tmppar->text); + current_view->text->InsertStringA(tmpstr); else - current_view->text->InsertStringB(tmppar->text); - delete tmppar; + current_view->text->InsertStringB(tmpstr); current_view->update(1); } diff --git a/src/lyx_gui.C b/src/lyx_gui.C index c5f78cad63..24dead7b1b 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lyx_gui_misc.C b/src/lyx_gui_misc.C index b29cdd7ac8..beee7bc0f0 100644 --- a/src/lyx_gui_misc.C +++ b/src/lyx_gui_misc.C @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lyx_gui_misc.h b/src/lyx_gui_misc.h index ad620e66d6..9a3bc65d89 100644 --- a/src/lyx_gui_misc.h +++ b/src/lyx_gui_misc.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 1996 Matthias Ettrich - * Copyright 1995-1999 The LyX Team + * Copyright 1995-2000 The LyX Team * * ====================================================== */ diff --git a/src/lyx_sty.C b/src/lyx_sty.C index afa9f6a725..85e5662813 100644 --- a/src/lyx_sty.C +++ b/src/lyx_sty.C @@ -5,7 +5,7 @@ LyX, The Document Processor Copyright 1995 Matthias Ettrich - Copyright 1995-1999 The LyX Team. + Copyright 1995-2000 The LyX Team. ====================================================== */ diff --git a/src/lyxfont.C b/src/lyxfont.C index 7babecf2fa..aebdd0756f 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lyxfr0.C b/src/lyxfr0.C index d397968b3e..24a22dad96 100644 --- a/src/lyxfr0.C +++ b/src/lyxfr0.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich, - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lyxfr1.C b/src/lyxfr1.C index 57c2cb3308..7fd124624d 100644 --- a/src/lyxfr1.C +++ b/src/lyxfr1.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich, - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 3bd5c4766a..89c5c441d4 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1958,8 +1958,11 @@ string LyXFunc::Dispatch(int ac, LyXParagraph::size_type pos = owner->view()->text->cursor.pos; if(pos < owner->view()->text->cursor.par->size()) - dispatch_buffer = owner->view()->text-> - cursor.par->text[pos]; + //dispatch_buffer = owner->view()->text-> + // cursor.par->text[pos]; + dispatch_buffer = + owner->view()->text-> + cursor.par->GetChar(pos); else dispatch_buffer = "EOF"; } diff --git a/src/lyxlex.h b/src/lyxlex.h index dcfca5eb9b..0bd9d6f414 100644 --- a/src/lyxlex.h +++ b/src/lyxlex.h @@ -15,6 +15,7 @@ using std::filebuf; #include "support/LIstream.h" +#include "support/LOstream.h" #include "LString.h" diff --git a/src/lyxlookup.C b/src/lyxlookup.C index 4e0d1f9494..3dc265bb5f 100644 --- a/src/lyxlookup.C +++ b/src/lyxlookup.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX team. + * Copyright 1995-2000 The LyX team. * * ====================================================== */ diff --git a/src/lyxparagraph.h b/src/lyxparagraph.h index 9c72dae44d..29b50c59ad 100644 --- a/src/lyxparagraph.h +++ b/src/lyxparagraph.h @@ -147,9 +147,6 @@ public: /// void read(); - /// - void readSimpleWholeFile(istream &); - /// LyXParagraph * TeXOnePar(ostream &, TexRow & texrow, ostream & foot, TexRow & foot_texrow, @@ -182,10 +179,23 @@ public: /// proof environment int GetEndLabel() const; +private: /// TextContainer text; +public: /// size_type size() const { return text.size(); } + /// + void fitToSize() { + text.resize(text.size()); + } + void setContentsFromPar(LyXParagraph * par) { + text = par->text; + } + void clearContents() { + text.clear(); + } + /// VSpace added_space_top; @@ -366,6 +376,11 @@ public: char GetChar(size_type pos); /// char GetChar(size_type pos) const; + /// The position must already exist. + void SetChar(size_type pos, char c) { + text[pos] = c; + } + /// void SetFont(size_type pos, LyXFont const & font); /// diff --git a/src/lyxrc.C b/src/lyxrc.C index 6a28a6dd20..552267fc4a 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ @@ -16,6 +16,8 @@ #include #include +#include + using std::ofstream; using std::cout; using std::ios; diff --git a/src/lyxrow.h b/src/lyxrow.h index 199ca99f30..12c2b835b7 100644 --- a/src/lyxrow.h +++ b/src/lyxrow.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lyxserver.C b/src/lyxserver.C index 28197299fb..c80f52bcfe 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/lyxtext.h b/src/lyxtext.h index 3528286943..c6620eeb79 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ @@ -381,13 +381,9 @@ public: bool SearchBackward(char const * str) const; /// needed to insert the selection - void InsertStringA(LyXParagraph::TextContainer const & text); + void InsertStringA(string const & str); /// needed to insert the selection - void InsertStringB(LyXParagraph::TextContainer const & text); - /// needed to insert the selection - void InsertStringA(char const * str); - /// needed to insert the selection - void InsertStringB(char const * str); + void InsertStringB(string const & str); /// usefull when texing from within LyX bool GotoNextError() const; diff --git a/src/minibuffer.C b/src/minibuffer.C index a2d8e22df1..f365325f31 100644 --- a/src/minibuffer.C +++ b/src/minibuffer.C @@ -5,7 +5,7 @@ * information. * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ########################################################################### */ diff --git a/src/paragraph.C b/src/paragraph.C index 7ca5603216..e348d52f2c 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1894,17 +1894,6 @@ int LyXParagraph::GetPositionOfInset(Inset * inset) const } -void LyXParagraph::readSimpleWholeFile(istream & is) -{ - is.seekg(0); - char c = 0; - while(!is.eof()) { - is.get(c); - InsertChar(text.size(), c); - }; -} - - LyXParagraph * LyXParagraph::TeXOnePar(ostream & os, TexRow & texrow, ostream & foot, TexRow & foot_texrow, int & foot_count) diff --git a/src/print_form.h b/src/print_form.h index 5d5c3928b7..98c73e55b9 100644 --- a/src/print_form.h +++ b/src/print_form.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Mon Apr 12 19:09:43 1999.**/ +/** Header file generated with fdesign on Mon Apr 12 19:09:43 2000.**/ #ifndef FD_form_print_h_ #define FD_form_print_h_ diff --git a/src/stl_string_fwd.h b/src/stl_string_fwd.h index 61a541e01b..f27ab3ab30 100644 --- a/src/stl_string_fwd.h +++ b/src/stl_string_fwd.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/support/DebugStream.h b/src/support/DebugStream.h index 946f7173af..cff7affaf4 100644 --- a/src/support/DebugStream.h +++ b/src/support/DebugStream.h @@ -2,7 +2,7 @@ // Created by Lars Gullik Bjønnes // Copyright 1999 Lars Gullik Bjønnes (larsbj@lyx.org) -// Released under the Gnu General Public License +// Released into the public domain. // Implemented and tested on g++ 2.7.2.3 diff --git a/src/support/FileInfo.C b/src/support/FileInfo.C index 79e33e8396..e19d1377d0 100644 --- a/src/support/FileInfo.C +++ b/src/support/FileInfo.C @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/support/FileInfo.h b/src/support/FileInfo.h index 614a8b1596..711987f3e8 100644 --- a/src/support/FileInfo.h +++ b/src/support/FileInfo.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/support/LSubstring.C b/src/support/LSubstring.C index 1369434ab5..7624dda2bf 100644 --- a/src/support/LSubstring.C +++ b/src/support/LSubstring.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/support/filetools.h b/src/support/filetools.h index f171e94d8e..efe21a5f49 100644 --- a/src/support/filetools.h +++ b/src/support/filetools.h @@ -1,7 +1,7 @@ // -*- C++-*- /* lyx-filetool.h : tools functions for file/path handling this file is part of LyX, the High Level Word Processor - Copyright 1995-1999, Matthias Ettrich and the LyX Team + Copyright 1995-2000, Matthias Ettrich and the LyX Team */ #ifndef LYX_FILETOOL_H diff --git a/src/support/lstrings.C b/src/support/lstrings.C index 6ac6cbb293..efc8df4165 100644 --- a/src/support/lstrings.C +++ b/src/support/lstrings.C @@ -2,11 +2,7 @@ #include -#ifdef __GLIBCPP__ -#include -#else #include -#endif #include #include "LString.h" @@ -15,9 +11,12 @@ using std::count; using std::transform; +#ifndef __GLIBCPP__ +// The new glibstdc++-v3 has not worked out all the quirks regarding cctype +// yet. So currently it failes if the to using lines below are stated. using std::tolower; using std::toupper; - +#endif int compare_no_case(string const & s, string const & s2) { diff --git a/src/support/lyxstring.C b/src/support/lyxstring.C index 3f8deedfb5..606e689304 100644 --- a/src/support/lyxstring.C +++ b/src/support/lyxstring.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/support/lyxstring.h b/src/support/lyxstring.h index 4d3339e95e..1e2572f203 100644 --- a/src/support/lyxstring.h +++ b/src/support/lyxstring.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/text.C b/src/text.C index e8cc5e4dd0..4ffba1da89 100644 --- a/src/text.C +++ b/src/text.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ @@ -1647,7 +1647,7 @@ void LyXText::BreakParagraph(char keep_layout) if (cursor.par->table) { int cell = NumberOfCell(cursor.par, cursor.pos); if (cursor.par->table->ShouldBeVeryLastCell(cell)) - SetCursor(cursor.par, cursor.par->text.size()); + SetCursor(cursor.par, cursor.par->size()); } /* table stuff -- end */ @@ -1750,7 +1750,7 @@ void LyXText::OpenFootnote() cursor.par->ParFromPos(cursor.pos) != par; cursor.pos++); /* now the cursor is at the beginning of the physical par */ SetCursor(cursor.par, - cursor.pos + cursor.par->ParFromPos(cursor.pos)->text.size()); + cursor.pos + cursor.par->ParFromPos(cursor.pos)->size()); /* the cursor must be exactly before the footnote */ par = cursor.par->ParFromPos(cursor.pos); @@ -2086,7 +2086,7 @@ void LyXText::TableFeatures(int feature) const // dummy-paragraph !! // not necessar anymore with UNDO :) for (LyXParagraph::size_type i = - cursor.par->text.size() - 1; i >= 0; --i) + cursor.par->size() - 1; i >= 0; --i) cursor.par->Erase(i); RedoParagraph(); return; @@ -3225,7 +3225,8 @@ void LyXText::ChangeWordCase(LyXText::TextCase action) LyXParagraph::size_type tmppos = cursor.par->PositionInParFromPos(cursor.pos); while (tmppos < tmppar->size()) { - unsigned char c = tmppar->text[tmppos]; + //unsigned char c = tmppar->text[tmppos]; + unsigned char c = tmppar->GetChar(tmppos); if (IsKommaChar(c) || IsLineSeparatorChar(c)) break; if (c != LyXParagraph::META_INSET) { @@ -3243,7 +3244,8 @@ void LyXText::ChangeWordCase(LyXText::TextCase action) } } - tmppar->text[tmppos] = c; + //tmppar->text[tmppos] = c; + tmppar->SetChar(tmppos, c); ++tmppos; } CheckParagraph(tmppar, tmppos); diff --git a/src/text2.C b/src/text2.C index 1aaf90d43e..317038b858 100644 --- a/src/text2.C +++ b/src/text2.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ @@ -390,7 +390,7 @@ void LyXText::CloseFootnote() // now the cursor is at the beginning of the physical par SetCursor(cursor.par, cursor.pos + - cursor.par->ParFromPos(cursor.pos)->text.size()); + cursor.par->ParFromPos(cursor.pos)->size()); } else { /* we are in a footnote, so let us move at the beginning */ /* this is just faster than using just CursorLeft() */ @@ -1128,7 +1128,7 @@ void LyXText::MeltFootnoteEnvironment() tmppar = firsttmppar; /* tmppar is now the paragraph right before the footnote */ - char first_footnote_par_is_not_empty = tmppar->next->text.size(); + bool first_footnote_par_is_not_empty = tmppar->next->size(); while (tmppar->next && tmppar->next->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) { @@ -1172,8 +1172,8 @@ void LyXText::MeltFootnoteEnvironment() * (only if the previous par and the footnotepar are not empty!) */ if ((!firsttmppar->next->GetLayout() && !firsttmppar->next->table) || firsttmppar->HasSameLayout(firsttmppar->next)) { - if (firsttmppar->text.size() - && !firsttmppar->IsSeparator(firsttmppar->text.size() - 1) + if (firsttmppar->size() + && !firsttmppar->IsSeparator(firsttmppar->size() - 1) && first_footnote_par_is_not_empty) { firsttmppar->next->InsertChar(0, ' '); } @@ -2236,7 +2236,7 @@ void LyXText::CopySelection() tmpi2 = sel_end_cursor.par->PositionInParFromPos(sel_end_cursor.pos); while (tmppar2->size() > tmpi2) { - tmppar2->Erase(tmppar2->text.size() - 1); + tmppar2->Erase(tmppar2->size() - 1); } } } @@ -2301,7 +2301,7 @@ void LyXText::PasteSelection() /* table stuff -- begin */ bool table_too_small = false; if (tmpcursor.par->table) { - while (simple_cut_buffer->text.size() + while (simple_cut_buffer->size() && !table_too_small) { if (simple_cut_buffer->IsNewline(0)){ while(tmpcursor.pos < tmpcursor.par->Last() && !tmpcursor.par->IsNewline(tmpcursor.pos)) @@ -2341,7 +2341,7 @@ void LyXText::PasteSelection() // of the text to insert and we are inserting at // the beginning of the paragraph the space should // be removed. - while (simple_cut_buffer->text.size()) { + while (simple_cut_buffer->size()) { #ifdef FIX_DOUBLE_SPACE // This is an attempt to fix the // "never insert a space at the @@ -2622,20 +2622,9 @@ bool LyXText::SearchBackward(char const * string) const } -void LyXText::InsertStringA(LyXParagraph::TextContainer const & text) -{ - char * str = new char[text.size() + 1]; - copy(text.begin(), text.end(), str); - str[text.size()] = '\0'; - InsertStringA(str); - delete [] str; -} - - // needed to insert the selection -void LyXText::InsertStringA(char const * s) +void LyXText::InsertStringA(string const & str) { - string str(s); LyXParagraph * par = cursor.par; LyXParagraph::size_type pos = cursor.pos; LyXParagraph::size_type a = 0; @@ -2695,7 +2684,7 @@ void LyXText::InsertStringA(char const * s) #endif } pos = a; - } else if (str[i]!= 13 && + } else if (str[i] != 13 && // Ignore unprintables (str[i] & 127) >= ' ') { par->InsertChar(pos, str[i]); @@ -2725,7 +2714,7 @@ void LyXText::InsertStringA(char const * s) // no more fields to fill skip the rest break; } else { - if (!par->text.size()) { + if (!par->size()) { // par is empty #if 1 InsetSpecialChar * new_inset = new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR); @@ -2752,21 +2741,11 @@ void LyXText::InsertStringA(char const * s) } -void LyXText::InsertStringB(LyXParagraph::TextContainer const & text) -{ - char * str = new char[text.size() + 1]; - copy(text.begin(), text.end(), str); - str[text.size()] = '\0'; - InsertStringB(str); - delete [] str; -} - - /* turns double-CR to single CR, others where converted into one blank and 13s * that are ignored .Double spaces are also converted into one. Spaces at * the beginning of a paragraph are forbidden. tabs are converted into one * space. then InsertStringA is called */ -void LyXText::InsertStringB(char const * s) +void LyXText::InsertStringB(string const & s) { string str(s); LyXParagraph * par = cursor.par; @@ -2794,7 +2773,7 @@ void LyXText::InsertStringB(char const * s) } ++i; } - InsertStringA(str.c_str()); + InsertStringA(str); } @@ -3027,12 +3006,12 @@ void LyXText::SetCursorIntern(LyXParagraph * par, par = par->previous ; if (par->IsDummy() && par->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) - pos += par->text.size() + 1; + pos += par->size() + 1; } if (par->previous) { par = par->previous; } - pos += par->text.size() + 1; + pos += par->size() + 1; } cursor.par = par; @@ -3525,8 +3504,6 @@ bool LyXText::TextHandleUndo(Undo * undo) GetParFromID(undo->number_of_behind_par); LyXParagraph * tmppar; LyXParagraph * tmppar2; - LyXParagraph * tmppar3; - LyXParagraph * tmppar4; LyXParagraph * endpar; LyXParagraph * tmppar5; @@ -3537,9 +3514,9 @@ bool LyXText::TextHandleUndo(Undo * undo) // replace the paragraphs with the undo informations - tmppar3 = undo->par; + LyXParagraph * tmppar3 = undo->par; undo->par = 0; // otherwise the undo destructor would delete the paragraph - tmppar4 = tmppar3; + LyXParagraph * tmppar4 = tmppar3; if (tmppar4){ while (tmppar4->next) tmppar4 = tmppar4->next; @@ -3557,9 +3534,11 @@ bool LyXText::TextHandleUndo(Undo * undo) tmppar5 = tmppar5->next; // a memory optimization for edit: Only layout information // is stored in the undo. So restore the text informations. - if (undo->kind == Undo::EDIT){ - tmppar2->text = tmppar->text; - tmppar->text.clear(); + if (undo->kind == Undo::EDIT) { + tmppar2->setContentsFromPar(tmppar); + tmppar->clearContents(); + //tmppar2->text = tmppar->text; + //tmppar->text.clear(); tmppar2 = tmppar2->next; } if ( currentrow && currentrow->par == tmppar ) @@ -3592,7 +3571,7 @@ bool LyXText::TextHandleUndo(Undo * undo) // Set the cursor for redoing - if (before){ + if (before) { SetCursorIntern(before->FirstSelfrowPar(), 0); // check wether before points to a closed float and open it if necessary if (before && before->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE @@ -3736,7 +3715,8 @@ Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph const * before, // a memory optimization: Just store the layout information // when only edit if (kind == Undo::EDIT){ - tmppar2->text.clear(); + //tmppar2->text.clear(); + tmppar2->clearContents(); } undopar = tmppar2; @@ -3748,7 +3728,8 @@ Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph const * before, // a memory optimization: Just store the layout // information when only edit if (kind == Undo::EDIT){ - tmppar2->next->text.clear(); + //tmppar2->next->text.clear(); + tmppar2->clearContents(); } tmppar2->next->previous = tmppar2; tmppar2 = tmppar2->next; diff --git a/src/toolbar.C b/src/toolbar.C index 41a4b5d0f6..a3889ecf53 100644 --- a/src/toolbar.C +++ b/src/toolbar.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * This file is Copyright 1996-1998 * Lars Gullik Bjønnes diff --git a/src/undo.C b/src/undo.C index 22b3181176..b177deb8d4 100644 --- a/src/undo.C +++ b/src/undo.C @@ -4,7 +4,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ diff --git a/src/undo.h b/src/undo.h index d7361477aa..83cd0db60d 100644 --- a/src/undo.h +++ b/src/undo.h @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ -- 2.39.5