read the ChangeLog... no huge changes .. but some might get reversed...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@576 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-02-29 02:19:17 +00:00
parent a2c6689c71
commit ba5e47f1a9
42 changed files with 1211 additions and 281 deletions

View File

@ -1,3 +1,34 @@
2000-03-01 Lars Gullik Bjønnes <larsbj@lyx.org>
* some things that I should comment but the local pub says head to
swirly...
* comment out all code that belongs to the Roff code for Ascii
export of tables. (this is unused)
* src/LyXView.C: use correct type for global variable
current_layout. (LyXTextClass::size_type)
* some code to get the new insetgraphics closer to working I'd be
grateful for any help.
* src/BufferView2.C (insertInset): use the return type of
NumberOfLayout properly. (also changes in other files)
* src/insets/insetspecialchar.[Ch]: add the PROTECTED SEPARATOR to
this as a test. I want to know what breaks because of this.
* src/BufferView.[Ch] (tripleClick): name change from trippleClick.
2000-02-29 Lars Gullik Bjønnes <larsbj@lyx.org>
* lib/layouts/stdlists.inc: changed the lyxlist latex definition
to use a \makebox in the label, this allows proper justification
with out using protected spaces or multiple hfills. Now it is
"label" for left justified, "\hfill label\hfill" for center, and
"\hfill label" for right justified. UserGuide.lyx sec. 3.3.6.5
should be changed accordingly.
2000-02-28 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2000-02-28 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/lyxtext.h: change SetLayout() to take a * src/lyxtext.h: change SetLayout() to take a
@ -14,6 +45,15 @@
* lib/layouts/llncs.layout: new layout, contributed by Martin * lib/layouts/llncs.layout: new layout, contributed by Martin
Vermeer. Vermeer.
2000-02-25 Lars Gullik Bjønnes <larsbj@lyx.org>
* config/lyxinclude.m4 (LYX_PROG_CXX): remove case support for gcc
2.7.* and add case support for gcc 2.96*. Gcc 2.96 only exists in
cvs at gcc.gnu.org (currently it fails with ICE on insetbib.C,
insetindex.C, insetloa.C, insettext.C, filetools.C, BufferView.C,
BufferView2.C, LyXView.C, buffer.C, lyx_cb.C, lyxfunc.C,
paragraph.C, text.C, text2.C)
2000-02-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2000-02-25 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/insets/insettext.C (LocalDispatch): remove extra break * src/insets/insettext.C (LocalDispatch): remove extra break

View File

@ -183,9 +183,9 @@ dnl Check the version of g++
CXXFLAGS="$ac_save_CXXFLAGS" CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then elif test $ac_cv_prog_cxx_g = yes; then
case $gxx_version in case $gxx_version in
2.7*) CXXFLAGS="$lyx_opt";;
2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";; 2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";; 2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
2.96*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
*2.91.*) CXXFLAGS="-g $lyx_opt -Wno-return-type -fno-exceptions -fno-rtti";; *2.91.*) CXXFLAGS="-g $lyx_opt -Wno-return-type -fno-exceptions -fno-rtti";;
*) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";; *) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
esac esac
@ -195,11 +195,13 @@ dnl Check the version of g++
if test x$with_warnings = xyes ; then if test x$with_warnings = xyes ; then
case $gxx_version in case $gxx_version in
2.95.*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";; 2.95.*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
2.96*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
*) CXXFLAGS="$CXXFLAGS -ansi -Wall -W";; *) CXXFLAGS="$CXXFLAGS -ansi -Wall -W";;
esac esac
if test $lyx_devel_version = yes ; then if test $lyx_devel_version = yes ; then
case $gxx_version in case $gxx_version in
2.95.*) ;; 2.95.*) ;;
2.96*) ;;
*) CXXFLAGS="$CXXFLAGS -pedantic";; *) CXXFLAGS="$CXXFLAGS -pedantic";;
esac esac
fi fi

View File

@ -183,9 +183,9 @@ dnl Check the version of g++
CXXFLAGS="$ac_save_CXXFLAGS" CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then elif test $ac_cv_prog_cxx_g = yes; then
case $gxx_version in case $gxx_version in
2.7*) CXXFLAGS="$lyx_opt";;
2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";; 2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";; 2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
2.96*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
*2.91.*) CXXFLAGS="-g $lyx_opt -Wno-return-type -fno-exceptions -fno-rtti";; *2.91.*) CXXFLAGS="-g $lyx_opt -Wno-return-type -fno-exceptions -fno-rtti";;
*) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";; *) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
esac esac
@ -195,11 +195,13 @@ dnl Check the version of g++
if test x$with_warnings = xyes ; then if test x$with_warnings = xyes ; then
case $gxx_version in case $gxx_version in
2.95.*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";; 2.95.*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
2.96*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
*) CXXFLAGS="$CXXFLAGS -ansi -Wall -W";; *) CXXFLAGS="$CXXFLAGS -ansi -Wall -W";;
esac esac
if test $lyx_devel_version = yes ; then if test $lyx_devel_version = yes ; then
case $gxx_version in case $gxx_version in
2.95.*) ;; 2.95.*) ;;
2.96*) ;;
*) CXXFLAGS="$CXXFLAGS -pedantic";; *) CXXFLAGS="$CXXFLAGS -pedantic";;
esac esac
fi fi

View File

@ -88,7 +88,7 @@ Style List
{\settowidth{\labelwidth}{#1} {\settowidth{\labelwidth}{#1}
\setlength{\leftmargin}{\labelwidth} \setlength{\leftmargin}{\labelwidth}
\addtolength{\leftmargin}{\labelsep} \addtolength{\leftmargin}{\labelsep}
\renewcommand{\makelabel}[1]{##1 \hfill}}} \renewcommand{\makelabel}[1]{\makebox[\labelwidth][l]{##1}}}}
{\end{list}} {\end{list}}
EndPreamble EndPreamble

View File

@ -789,7 +789,7 @@ void BufferView::doubleClick(int /*x*/, int /*y*/, unsigned int button)
} }
void BufferView::trippleClick(int /*x*/, int /*y*/, unsigned int button) void BufferView::tripleClick(int /*x*/, int /*y*/, unsigned int button)
{ {
// select a line // select a line
if (buffer_ && screen && button == 1) { if (buffer_ && screen && button == 1) {

View File

@ -244,7 +244,7 @@ private:
/// ///
void doubleClick(int x, int y, unsigned int button); void doubleClick(int x, int y, unsigned int button);
/// ///
void trippleClick(int x, int y, unsigned int button); void tripleClick(int x, int y, unsigned int button);
/// ///
LyXView * owner_; LyXView * owner_;
/// ///

View File

@ -203,12 +203,18 @@ void BufferView::insertInset(Inset * inset, string const & lout,
update(-1); update(-1);
} }
int lay = textclasslist.NumberOfLayout(buffer()->params.textclass, pair<bool, LyXTextClass::size_type> lres =
lout).second; textclasslist.NumberOfLayout(buffer()->params
if (lay == -1) // layout not found .textclass, lout);
// use default layout "Standard" (0) LyXTextClass::size_type lay;
if (lres.first != false) {
// layout found
lay = lres.second;
} else {
// layout not fount using default "Standard" (0)
lay = 0; lay = 0;
}
text->SetLayout(lay); text->SetLayout(lay);
text->SetParagraph(0, 0, text->SetParagraph(0, 0,
@ -481,8 +487,14 @@ void BufferView::newline()
if (available()) { if (available()) {
hideCursor(); hideCursor();
update(-2); update(-2);
#if 0
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::NEWLINE);
insertInset(new_inset);
#else
text->InsertChar(LyXParagraph::META_NEWLINE); text->InsertChar(LyXParagraph::META_NEWLINE);
update(-1); update(-1);
#endif
} }
} }
@ -492,8 +504,14 @@ void BufferView::protectedBlank()
if (available()) { if (available()) {
hideCursor(); hideCursor();
update(-2); update(-2);
#if 1
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
insertInset(new_inset);
#else
text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR); text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
update(-1); update(-1);
#endif
} }
} }

View File

@ -48,8 +48,13 @@ struct LaTeXFeatures {
//@{ //@{
/// ///
bool color; // color.sty bool color; // color.sty
#ifdef USE_GRAPHICX
///
bool graphicx; // graphicx.sty
#else
/// ///
bool graphics; // graphics.sty bool graphics; // graphics.sty
#endif
/// ///
bool setspace; // setspace.sty bool setspace; // setspace.sty
/// ///

View File

@ -180,6 +180,8 @@ void LyXAction::init()
{ LFUN_INSET_ERT, "ert-inset-insert", { LFUN_INSET_ERT, "ert-inset-insert",
N_("Insert a new ERT Inset"), Noop }, N_("Insert a new ERT Inset"), Noop },
{ LFUN_FIGURE, "figure-insert", N_("Insert Figure"), Noop }, { LFUN_FIGURE, "figure-insert", N_("Insert Figure"), Noop },
{ LFUN_INSERT_GRAPHICS, "graphics-insert",
N_("Insert Graphics"), Noop },
{ LFUN_FILE_INSERT, "file-insert", "", Noop }, { LFUN_FILE_INSERT, "file-insert", "", Noop },
{ LFUN_FILE_INSERT_ASCII, "file-insert-ascii", "", Noop }, { LFUN_FILE_INSERT_ASCII, "file-insert-ascii", "", Noop },
{ LFUN_FILE_NEW, "file-new", "", NoBuffer }, { LFUN_FILE_NEW, "file-new", "", NoBuffer },

View File

@ -38,7 +38,7 @@ extern FD_form_document * fd_form_document;
extern void AutoSave(); extern void AutoSave();
extern char updatetimer; extern char updatetimer;
extern void QuitLyX(); extern void QuitLyX();
int current_layout = 0; LyXTextClass::size_type current_layout = 0;
// This is very temporary // This is very temporary
BufferView * current_view; BufferView * current_view;

View File

@ -381,16 +381,16 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
// Done by the raw callback: // Done by the raw callback:
// case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break; // case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break;
case FL_FOCUS: case FL_FOCUS:
lyxerr.debug() << "Workarea event: FOCUS" << endl; lyxerr << "Workarea event: FOCUS" << endl;
break; break;
case FL_UNFOCUS: case FL_UNFOCUS:
lyxerr.debug() << "Workarea event: UNFOCUS" << endl; lyxerr << "Workarea event: UNFOCUS" << endl;
break; break;
case FL_ENTER: case FL_ENTER:
lyxerr.debug() << "Workarea event: ENTER" << endl; lyxerr << "Workarea event: ENTER" << endl;
break; break;
case FL_LEAVE: case FL_LEAVE:
lyxerr.debug() << "Workarea event: LEAVE" << endl; lyxerr << "Workarea event: LEAVE" << endl;
break; break;
case FL_DBLCLICK: case FL_DBLCLICK:
if (!ev) break; if (!ev) break;
@ -402,7 +402,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
case FL_TRPLCLICK: case FL_TRPLCLICK:
if (!ev) break; if (!ev) break;
lyxerr.debug() << "Workarea event: TRPLCLICK" << endl; lyxerr.debug() << "Workarea event: TRPLCLICK" << endl;
area->owner->trippleClick(ev->xbutton.x - ob->x, area->owner->tripleClick(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y, ev->xbutton.y - ob->y,
ev->xbutton.button); ev->xbutton.button);
break; break;

View File

@ -75,6 +75,7 @@ using std::setw;
#include "insets/figinset.h" #include "insets/figinset.h"
#include "insets/insettext.h" #include "insets/insettext.h"
#include "insets/insetert.h" #include "insets/insetert.h"
#include "insets/insetgraphics.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/path.h" #include "support/path.h"
#include "LaTeX.h" #include "LaTeX.h"
@ -294,8 +295,9 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
par->layout = 0; par->layout = 0;
} }
// Test whether the layout is obsolete. // Test whether the layout is obsolete.
LyXLayout const & layout = textclasslist.Style(params.textclass, LyXLayout const & layout =
par->layout); textclasslist.Style(params.textclass,
par->layout);
if (!layout.obsoleted_by().empty()) if (!layout.obsoleted_by().empty())
par->layout = par->layout =
textclasslist.NumberOfLayout(params.textclass, textclasslist.NumberOfLayout(params.textclass,
@ -701,66 +703,72 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
if (tmptok == "Quotes") { if (tmptok == "Quotes") {
inset = new InsetQuotes; inset = new InsetQuotes;
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 (tmptok == "\\i") { } else if (tmptok == "\\i") {
inset = new InsetLatexAccent; inset = new InsetLatexAccent;
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 (tmptok == "FormulaMacro") { } else if (tmptok == "FormulaMacro") {
inset = new InsetFormulaMacro; inset = new InsetFormulaMacro;
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 (tmptok == "Formula") { } else if (tmptok == "Formula") {
inset = new InsetFormula; inset = new InsetFormula;
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 (tmptok == "Figure") { } else if (tmptok == "Figure") {
inset = new InsetFig(100, 100, this); inset = new InsetFig(100, 100, this);
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 (tmptok == "Info") { } else if (tmptok == "Info") {
inset = new InsetInfo; inset = new InsetInfo;
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 (tmptok == "Include") { } else if (tmptok == "Include") {
inset = new InsetInclude(string(), this); inset = new InsetInclude(string(), this);
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 (tmptok == "ERT") { } else if (tmptok == "ERT") {
inset = new InsetERT(this); inset = new InsetERT(this);
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 (tmptok == "Text") { } else if (tmptok == "Text") {
inset = new InsetText(this); inset = new InsetText(this);
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 (tmptok == "GRAPHICS") {
inset = new InsetGraphics;
//inset->Read(lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
} else if (tmptok == "LatexCommand") { } else if (tmptok == "LatexCommand") {
InsetCommand inscmd; InsetCommand inscmd;
inscmd.Read(lex); inscmd.Read(lex);
@ -786,6 +794,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
inset = new InsetRef(inscmd, this); inset = new InsetRef(inscmd, this);
} }
#warning Verify that this else clause is still needed. (Lgb) #warning Verify that this else clause is still needed. (Lgb)
#if 0
// This condition comes from a // This condition comes from a
// temporary solution to the latexdel // temporary solution to the latexdel
// ref inset that was transformed to // ref inset that was transformed to
@ -839,6 +848,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
cmdname += "{" + opt + "}"; cmdname += "{" + opt + "}";
inset = new InsetRef(cmdname, this); inset = new InsetRef(cmdname, this);
} }
#endif
} else if (inscmd.getCmdName() == "tableofcontents") { } else if (inscmd.getCmdName() == "tableofcontents") {
inset = new InsetTOC(this); inset = new InsetTOC(this);
} else if (inscmd.getCmdName() == "listoffigures") { } else if (inscmd.getCmdName() == "listoffigures") {
@ -888,9 +898,16 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
par->InsertInset(pos, inset); par->InsertInset(pos, inset);
par->SetFont(pos, font); par->SetFont(pos, font);
++pos; ++pos;
} else if (token == "\\newline") { } else if (token == "\\newline") { // soon obsolete
#if 1
par->InsertChar(pos, LyXParagraph::META_NEWLINE); par->InsertChar(pos, LyXParagraph::META_NEWLINE);
par->SetFont(pos, font); par->SetFont(pos, font);
#else
inset = new InsetSpecialChar(InsetSpecialChar::NEWLINE);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
#endif
++pos; ++pos;
} else if (token == "\\LyXTable") { } else if (token == "\\LyXTable") {
par->table = new LyXTable(lex); par->table = new LyXTable(lex);
@ -898,9 +915,16 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
par->InsertChar(pos, LyXParagraph::META_HFILL); par->InsertChar(pos, LyXParagraph::META_HFILL);
par->SetFont(pos, font); par->SetFont(pos, font);
++pos; ++pos;
} else if (token == "\\protected_separator") { } else if (token == "\\protected_separator") { // obsolete
#if 1
inset = new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
#else
par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR); par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR);
par->SetFont(pos, font); par->SetFont(pos, font);
#endif
++pos; ++pos;
} else if (token == "\\bibitem") { // ale970302 } else if (token == "\\bibitem") { // ale970302
if (!par->bibkey) if (!par->bibkey)
@ -1261,6 +1285,21 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
c = par->GetChar(i); c = par->GetChar(i);
if (c == LyXParagraph::META_INSET) { if (c == LyXParagraph::META_INSET) {
if ((inset = par->GetInset(i))) { if ((inset = par->GetInset(i))) {
#if 1
#ifdef HAVE_SSTREAM
ostringstream ost;
inset->Latex(ost, -1);
h += ost.str().length();
#else
ostrstream ost;
inset->Latex(ost, -1);
ost << '\0';
char * tmp = ost.str();
string tstr(tmp);
h += tstr.length();
delete [] tmp;
#endif
#else
ofstream fs(fname1.c_str()); ofstream fs(fname1.c_str());
if (!fs) { if (!fs) {
WriteFSAlert(_("Error: Cannot open temporary file:"), fname1); WriteFSAlert(_("Error: Cannot open temporary file:"), fname1);
@ -1268,7 +1307,8 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
} }
inset->Latex(fs, -1); inset->Latex(fs, -1);
h += fs.tellp() - 1; h += fs.tellp() - 1;
remove(fname1.c_str()); ::remove(fname1.c_str());
#endif
} }
} else if (c == LyXParagraph::META_NEWLINE) { } else if (c == LyXParagraph::META_NEWLINE) {
if (clen[j] < h) if (clen[j] < h)
@ -1411,9 +1451,11 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
case LyXParagraph::META_HFILL: case LyXParagraph::META_HFILL:
ofs << "\t"; ofs << "\t";
break; break;
#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR: case LyXParagraph::META_PROTECTED_SEPARATOR:
ofs << " "; ofs << " ";
break; break;
#endif
case '\\': case '\\':
ofs << "\\"; ofs << "\\";
break; break;
@ -1901,8 +1943,9 @@ void Buffer::makeLaTeXFile(string const & fname,
if (par->IsDummy()) if (par->IsDummy())
lyxerr[Debug::LATEX] << "Error in MakeLateXFile." lyxerr[Debug::LATEX] << "Error in MakeLateXFile."
<< endl; << endl;
LyXLayout const & layout = textclasslist.Style(params.textclass, LyXLayout const & layout =
par->layout); textclasslist.Style(params.textclass,
par->layout);
if (layout.intitle) { if (layout.intitle) {
if (already_title) { if (already_title) {
@ -2660,9 +2703,10 @@ void Buffer::makeDocBookFile(string const & fname, int column)
} }
while (par) { while (par) {
int desc_on= 0; /* description mode*/ int desc_on = 0; /* description mode*/
LyXLayout const & style = textclasslist.Style(users->buffer()->params.textclass, LyXLayout const & style =
par->layout); textclasslist.Style(users->buffer()->params.textclass,
par->layout);
par->AutoDeleteInsets(); par->AutoDeleteInsets();
/* environment tag closing */ /* environment tag closing */
@ -3283,6 +3327,7 @@ int Buffer::runChktex()
} }
#if 0
void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par) void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
{ {
LyXFont font1(LyXFont::ALL_INHERIT); LyXFont font1(LyXFont::ALL_INHERIT);
@ -3317,6 +3362,34 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
switch (c) { switch (c) {
case LyXParagraph::META_INSET: case LyXParagraph::META_INSET:
if ((inset = par->GetInset(i))) { if ((inset = par->GetInset(i))) {
#if 1
#ifdef HAVE_SSTREAM
stringstresm ss(ios::in | ios::out);
inset->Latex(ss, -1);
ss.seekp(0);
ss.get(c);
while (!ss) {
if (c == '\\')
ofs << "\\\\";
else
ofs << c;
ss.get(c);
}
#else
strstream ss;
inset->Latex(ss, -1);
ss.seekp(0);
ss.get(c);
while (!ss) {
if (c == '\\')
ofs << "\\\\";
else
ofs << c;
ss.get(c);
}
delete [] ss.str();
#endif
#else
fstream fs(fname2.c_str(), ios::in|ios::out); fstream fs(fname2.c_str(), ios::in|ios::out);
if (!fs) { if (!fs) {
WriteAlert(_("LYX_ERROR:"), WriteAlert(_("LYX_ERROR:"),
@ -3336,6 +3409,7 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
fs >> c; fs >> c;
} }
fs.close(); fs.close();
#endif
} }
break; break;
case LyXParagraph::META_NEWLINE: case LyXParagraph::META_NEWLINE:
@ -3346,8 +3420,10 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
break; break;
case LyXParagraph::META_HFILL: case LyXParagraph::META_HFILL:
break; break;
#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR: case LyXParagraph::META_PROTECTED_SEPARATOR:
break; break;
#endif
case '\\': case '\\':
ofs << "\\\\"; ofs << "\\\\";
break; break;
@ -3398,6 +3474,7 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
ifs.close(); ifs.close();
remove(fname2.c_str()); remove(fname2.c_str());
} }
#endif
/// changed Heinrich Bauer, 23/03/98 /// changed Heinrich Bauer, 23/03/98

View File

@ -361,10 +361,12 @@ private:
/// LinuxDoc. /// LinuxDoc.
void pop_tag(ostream & os, char const * tag, void pop_tag(ostream & os, char const * tag,
int & pos, char stack[5][3]); int & pos, char stack[5][3]);
#if 0
/// ///
void RoffAsciiTable(ostream &, LyXParagraph * par); void RoffAsciiTable(ostream &, LyXParagraph * par);
#endif
/// is save needed /// is save needed
mutable bool lyx_clean; mutable bool lyx_clean;

View File

@ -242,6 +242,7 @@ enum kb_action {
LFUN_RTL, // Dekel 20000203 LFUN_RTL, // Dekel 20000203
LFUN_INSET_TEXT, // Jug 20000214 LFUN_INSET_TEXT, // Jug 20000214
LFUN_INSET_ERT, // Jug 20000218 LFUN_INSET_ERT, // Jug 20000218
LFUN_INSERT_GRAPHICS, // Lgb 20000226
LFUN_LASTACTION /* this marks the end of the table */ LFUN_LASTACTION /* this marks the end of the table */
}; };

35
src/insets/BoundingBox.h Normal file
View File

@ -0,0 +1,35 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 the LyX Team.
*
* ====================================================== */
#ifndef BOUNDING_BOX_H
#define BOUNDING_BOX_H
///
struct BoundingBox {
///
BoundingBox()
: llx(-1), lly(-1), urx(-1), ury(-1) {}
///
bool isSet() const {
return llx != -1 && lly != - 1
&& urx != -1 && ury != -1;
}
///
int llx;
///
int lly;
///
int urx;
//
int ury;
};
#endif

View File

@ -19,6 +19,8 @@ libinsets_la_SOURCES = \
inseterror.h \ inseterror.h \
insetert.C \ insetert.C \
insetert.h \ insetert.h \
insetgraphics.C \
insetgraphics.h \
insetinclude.C \ insetinclude.C \
insetinclude.h \ insetinclude.h \
insetindex.C \ insetindex.C \

View File

@ -235,11 +235,10 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
// query current colormap // query current colormap
XColor * cmap = new XColor[gs_allcolors]; XColor * cmap = new XColor[gs_allcolors];
for (i = 0; i < gs_allcolors; ++i) cmap[i].pixel = i; for (i = 0; i < gs_allcolors; ++i) cmap[i].pixel = i;
#if 1 XQueryColors(tmpdisp,
XQueryColors(tmpdisp, fl_state[fl_get_vclass()].colormap, cmap, gs_allcolors); fl_state[fl_get_vclass()]
#else .colormap, cmap,
XQueryColors(tmpdisp, color_map, cmap, gs_allcolors); gs_allcolors);
#endif
XFlush(tmpdisp); XFlush(tmpdisp);
wid1 = p->wid - 1; wid1 = p->wid - 1;
// now we process all the image // now we process all the image
@ -304,7 +303,8 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
} }
static void AllocColors(int num) static
void AllocColors(int num)
// allocate color cube numxnumxnum, if possible // allocate color cube numxnumxnum, if possible
{ {
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
@ -458,7 +458,8 @@ int FindBmpIndex(figdata * tmpdata)
} }
static void freefigdata(figdata * tmpdata) static
void freefigdata(figdata * tmpdata)
{ {
tmpdata->ref--; tmpdata->ref--;
if (tmpdata->ref) return; if (tmpdata->ref) return;
@ -484,7 +485,8 @@ static void freefigdata(figdata * tmpdata)
} }
static void runqueue() static
void runqueue()
{ {
// run queued requests for ghostscript, if any // run queued requests for ghostscript, if any
if (!gsrunning && gs_color && !gs_xcolor) { if (!gsrunning && gs_color && !gs_xcolor) {
@ -700,7 +702,8 @@ static void runqueue()
} }
static void addwait(int psx, int psy, int pswid, int pshgh, figdata * data) static
void addwait(int psx, int psy, int pswid, int pshgh, figdata * data)
{ {
// recompute the stuff and put in the queue // recompute the stuff and put in the queue
queue_element p; queue_element p;
@ -718,7 +721,8 @@ static void addwait(int psx, int psy, int pswid, int pshgh, figdata * data)
} }
static figdata * getfigdata(int wid, int hgh, string const & fname, static
figdata * getfigdata(int wid, int hgh, string const & fname,
int psx, int psy, int pswid, int pshgh, int psx, int psy, int pswid, int pshgh,
int raw_wid, int raw_hgh, float angle, char flags) int raw_wid, int raw_hgh, float angle, char flags)
{ {
@ -808,8 +812,6 @@ void makeupdatelist(figdata * p)
} }
// add inset figures[i]->inset into to_update list // add inset figures[i]->inset into to_update list
current_view->pushIntoUpdateList(figures[i]->inset); current_view->pushIntoUpdateList(figures[i]->inset);
//PutInsetIntoInsetUpdateList(figures[i]->inset);
} }
} }
@ -896,7 +898,8 @@ void sigchldchecker(pid_t pid, int * status)
} }
static void getbitmaps() static
void getbitmaps()
{ {
bitmap_waiting = false; bitmap_waiting = false;
for (int i = 0; i < bmpinsref; ++i) for (int i = 0; i < bmpinsref; ++i)
@ -905,7 +908,8 @@ static void getbitmaps()
} }
static void RegisterFigure(InsetFig * fi) static
void RegisterFigure(InsetFig * fi)
{ {
if (figinsref == 0) InitFigures(); if (figinsref == 0) InitFigures();
fi->form = 0; fi->form = 0;
@ -916,7 +920,7 @@ static void RegisterFigure(InsetFig * fi)
typedef Figref * Figref_p; typedef Figref * Figref_p;
Figref ** tmp = new Figref_p[figarrsize]; Figref ** tmp = new Figref_p[figarrsize];
memcpy(tmp, figures, memcpy(tmp, figures,
sizeof(Figref*)*(figarrsize-figallocchunk)); sizeof(Figref*) * (figarrsize-figallocchunk));
delete[] figures; delete[] figures;
figures = tmp; figures = tmp;
} }
@ -944,7 +948,8 @@ int FindFigIndex(Figref * tmpfig)
} }
static void UnregisterFigure(InsetFig * fi) static
void UnregisterFigure(InsetFig * fi)
{ {
Figref * tmpfig = fi->figure; Figref * tmpfig = fi->figure;
@ -975,7 +980,8 @@ static void UnregisterFigure(InsetFig * fi)
} }
static string NextToken(istream & is) static
string NextToken(istream & is)
{ {
string token; string token;
char c; char c;
@ -1036,7 +1042,8 @@ int InsetFig::width(Painter &, LyXFont const &) const
} }
void InsetFig::draw(Painter & pain, LyXFont const & f, int baseline, float & x) const void InsetFig::draw(Painter & pain, LyXFont const & f,
int baseline, float & x) const
{ {
LyXFont font(f); LyXFont font(f);

View File

@ -107,6 +107,7 @@ void UpdatableInset::ToggleInsetCursor(BufferView *)
{ {
} }
void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int) void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
{ {
LyXFont LyXFont

View File

@ -116,9 +116,9 @@ void InsetERT::draw_closed(Painter & pain, LyXFont const & f,
font.decSize(); font.decSize();
font.setColor(LColor::ert); font.setColor(LColor::ert);
int width; int width;
pain.buttonText(int(x)+TEXT_TO_INSET_OFFSET, baseline, _("ERT"), font, pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET, baseline,
true, width); _("ERT"), font, true, width);
x += width + (2*TEXT_TO_INSET_OFFSET); x += width + (2 * TEXT_TO_INSET_OFFSET);
} }

257
src/insets/insetgraphics.C Normal file
View File

@ -0,0 +1,257 @@
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 the LyX Team.
*
* ====================================================== */
#ifdef __GNUG__
#pragma implementation
#endif
#include <config.h>
#include "insets/insetgraphics.h"
#include "Painter.h"
int InsetGraphics::ascent(Painter &, LyXFont const &) const
{
return 100;
}
int InsetGraphics::descent(Painter &, LyXFont const &) const
{
// this is not true if viewport is used and clip is not.
return 1;
}
int InsetGraphics::width(Painter &, LyXFont const &) const
{
if (bb.isSet()) {
return bb.urx - bb.llx;
}
return 100;
}
void InsetGraphics::draw(Painter & pain, LyXFont const & font,
int baseline, float & x) const
{
// This will draw the graphics. As for now we only draw a
// placeholder rectangele.
pain.rectangle(x, baseline - ascent(pain, font),
width(pain, font),
ascent(pain, font) + descent(pain, font));
}
void InsetGraphics::Edit(BufferView *, int, int, unsigned int)
{
// Here we want to popup a dialog from which we get the
// graphics paramters.
}
unsigned char InsetGraphics::Editable() const
{
return 1;
}
void InsetGraphics::Write(ostream & os) const
{
// The question on the file format is still open.
// Suggestions?
os << "GRAPHICS\n";
}
void InsetGraphics::Read(LyXLex & /*lex*/)
{
// For now we only use a static file...
graphicsfile = "testfile.xpm";
//graphicscache.addFile(graphicsfile);
//bb = graphicscache.getBB(graphicsfile);
//pixmap = graphicscache.getPixmap(graphicsfile);
}
int InsetGraphics::Latex(ostream & os, signed char /*fragile*/) const
{
// MISSING: We have to decide how to do the order of the options
// that is depentant of order, like witdth, height, andlge. Should
// we rotate before scale? Should we let the user decide?
// bool rot_before_scale; ?
// Nothing to do if we don't have a graphics file
if (graphicsfile.empty()) return 0;
// We never used the starred form, we use the "clip" option instead.
string command("\\insetgraphics");
#ifdef HAVE_SSTREAM
ostringstream options;
#else
ostrstream options;
#endif
if (bb.isSet() && use_bb) {
options << "bb="
<< bb.llx << " " << bb.lly << " "
<< bb.urx << " " << bb.ury << ",";
}
if (hiresbb) {
options << "hiresbb,";
}
if (viewport.isSet()) {
options << "viewport="
<< viewport.llx << " " << viewport.lly << " "
<< viewport.urx << " " << viewport.ury << ",";
}
if (trim.isSet()) {
options << "trim="
<< trim.llx << " " << trim.lly << " "
<< trim.urx << " " << trim.ury << ",";
}
if (natheight.value() == 0) {
options << "natheight=" << natheight.asString() << ",";
}
if (natwidth.value() == 0) {
options << "natwidth=" << natwidth.asString() << ",";
}
if (angle != 0.0) {
options << "angle=" << angle << ",";
}
if (origin != DEFAULT) {
switch(origin) {
case DEFAULT: break;
case LEFTTOP:
options << "origin=lt,";
break;
case LEFTCENTER:
options << "origin=lc,";
break;
case LEFTBASELINE:
options << "origin=lB,";
break;
case LEFTBOTTOM:
options << "origin=lb,";
break;
case CENTERTOP:
options << "origin=ct,";
break;
case CENTER:
options << "origin=c,";
break;
case CENTERBASELINE:
options << "origin=cB,";
break;
case CENTERBOTTOM:
options << "origin=cb,";
break;
case RIGHTTOP:
options << "origin=rt,";
break;
case RIGHTCENTER:
options << "origin=rc,";
break;
case RIGHTBASELINE:
options << "origin=rB,";
break;
case RIGHTBOTTOM:
options << "origin=rb,";
break;
}
}
if (g_width.value() != 0) {
options << "width=" << g_width.asString() << ",";
}
if (g_height.value() != 0) {
options << "height=" << g_height.asString() << ",";
}
if (totalheight.value() != 0) {
options << "totalheight=" << totalheight.asString() << ",";
}
if (keepaspectratio) {
options << "keepaspectratio,";
}
if (scale != 0.0) {
options << "scale=" << scale << ",";
}
if (clip) {
options << "clip,";
}
if (draft) {
options << "draft,";
}
if (!type.empty()) {
options << "type=" << type << ",";
}
if (!ext.empty()) {
options << "ext=" << type << ",";
}
if (!read.empty()) {
options << "read=" << type << ",";
}
if (!command.empty()) {
options << "command=" << type << ",";
}
#ifdef HAVE_SSTREAM
string opts(options.str().c_str());
#else
options << '\0';
char * tmp = options.str();
string opts(tmp);
delete [] tmp;
#endif
opts = strip(opts, ',');
if (!opts.empty()) {
command += "[";
command += opts;
command += "]";
}
command += "{";
command += graphicsfile;
command += "}";
os << command << '\n';
return 1;
}
int InsetGraphics::Latex(string & /*file*/, signed char /*fragile*/) const
{
return 0;
}
int InsetGraphics::Linuxdoc(string & /*file*/) const
{
return 0;
}
int InsetGraphics::DocBook(string & /*file*/) const
{
return 0;
}
void InsetGraphics::Validate(LaTeXFeatures & /*features*/) const
{
//features.graphicx = true;
}
Inset * InsetGraphics::Clone() const
{
return new InsetGraphics;
}

161
src/insets/insetgraphics.h Normal file
View File

@ -0,0 +1,161 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 the LyX Team.
*
* ====================================================== */
#ifndef INSET_GRAPHICS_H
#define INSET_GRAPHICS_H
#ifdef __GNUG__
#pragma interface
#endif
#include "insets/lyxinset.h"
#include "LaTeXFeatures.h"
#include "vspace.h"
#include "insets/BoundingBox.h"
///
class InsetGraphics : public Inset {
public:
///
int ascent(Painter &, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
///
int width(Painter &, LyXFont const &) const;
///
void draw(Painter &, LyXFont const &,
int baseline, float & x) const;
///
void Edit(BufferView *, int, int, unsigned int);
///
unsigned char Editable() const;
///
void Write(ostream &) const;
///
void Read(LyXLex & lex);
/** returns the number of rows (\n's) of generated tex code.
fragile != 0 means, that the inset should take care about
fragile commands by adding a \protect before.
*/
int Latex(ostream &, signed char fragile) const;
///
int Latex(string & file, signed char fragile) const;
///
int Linuxdoc(string & /*file*/) const;
///
int DocBook(string & /*file*/) const;
/// Updates needed features for this inset.
void Validate(LaTeXFeatures & features) const;
/// returns LyX code associated with the inset. Used for TOC, ...)
Inset::Code LyxCode() const { return Inset::GRAPHICS_CODE; }
///
Inset * Clone() const;
private:
///
string graphicsfile;
///
Pixmap pixmap;
// We need variables to store the size of the boundingbox and
// to store a pointer to the pixmap in.. The question is if
// these should be in a "pixmap" class.
// We also need to have variables about rotation and scaling,
// width and height. in effect all the paramters that
// \includegrapichs can handle. (the graphix.sty package)
/** The "bounding box" of the graphics image. Its value field
must contain four dimensions, separated by spaces. */
BoundingBox bb;
/** The bounding box above is used for display and file both.
But we need this variable below to know if we shall use the
bounding box in the LaTex command or not. (i.e. if the user
has manually set the bb.) */
bool use_bb;
/** When a graphics file is parsed we first check for BoundingBox
and then for HiResBoundingBox, and set hiresbb depending on this.
This key makes LaTeX search for %%HiResBoundingBox comments
instead of the normal %%BoundingBox. Some applications use
this to specify more precise bounding boxes, becase the cumbers
can normally only have integer values. It is a Boolean, either
"true" or "false". */
bool hiresbb;
/** This key takes four arguments (like bb), but in this case the
origin is taken with respect to the bounding box specified in
the file. So to view a 20 bp square at the lower left-hand corner
of the picture, specify viewport=0 0 20 20. */
BoundingBox viewport;
/** Similar to the viewport key, but the four dimensions correspond
to the amount of space to be trimmed (cut off) at the left-hand
side, bottom, right-hand side and top of the included graphics. */
BoundingBox trim;
/// Natural height of figure
LyXLength natheight;
/// Natural width of figure.
LyXLength natwidth;
/// Rotation angle (in degrees, counterclockwise).
float angle;
/// This is the different origins that the graphicx package support.
enum Origin {
DEFAULT,
LEFTTOP,
LEFTCENTER,
LEFTBASELINE,
LEFTBOTTOM,
CENTERTOP,
CENTER,
CENTERBASELINE,
CENTERBOTTOM,
RIGHTTOP,
RIGHTCENTER,
RIGHTBASELINE,
RIGHTBOTTOM,
REFERENCE_POINT = LEFTBASELINE
};
/** Origin for rotation, similar to the origin parameter of
the \rotatebox command described on p.46 and Fig. 2.2 on p.46. */
Origin origin;
/// Required width (the width of the image is scaled to that value).
LyXLength g_width;
/// Required height (the height of the image is scaled to that value).
LyXLength g_height;
/** Required total height (the total height of the image is scaled
to that value). This key should be used instead of height if
images are rotated over 90 degrees, since the height can
disappear (and become the depth) and LaTeX will have difficulties
satisfying the user's request. */
LyXLength totalheight;
/** Boolean variable that can have the values "true" and "false"
(se above for defaults). When true, specifying both width and
height parameters does not distort the picture, but the image
is scaled so that neither of the width of height exceeds the
given dimensions. */
bool keepaspectratio;
/// Scale factor
float scale;
/** Clip the graphic to the bounding box. It is a Boolean, either
"true" or "false". */
bool clip;
/// Locally switch to draft mode. A Boolean valued key, like clip.
bool draft;
/// The graphics type.
string type;
///x The file extension of the file containing the image data.
string ext;
/// The file extension of the file "read" by LaTeX.
string read;
/// Any command to be applied to the file.
string command;
};
#endif

View File

@ -81,7 +81,10 @@ InsetQuotes::InsetQuotes(char c, BufferParams const & params)
switch(c) { switch(c) {
case ' ': case '(': case '{': case '[': case '-': case ':': case ' ': case '(': case '{': case '[': case '-': case ':':
case LyXParagraph::META_HFILL: case LyXParagraph::META_HFILL:
#warning think about this
#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR: case LyXParagraph::META_PROTECTED_SEPARATOR:
#endif
case LyXParagraph::META_NEWLINE: case LyXParagraph::META_NEWLINE:
side = InsetQuotes::LeftQ; // left quote side = InsetQuotes::LeftQ; // left quote
break; break;

View File

@ -38,26 +38,36 @@ int InsetSpecialChar::descent(Painter &, LyXFont const & font) const
int InsetSpecialChar::width(Painter &, LyXFont const & font) const int InsetSpecialChar::width(Painter &, LyXFont const & font) const
{ {
LyXFont f(font);
switch (kind) { switch (kind) {
case HYPHENATION: case HYPHENATION:
{ {
int w = f.textWidth("-", 1); int w = font.textWidth("-", 1);
if (w > 5) if (w > 5)
w -= 2; // to make it look shorter w -= 2; // to make it look shorter
return w; return w;
} }
case END_OF_SENTENCE: case END_OF_SENTENCE:
{ {
return f.textWidth(".", 1); return font.textWidth(".", 1);
} }
case LDOTS: case LDOTS:
{ {
return f.textWidth(". . .", 5); return font.textWidth(". . .", 5);
} }
case MENU_SEPARATOR: { case MENU_SEPARATOR:
return f.textWidth(" x ", 3); {
return font.textWidth(" x ", 3);
} }
#if 0
case NEWLINE:
{
}
#endif
case PROTECTED_SEPARATOR:
{
return font.textWidth("x", 1);
}
} }
return 1; // To shut up gcc return 1; // To shut up gcc
} }
@ -104,6 +114,34 @@ void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
pain.lines(xp, yp, 4, LColor::special); pain.lines(xp, yp, 4, LColor::special);
x += width(pain, font); x += width(pain, font);
break;
}
#if 0
case NEWLINE:
{
}
#endif
case PROTECTED_SEPARATOR:
{
float w = width(pain, font);
int h = font.ascent('x');
int xp[4], yp[4];
xp[0] = int(x);
yp[0] = baseline - max(h / 4, 1);
xp[1] = int(x);
yp[1] = baseline;
xp[2] = int(x + w);
yp[2] = baseline;
xp[3] = int(x + w);
yp[3] = baseline - max(h / 4, 1);
pain.lines(xp, yp, 4, LColor::special);
x += w;
break;
} }
} }
} }
@ -118,6 +156,11 @@ void InsetSpecialChar::Write(ostream & os) const
case END_OF_SENTENCE: command = "\\@."; break; case END_OF_SENTENCE: command = "\\@."; break;
case LDOTS: command = "\\ldots{}"; break; case LDOTS: command = "\\ldots{}"; break;
case MENU_SEPARATOR: command = "\\menuseparator"; break; case MENU_SEPARATOR: command = "\\menuseparator"; break;
#if 0
case NEWLINE: command = "\\newline"; break;
#endif
case PROTECTED_SEPARATOR:
command = "\\protected_separator"; break;
} }
os << "\\SpecialChar " << command << "\n"; os << "\\SpecialChar " << command << "\n";
} }
@ -137,6 +180,8 @@ void InsetSpecialChar::Read(LyXLex & lex)
kind = LDOTS; kind = LDOTS;
else if (command == "\\menuseparator") else if (command == "\\menuseparator")
kind = MENU_SEPARATOR; kind = MENU_SEPARATOR;
else if (command == "\\protected_separator")
kind = PROTECTED_SEPARATOR;
else else
lex.printError("InsetSpecialChar: Unknown kind: `$$Token'"); lex.printError("InsetSpecialChar: Unknown kind: `$$Token'");
} }
@ -159,6 +204,7 @@ int InsetSpecialChar::Latex(string & file, signed char /*fragile*/) const
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;
} }
return 0; return 0;
} }
@ -171,6 +217,7 @@ int InsetSpecialChar::Linuxdoc(string & file) const
case END_OF_SENTENCE: file += ""; break; case END_OF_SENTENCE: file += ""; break;
case LDOTS: file += "..."; break; case LDOTS: file += "..."; break;
case MENU_SEPARATOR: file += "->"; break; case MENU_SEPARATOR: file += "->"; break;
case PROTECTED_SEPARATOR: file += " "; break;
} }
return 0; return 0;
} }
@ -183,6 +230,7 @@ int InsetSpecialChar::DocBook(string & file) const
case END_OF_SENTENCE: file += ""; break; case END_OF_SENTENCE: file += ""; break;
case LDOTS: file += "..."; break; case LDOTS: file += "..."; break;
case MENU_SEPARATOR: file += "->"; break; case MENU_SEPARATOR: file += "->"; break;
case PROTECTED_SEPARATOR: file += " "; break;
} }
return 0; return 0;
} }

View File

@ -33,7 +33,13 @@ public:
/// End of sentence punctuation (\@) /// End of sentence punctuation (\@)
END_OF_SENTENCE, END_OF_SENTENCE,
/// Menu separator /// Menu separator
MENU_SEPARATOR MENU_SEPARATOR,
#if 0
/// Newline
NEWLINE,
#endif
/// Protected Separator
PROTECTED_SEPARATOR
}; };
/// ///
@ -65,7 +71,7 @@ public:
/// ///
Inset::Code LyxCode() const Inset::Code LyxCode() const
{ {
return Inset::NO_CODE; return Inset::SPECIALCHAR_CODE;
} }
/// We don't need \begin_inset and \end_inset /// We don't need \begin_inset and \end_inset
bool DirectWrite() const bool DirectWrite() const

View File

@ -347,10 +347,14 @@ void InsetText::Read(LyXLex & lex)
++pos; ++pos;
} else if (token == "\\protected_separator") { } else if (token == "\\protected_separator") {
// now obsolete, but we have a back compability // now obsolete, but we have a back compability
#if 0
par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR); par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR);
//Inset * inset = new InsetSpecialChar(LyXParagraph::META_PROTECTED_SEPARATOR); #else
// par->InsertChar(pos, LyXParagraph::META_INSET); Inset * inset =
// par->InsertInset(pos, inset); new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
#endif
par->SetFont(pos, font); par->SetFont(pos, font);
++pos; ++pos;
#endif #endif
@ -358,7 +362,7 @@ void InsetText::Read(LyXLex & lex)
if (!par->bibkey) if (!par->bibkey)
par->bibkey = new InsetBibKey; par->bibkey = new InsetBibKey;
par->bibkey->Read(lex); par->bibkey->Read(lex);
}else if (token == "\\backslash") { } else if (token == "\\backslash") {
par->InsertChar(pos, '\\'); par->InsertChar(pos, '\\');
par->SetFont(pos, font); par->SetFont(pos, font);
++pos; ++pos;
@ -377,7 +381,7 @@ void InsetText::Read(LyXLex & lex)
} }
int InsetText::ascent(Painter &pain, LyXFont const & font) const int InsetText::ascent(Painter & pain, LyXFont const & font) const
{ {
if (init_inset) { if (init_inset) {
computeTextRows(pain); computeTextRows(pain);
@ -389,7 +393,7 @@ int InsetText::ascent(Painter &pain, LyXFont const & font) const
} }
int InsetText::descent(Painter &pain, LyXFont const & font) const int InsetText::descent(Painter & pain, LyXFont const & font) const
{ {
if (init_inset) { if (init_inset) {
computeTextRows(pain); computeTextRows(pain);
@ -401,7 +405,7 @@ int InsetText::descent(Painter &pain, LyXFont const & font) const
} }
int InsetText::width(Painter &pain, LyXFont const &) const int InsetText::width(Painter & pain, LyXFont const &) const
{ {
if (init_inset) { if (init_inset) {
computeTextRows(pain); computeTextRows(pain);
@ -418,7 +422,7 @@ int InsetText::getMaxWidth(UpdatableInset * inset) const
return 0; return 0;
} }
if (the_locking_inset==inset) if (the_locking_inset == inset)
return maxWidth; return maxWidth;
return the_locking_inset->getMaxWidth(inset); return the_locking_inset->getMaxWidth(inset);
@ -439,9 +443,9 @@ void InsetText::draw(Painter & pain, LyXFont const & f,
top_baseline = baseline; top_baseline = baseline;
computeBaselines(baseline); computeBaselines(baseline);
for(unsigned int r = 0; r < rows.size() - 1; ++r) { for(unsigned int r = 0; r < rows.size() - 1; ++r) {
drawRowSelection(pain, rows[r].pos, rows[r+1].pos, r, drawRowSelection(pain, rows[r].pos, rows[r + 1].pos, r,
rows[r].baseline, x); rows[r].baseline, x);
drawRowText(pain, rows[r].pos, rows[r+1].pos, rows[r].baseline, x); drawRowText(pain, rows[r].pos, rows[r + 1].pos, rows[r].baseline, x);
} }
x += insetWidth; x += insetWidth;
if (!the_locking_inset && do_reset_pos) { if (!the_locking_inset && do_reset_pos) {
@ -604,11 +608,11 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
} }
no_selection = false; no_selection = false;
if (the_locking_inset) { if (the_locking_inset) {
setPos(bv, x,y,false); setPos(bv, x, y, false);
UpdatableInset UpdatableInset
*inset=0; *inset = 0;
if (par->GetChar(actpos)==LyXParagraph::META_INSET) if (par->GetChar(actpos) == LyXParagraph::META_INSET)
inset=(UpdatableInset*)par->GetInset(actpos); inset = static_cast<UpdatableInset*>(par->GetInset(actpos));
if (the_locking_inset == inset) { if (the_locking_inset == inset) {
the_locking_inset->InsetButtonPress(bv,x-inset_x,y-inset_y,button); the_locking_inset->InsetButtonPress(bv,x-inset_x,y-inset_y,button);
return; return;
@ -826,7 +830,7 @@ UpdatableInset::RESULT InsetText::LocalDispatch(BufferView * bv,
} }
int InsetText::Latex(ostream &os, signed char fragile) const int InsetText::Latex(ostream & os, signed char fragile) const
{ {
string fstr; string fstr;
@ -859,7 +863,7 @@ int InsetText::SingleWidth(Painter & pain, LyXParagraph * par, int pos) const
if (IsPrintable(c)) { if (IsPrintable(c)) {
return font.width(c); return font.width(c);
} else if (c == LyXParagraph::META_INSET) { } else if (c == LyXParagraph::META_INSET) {
Inset const * tmpinset=par->GetInset(pos); Inset const * tmpinset = par->GetInset(pos);
if (tmpinset) if (tmpinset)
return tmpinset->width(pain, font); return tmpinset->width(pain, font);
else else
@ -905,7 +909,7 @@ LyXFont InsetText::GetFont(LyXParagraph * par, int pos) const
{ {
char par_depth = par->GetDepth(); char par_depth = par->GetDepth();
LyXLayout layout = LyXLayout const & layout =
textclasslist.Style(buffer->params.textclass, par->GetLayout()); textclasslist.Style(buffer->params.textclass, par->GetLayout());
// We specialize the 95% common case: // We specialize the 95% common case:
@ -989,8 +993,7 @@ int InsetText::InsetInInsetY()
if (!the_locking_inset) if (!the_locking_inset)
return 0; return 0;
int int y = inset_y;
y = inset_y;
return (y + the_locking_inset->InsetInInsetY()); return (y + the_locking_inset->InsetInInsetY());
} }
@ -1038,8 +1041,9 @@ void InsetText::HideInsetCursor(BufferView * bv)
void InsetText::setPos(BufferView * bv, int x, int y, bool activate_inset) void InsetText::setPos(BufferView * bv, int x, int y, bool activate_inset)
{ {
int ox = x, int ox = x;
oy = y; int oy = y;
// search right X-pos x==0 -> top_x // search right X-pos x==0 -> top_x
actpos = actrow = 0; actpos = actrow = 0;
cy = top_baseline; cy = top_baseline;
@ -1247,7 +1251,7 @@ void InsetText::SetCharFont(int pos, LyXFont const & f)
if (par->GetInset(pos)) if (par->GetInset(pos))
font = par->GetInset(pos)->ConvertFont(font); font = par->GetInset(pos)->ConvertFont(font);
} }
LyXLayout layout = LyXLayout const & layout =
textclasslist.Style(buffer->params.textclass,par->GetLayout()); textclasslist.Style(buffer->params.textclass,par->GetLayout());
// Get concrete layout font to reduce against // Get concrete layout font to reduce against
@ -1292,7 +1296,7 @@ void InsetText::computeTextRows(Painter & pain) const
row.baseline = 0; row.baseline = 0;
rows.push_back(row); rows.push_back(row);
if (maxWidth < 0) { if (maxWidth < 0) {
for(p=0; p < par->Last(); ++p) { for(p = 0; p < par->Last(); ++p) {
insetWidth += SingleWidth(pain, par, p); insetWidth += SingleWidth(pain, par, p);
SingleHeight(pain, par, p, asc, desc); SingleHeight(pain, par, p, asc, desc);
if (asc > maxAscent) if (asc > maxAscent)
@ -1310,7 +1314,7 @@ void InsetText::computeTextRows(Painter & pain) const
bool is_first_word_in_row = true; bool is_first_word_in_row = true;
int cw, int cw,
lastWordWidth=0; lastWordWidth = 0;
for(p = 0; p < par->Last(); ++p) { for(p = 0; p < par->Last(); ++p) {
cw = SingleWidth(pain, par, p); cw = SingleWidth(pain, par, p);
@ -1323,13 +1327,13 @@ void InsetText::computeTextRows(Painter & pain) const
wordDescent = desc; wordDescent = desc;
Inset const * inset = 0; Inset const * inset = 0;
if (((p + 1) < par->Last()) && if (((p + 1) < par->Last()) &&
(par->GetChar(p+1)==LyXParagraph::META_INSET)) (par->GetChar(p + 1)==LyXParagraph::META_INSET))
inset = par->GetInset(p+1); inset = par->GetInset(p + 1);
if (inset && inset->display()) { if (inset && inset->display()) {
if (!is_first_word_in_row && (width >= maxWidth)) { if (!is_first_word_in_row && (width >= maxWidth)) {
// we have to split also the row above // we have to split also the row above
rows[rows.size()-1].asc = oasc; rows[rows.size() - 1].asc = oasc;
rows[rows.size()-1].desc = odesc; rows[rows.size() - 1].desc = odesc;
row.pos = nwp; row.pos = nwp;
rows.push_back(row); rows.push_back(row);
oasc = wordAscent; oasc = wordAscent;
@ -1360,14 +1364,14 @@ void InsetText::computeTextRows(Painter & pain) const
} else if (par->IsSeparator(p)) { } else if (par->IsSeparator(p)) {
if (width >= maxWidth) { if (width >= maxWidth) {
if (is_first_word_in_row) { if (is_first_word_in_row) {
rows[rows.size()-1].asc = wordAscent; rows[rows.size() - 1].asc = wordAscent;
rows[rows.size()-1].desc = wordDescent; rows[rows.size() - 1].desc = wordDescent;
row.pos = p+1; row.pos = p + 1;
rows.push_back(row); rows.push_back(row);
oasc = odesc = width = 0; oasc = odesc = width = 0;
} else { } else {
rows[rows.size()-1].asc = oasc; rows[rows.size() - 1].asc = oasc;
rows[rows.size()-1].desc = odesc; rows[rows.size() - 1].desc = odesc;
row.pos = nwp; row.pos = nwp;
rows.push_back(row); rows.push_back(row);
oasc = wordAscent; oasc = wordAscent;
@ -1377,7 +1381,7 @@ void InsetText::computeTextRows(Painter & pain) const
width = lastWordWidth; width = lastWordWidth;
} }
wordAscent = wordDescent = lastWordWidth = 0; wordAscent = wordDescent = lastWordWidth = 0;
nwp = p+1; nwp = p + 1;
continue; continue;
} }
owidth = width; owidth = width;
@ -1386,7 +1390,7 @@ void InsetText::computeTextRows(Painter & pain) const
if (odesc < wordDescent) if (odesc < wordDescent)
odesc = wordDescent; odesc = wordDescent;
wordAscent = wordDescent = lastWordWidth = 0; wordAscent = wordDescent = lastWordWidth = 0;
nwp = p+1; nwp = p + 1;
is_first_word_in_row = false; is_first_word_in_row = false;
} }
} }
@ -1394,13 +1398,13 @@ void InsetText::computeTextRows(Painter & pain) const
if (p) { if (p) {
if (width >= maxWidth) { if (width >= maxWidth) {
// assign upper row // assign upper row
rows[rows.size()-1].asc = oasc; rows[rows.size() - 1].asc = oasc;
rows[rows.size()-1].desc = odesc; rows[rows.size() - 1].desc = odesc;
// assign and allocate lower row // assign and allocate lower row
row.pos = nwp; row.pos = nwp;
rows.push_back(row); rows.push_back(row);
rows[rows.size()-1].asc = wordAscent; rows[rows.size() - 1].asc = wordAscent;
rows[rows.size()-1].desc = wordDescent; rows[rows.size() - 1].desc = wordDescent;
if (insetWidth < owidth) if (insetWidth < owidth)
insetWidth = owidth; insetWidth = owidth;
width -= owidth; width -= owidth;
@ -1412,8 +1416,8 @@ void InsetText::computeTextRows(Painter & pain) const
oasc = wordAscent; oasc = wordAscent;
if (odesc < wordDescent) if (odesc < wordDescent)
odesc = wordDescent; odesc = wordDescent;
rows[rows.size()-1].asc = oasc; rows[rows.size() - 1].asc = oasc;
rows[rows.size()-1].desc = odesc; rows[rows.size() - 1].desc = odesc;
} }
} }
// alocate a dummy row for the endpos // alocate a dummy row for the endpos
@ -1422,7 +1426,7 @@ void InsetText::computeTextRows(Painter & pain) const
// calculate maxAscent/Descent // calculate maxAscent/Descent
maxAscent = rows[0].asc; maxAscent = rows[0].asc;
maxDescent = rows[0].desc; maxDescent = rows[0].desc;
for (unsigned int i=1; i<rows.size()-1; ++i) { for (unsigned int i = 1; i < rows.size() - 1; ++i) {
maxDescent += rows[i].asc + rows[i].desc + interline_space; maxDescent += rows[i].asc + rows[i].desc + interline_space;
} }
#if 0 #if 0
@ -1430,7 +1434,7 @@ void InsetText::computeTextRows(Painter & pain) const
computeBaselines(top_baseline); computeBaselines(top_baseline);
actpos = inset_pos; actpos = inset_pos;
resetPos(bv); resetPos(bv);
inset_x = cx-top_x; inset_x = cx - top_x;
inset_y = cy; inset_y = cy;
} }
#endif #endif
@ -1440,8 +1444,8 @@ void InsetText::computeTextRows(Painter & pain) const
void InsetText::computeBaselines(int baseline) const void InsetText::computeBaselines(int baseline) const
{ {
rows[0].baseline = baseline; rows[0].baseline = baseline;
for (unsigned int i=1; i<rows.size()-1; i++) { for (unsigned int i = 1; i < rows.size() - 1; i++) {
rows[i].baseline = rows[i-1].baseline + rows[i-1].desc + rows[i].baseline = rows[i - 1].baseline + rows[i - 1].desc +
rows[i].asc + interline_space; rows[i].asc + interline_space;
} }
} }

View File

@ -78,7 +78,9 @@ public:
/// ///
BIBTEX_CODE, BIBTEX_CODE,
/// ///
TEXT_CODE TEXT_CODE,
///
SPECIALCHAR_CODE
}; };
/// ///

View File

@ -94,6 +94,7 @@ enum LayoutTags {
}; };
#if 0
// This table is sorted alphabetically [asierra 30March96] // This table is sorted alphabetically [asierra 30March96]
static keyword_item layoutTags[] = { static keyword_item layoutTags[] = {
{ "align", LT_ALIGN }, { "align", LT_ALIGN },
@ -133,6 +134,7 @@ static keyword_item layoutTags[] = {
{ "textfont", LT_TEXTFONT }, { "textfont", LT_TEXTFONT },
{ "topsep", LT_TOPSEP } { "topsep", LT_TOPSEP }
}; };
#endif
///////////////////// /////////////////////
@ -171,6 +173,47 @@ LyXLayout::LyXLayout ()
// Reads a layout definition from file // Reads a layout definition from file
bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass) bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
{ {
#if 1
// This table is sorted alphabetically [asierra 30March96]
keyword_item layoutTags[] = {
{ "align", LT_ALIGN },
{ "alignpossible", LT_ALIGNPOSSIBLE },
{ "bottomsep", LT_BOTTOMSEP },
{ "copystyle", LT_COPYSTYLE },
{ "end", LT_END },
{ "fill_bottom", LT_FILL_BOTTOM },
{ "fill_top", LT_FILL_TOP },
{ "font", LT_FONT },
{ "freespacing", LT_FREE_SPACING },
{ "intitle", LT_INTITLE },
{ "itemsep", LT_ITEMSEP },
{ "keepempty", LT_KEEPEMPTY },
{ "labelbottomsep", LT_LABEL_BOTTOMSEP },
{ "labelfont", LT_LABELFONT },
{ "labelindent", LT_LABELINDENT },
{ "labelsep", LT_LABELSEP },
{ "labelstring", LT_LABELSTRING },
{ "labelstringappendix", LT_LABELSTRING_APPENDIX },
{ "labeltype", LT_LABELTYPE },
{ "latexname", LT_LATEXNAME },
{ "latexparam", LT_LATEXPARAM },
{ "latextype", LT_LATEXTYPE },
{ "leftmargin", LT_LEFTMARGIN },
{ "margin", LT_MARGIN },
{ "needprotect", LT_NEED_PROTECT },
{ "newline", LT_NEWLINE },
{ "nextnoindent", LT_NEXTNOINDENT },
{ "obsoletedby", LT_OBSOLETEDBY },
{ "parindent", LT_PARINDENT },
{ "parsep", LT_PARSEP },
{ "parskip", LT_PARSKIP },
{ "preamble", LT_PREAMBLE },
{ "rightmargin", LT_RIGHTMARGIN },
{ "spacing", LT_SPACING },
{ "textfont", LT_TEXTFONT },
{ "topsep", LT_TOPSEP }
};
#endif
bool error = false; bool error = false;
bool finished = false; bool finished = false;
lexrc.pushTable(layoutTags, LT_INTITLE); lexrc.pushTable(layoutTags, LT_INTITLE);
@ -392,6 +435,7 @@ enum AlignTags {
}; };
#if 0
static keyword_item alignTags[] = { static keyword_item alignTags[] = {
{ "block", AT_BLOCK }, { "block", AT_BLOCK },
{ "center", AT_CENTER }, { "center", AT_CENTER },
@ -399,10 +443,19 @@ static keyword_item alignTags[] = {
{ "left", AT_LEFT }, { "left", AT_LEFT },
{ "right", AT_RIGHT } { "right", AT_RIGHT }
}; };
#endif
void LyXLayout::readAlign(LyXLex & lexrc) void LyXLayout::readAlign(LyXLex & lexrc)
{ {
#if 1
keyword_item alignTags[] = {
{ "block", AT_BLOCK },
{ "center", AT_CENTER },
{ "layout", AT_LAYOUT },
{ "left", AT_LEFT },
{ "right", AT_RIGHT }
};
#endif
pushpophelper pph(lexrc, alignTags, AT_LAYOUT); pushpophelper pph(lexrc, alignTags, AT_LAYOUT);
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
@ -433,6 +486,15 @@ void LyXLayout::readAlign(LyXLex & lexrc)
void LyXLayout::readAlignPossible(LyXLex & lexrc) void LyXLayout::readAlignPossible(LyXLex & lexrc)
{ {
#if 1
keyword_item alignTags[] = {
{ "block", AT_BLOCK },
{ "center", AT_CENTER },
{ "layout", AT_LAYOUT },
{ "left", AT_LEFT },
{ "right", AT_RIGHT }
};
#endif
lexrc.pushTable(alignTags, AT_LAYOUT); lexrc.pushTable(alignTags, AT_LAYOUT);
alignpossible = LYX_ALIGN_NONE; alignpossible = LYX_ALIGN_NONE;
int lineno = lexrc.GetLineNo(); int lineno = lexrc.GetLineNo();
@ -487,6 +549,7 @@ enum LabelTypeTags {
}; };
#if 0
static keyword_item labelTypeTags[] = { static keyword_item labelTypeTags[] = {
{ "bibliography", LA_BIBLIO }, { "bibliography", LA_BIBLIO },
{ "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT }, { "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT },
@ -506,10 +569,32 @@ static keyword_item labelTypeTags[] = {
{ "static", LA_STATIC }, { "static", LA_STATIC },
{ "top_environment", LA_TOP_ENVIRONMENT } { "top_environment", LA_TOP_ENVIRONMENT }
}; };
#endif
void LyXLayout::readLabelType(LyXLex & lexrc) void LyXLayout::readLabelType(LyXLex & lexrc)
{ {
#if 1
keyword_item labelTypeTags[] = {
{ "bibliography", LA_BIBLIO },
{ "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT },
{ "counter_chapter", LA_COUNTER_CHAPTER },
{ "counter_enumi", LA_COUNTER_ENUMI },
{ "counter_enumii", LA_COUNTER_ENUMII },
{ "counter_enumiii", LA_COUNTER_ENUMIII },
{ "counter_enumiv", LA_COUNTER_ENUMIV },
{ "counter_paragraph", LA_COUNTER_PARAGRAPH },
{ "counter_section", LA_COUNTER_SECTION },
{ "counter_subparagraph", LA_COUNTER_SUBPARAGRAPH },
{ "counter_subsection", LA_COUNTER_SUBSECTION },
{ "counter_subsubsection", LA_COUNTER_SUBSUBSECTION },
{ "manual", LA_MANUAL },
{ "no_label", LA_NO_LABEL },
{ "sensitive", LA_SENSITIVE },
{ "static", LA_STATIC },
{ "top_environment", LA_TOP_ENVIRONMENT }
};
#endif
pushpophelper pph(lexrc, labelTypeTags, LA_BIBLIO); pushpophelper pph(lexrc, labelTypeTags, LA_BIBLIO);
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
@ -574,97 +659,87 @@ void LyXLayout::readLabelType(LyXLex & lexrc)
} }
enum MarginTags { #if 0
MT_STATIC = 1,
MT_MANUAL,
MT_DYNAMIC,
MT_FIRST_DYNAMIC,
MT_RIGHT_ADDRESS_BOX
};
static keyword_item marginTags[] = { static keyword_item marginTags[] = {
{ "dynamic", MT_DYNAMIC }, { "dynamic", MARGIN_DYNAMIC },
{ "first_dynamic", MT_FIRST_DYNAMIC }, { "first_dynamic", MARGIN_FIRST_DYNAMIC },
{ "manual", MT_MANUAL }, { "manual", MARGIN_MANUAL },
{ "right_address_box", MT_RIGHT_ADDRESS_BOX }, { "right_address_box", MARGIN_RIGHT_ADDRESS_BOX },
{ "static", MT_STATIC } { "static", MARGIN_STATIC }
}; };
#endif
void LyXLayout::readMargin(LyXLex & lexrc) void LyXLayout::readMargin(LyXLex & lexrc)
{ {
pushpophelper pph(lexrc, marginTags, MT_RIGHT_ADDRESS_BOX); #if 1
keyword_item marginTags[] = {
{ "dynamic", MARGIN_DYNAMIC },
{ "first_dynamic", MARGIN_FIRST_DYNAMIC },
{ "manual", MARGIN_MANUAL },
{ "right_address_box", MARGIN_RIGHT_ADDRESS_BOX },
{ "static", MARGIN_STATIC }
};
#endif
pushpophelper pph(lexrc, marginTags, MARGIN_RIGHT_ADDRESS_BOX);
int le = lexrc.lex(); int le = lexrc.lex();
switch(le) { switch(le) {
case LyXLex::LEX_UNDEF: case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown margin type tag `$$Token'"); lexrc.printError("Unknown margin type tag `$$Token'");
return; return;
default: break; case MARGIN_STATIC:
} case MARGIN_MANUAL:
switch(static_cast<MarginTags>(le)) { case MARGIN_DYNAMIC:
case MT_STATIC: case MARGIN_FIRST_DYNAMIC:
margintype = MARGIN_STATIC; case MARGIN_RIGHT_ADDRESS_BOX:
margintype = static_cast<LYX_MARGIN_TYPE>(le);
break; break;
case MT_MANUAL: default:
margintype = MARGIN_MANUAL; lyxerr << "Unhandled value " << le
break; << " in LyXLayout::readMargin." << endl;
case MT_DYNAMIC:
margintype = MARGIN_DYNAMIC;
break;
case MT_FIRST_DYNAMIC:
margintype = MARGIN_FIRST_DYNAMIC;
break;
case MT_RIGHT_ADDRESS_BOX:
margintype = MARGIN_RIGHT_ADDRESS_BOX;
break; break;
} }
} }
enum LatexTypeTags { #if 0
LX_PARAGRAPH = 1,
LX_COMMAND,
LX_ENVIRONMENT,
LX_ITEM_ENVIRONMENT,
LX_LIST_ENVIRONMENT
};
static keyword_item latexTypeTags[] = { static keyword_item latexTypeTags[] = {
{ "command", LX_COMMAND }, { "command", LATEX_COMMAND },
{ "environment", LX_ENVIRONMENT }, { "environment", LATEX_ENVIRONMENT },
{ "item_environment", LX_ITEM_ENVIRONMENT }, { "item_environment", LATEX_ITEM_ENVIRONMENT },
{ "list_environment", LX_LIST_ENVIRONMENT }, { "list_environment", LATEX_LIST_ENVIRONMENT },
{ "paragraph", LX_PARAGRAPH } { "paragraph", LATEX_PARAGRAPH }
}; };
#endif
void LyXLayout::readLatexType(LyXLex & lexrc) void LyXLayout::readLatexType(LyXLex & lexrc)
{ {
pushpophelper pph(lexrc, latexTypeTags, LX_LIST_ENVIRONMENT); #if 1
keyword_item latexTypeTags[] = {
{ "command", LATEX_COMMAND },
{ "environment", LATEX_ENVIRONMENT },
{ "item_environment", LATEX_ITEM_ENVIRONMENT },
{ "list_environment", LATEX_LIST_ENVIRONMENT },
{ "paragraph", LATEX_PARAGRAPH }
};
#endif
pushpophelper pph(lexrc, latexTypeTags, LATEX_LIST_ENVIRONMENT);
int le = lexrc.lex(); int le = lexrc.lex();
switch (le) { switch (le) {
case LyXLex::LEX_UNDEF: case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown latextype tag `$$Token'"); lexrc.printError("Unknown latextype tag `$$Token'");
return; return;
default: break; case LATEX_PARAGRAPH:
} case LATEX_COMMAND:
switch (static_cast<LatexTypeTags>(le)) { case LATEX_ENVIRONMENT:
case LX_PARAGRAPH: case LATEX_ITEM_ENVIRONMENT:
latextype= LATEX_PARAGRAPH; case LATEX_LIST_ENVIRONMENT:
latextype = static_cast<LYX_LATEX_TYPES>(le);
break; break;
case LX_COMMAND: default:
latextype= LATEX_COMMAND; lyxerr << "Unhandled value " << le
break; << " in LyXLayout::readLatexType." << endl;
case LX_ENVIRONMENT:
latextype= LATEX_ENVIRONMENT;
break;
case LX_ITEM_ENVIRONMENT:
latextype= LATEX_ITEM_ENVIRONMENT;
break;
case LX_LIST_ENVIRONMENT:
latextype= LATEX_LIST_ENVIRONMENT;
break; break;
} }
} }
@ -678,16 +753,26 @@ enum SpacingTags {
}; };
#if 0
static keyword_item spacingTags[] = { static keyword_item spacingTags[] = {
{"double", ST_SPACING_DOUBLE }, {"double", ST_SPACING_DOUBLE },
{"onehalf", ST_SPACING_ONEHALF }, {"onehalf", ST_SPACING_ONEHALF },
{"other", ST_OTHER }, {"other", ST_OTHER },
{"single", ST_SPACING_SINGLE } {"single", ST_SPACING_SINGLE }
}; };
#endif
void LyXLayout::readSpacing(LyXLex & lexrc) void LyXLayout::readSpacing(LyXLex & lexrc)
{ {
#if 1
keyword_item spacingTags[] = {
{"double", ST_SPACING_DOUBLE },
{"onehalf", ST_SPACING_ONEHALF },
{"other", ST_OTHER },
{"single", ST_SPACING_SINGLE }
};
#endif
pushpophelper pph(lexrc, spacingTags, ST_OTHER); pushpophelper pph(lexrc, spacingTags, ST_OTHER);
int le = lexrc.lex(); int le = lexrc.lex();
switch(le) { switch(le) {
@ -773,6 +858,7 @@ enum TextClassTags {
}; };
#if 0
static keyword_item textClassTags[] = { static keyword_item textClassTags[] = {
{ "classoptions", TC_CLASSOPTIONS }, { "classoptions", TC_CLASSOPTIONS },
{ "columns", TC_COLUMNS }, { "columns", TC_COLUMNS },
@ -793,11 +879,34 @@ static keyword_item textClassTags[] = {
{ "style", TC_STYLE }, { "style", TC_STYLE },
{ "tocdepth", TC_TOCDEPTH } { "tocdepth", TC_TOCDEPTH }
}; };
#endif
// Reads a textclass structure from file. // Reads a textclass structure from file.
bool LyXTextClass::Read(string const & filename, bool merge) bool LyXTextClass::Read(string const & filename, bool merge)
{ {
#if 1
keyword_item textClassTags[] = {
{ "classoptions", TC_CLASSOPTIONS },
{ "columns", TC_COLUMNS },
{ "defaultfont", TC_DEFAULTFONT },
{ "input", TC_INPUT },
{ "leftmargin", TC_LEFTMARGIN },
{ "maxcounter", TC_MAXCOUNTER },
{ "nostyle", TC_NOSTYLE },
{ "outputtype", TC_OUTPUTTYPE },
{ "pagestyle", TC_PAGESTYLE },
{ "preamble", TC_PREAMBLE },
{ "providesamsmath", TC_PROVIDESAMSMATH },
{ "providesmakeidx", TC_PROVIDESMAKEIDX },
{ "providesurl", TC_PROVIDESURL },
{ "rightmargin", TC_RIGHTMARGIN },
{ "secnumdepth", TC_SECNUMDEPTH },
{ "sides", TC_SIDES },
{ "style", TC_STYLE },
{ "tocdepth", TC_TOCDEPTH }
};
#endif
if (!merge) if (!merge)
lyxerr[Debug::TCLASS] << "Reading textclass " lyxerr[Debug::TCLASS] << "Reading textclass "
<< MakeDisplayPath(filename) << MakeDisplayPath(filename)
@ -972,44 +1081,42 @@ bool LyXTextClass::Read(string const & filename, bool merge)
} }
enum OutputTypeTags { #if 0
OT_OTLATEX = 1,
OT_OTLINUXDOC,
OT_OTDOCBOOK,
OT_OTLITERATE
};
static keyword_item outputTypeTags[] = { static keyword_item outputTypeTags[] = {
{ "docbook", OT_OTDOCBOOK }, { "docbook", DOCBOOK },
{ "latex", OT_OTLATEX }, { "latex", LATEX },
{ "linuxdoc", OT_OTLINUXDOC }, { "linuxdoc", LINUXDOC },
{ "literate", OT_OTLITERATE } { "literate", LITERATE }
}; };
#endif
void LyXTextClass::readOutputType(LyXLex & lexrc) void LyXTextClass::readOutputType(LyXLex & lexrc)
{ {
pushpophelper pph(lexrc, outputTypeTags, OT_OTLITERATE); #if 1
keyword_item outputTypeTags[] = {
{ "docbook", DOCBOOK },
{ "latex", LATEX },
{ "linuxdoc", LINUXDOC },
{ "literate", LITERATE }
};
#endif
pushpophelper pph(lexrc, outputTypeTags, LITERATE);
int le = lexrc.lex(); int le = lexrc.lex();
switch(le) { switch(le) {
case LyXLex::LEX_UNDEF: case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown output type `$$Token'"); lexrc.printError("Unknown output type `$$Token'");
return; return;
default: break; case LATEX:
} case LINUXDOC:
switch(static_cast<OutputTypeTags>(le)) { case DOCBOOK:
case OT_OTLATEX: case LITERATE:
outputType_ = LATEX; outputType_ = static_cast<OutputType>(le);
break; break;
case OT_OTLINUXDOC: default:
outputType_ = LINUXDOC; lyxerr << "Unhandled value " << le
break; << " in LyXTextClass::readOutputType." << endl;
case OT_OTDOCBOOK:
outputType_ = DOCBOOK;
break;
case OT_OTLITERATE:
outputType_ = LITERATE;
break; break;
} }
} }
@ -1029,6 +1136,7 @@ enum MaxCounterTags {
}; };
#if 0
static keyword_item maxCounterTags[] = { static keyword_item maxCounterTags[] = {
{"counter_chapter", MC_COUNTER_CHAPTER }, {"counter_chapter", MC_COUNTER_CHAPTER },
{"counter_enumi", MC_COUNTER_ENUMI }, {"counter_enumi", MC_COUNTER_ENUMI },
@ -1041,10 +1149,25 @@ static keyword_item maxCounterTags[] = {
{"counter_subsection", MC_COUNTER_SUBSECTION }, {"counter_subsection", MC_COUNTER_SUBSECTION },
{"counter_subsubsection", MC_COUNTER_SUBSUBSECTION } {"counter_subsubsection", MC_COUNTER_SUBSUBSECTION }
}; };
#endif
void LyXTextClass::readMaxCounter(LyXLex & lexrc) void LyXTextClass::readMaxCounter(LyXLex & lexrc)
{ {
#if 1
keyword_item maxCounterTags[] = {
{"counter_chapter", MC_COUNTER_CHAPTER },
{"counter_enumi", MC_COUNTER_ENUMI },
{"counter_enumii", MC_COUNTER_ENUMII },
{"counter_enumiii", MC_COUNTER_ENUMIII },
{"counter_enumiv", MC_COUNTER_ENUMIV },
{"counter_paragraph", MC_COUNTER_PARAGRAPH },
{"counter_section", MC_COUNTER_SECTION },
{"counter_subparagraph", MC_COUNTER_SUBPARAGRAPH },
{"counter_subsection", MC_COUNTER_SUBSECTION },
{"counter_subsubsection", MC_COUNTER_SUBSUBSECTION }
};
#endif
pushpophelper pph(lexrc, maxCounterTags, MC_COUNTER_ENUMIV); pushpophelper pph(lexrc, maxCounterTags, MC_COUNTER_ENUMIV);
int le = lexrc.lex(); int le = lexrc.lex();
switch(le) { switch(le) {
@ -1096,16 +1219,26 @@ enum ClassOptionsTags {
}; };
#if 0
static keyword_item classOptionsTags[] = { static keyword_item classOptionsTags[] = {
{"end", CO_END }, {"end", CO_END },
{"fontsize", CO_FONTSIZE }, {"fontsize", CO_FONTSIZE },
{"other", CO_OTHER }, {"other", CO_OTHER },
{"pagestyle", CO_PAGESTYLE } {"pagestyle", CO_PAGESTYLE }
}; };
#endif
void LyXTextClass::readClassOptions(LyXLex & lexrc) void LyXTextClass::readClassOptions(LyXLex & lexrc)
{ {
#if 1
keyword_item classOptionsTags[] = {
{"end", CO_END },
{"fontsize", CO_FONTSIZE },
{"other", CO_OTHER },
{"pagestyle", CO_PAGESTYLE }
};
#endif
lexrc.pushTable(classOptionsTags, CO_END); lexrc.pushTable(classOptionsTags, CO_END);
bool getout = false; bool getout = false;
while (!getout && lexrc.IsOK()) { while (!getout && lexrc.IsOK()) {

View File

@ -42,7 +42,7 @@ enum { // no good name for this
/// The different output types /// The different output types
enum OutputType { enum OutputType {
/// ///
LATEX, LATEX = 1,
/// ///
LINUXDOC, LINUXDOC,
/// ///
@ -54,7 +54,7 @@ enum OutputType {
/// The different margin types /// The different margin types
enum LYX_MARGIN_TYPE { enum LYX_MARGIN_TYPE {
/// ///
MARGIN_MANUAL, MARGIN_MANUAL = 1,
/// ///
MARGIN_FIRST_DYNAMIC, MARGIN_FIRST_DYNAMIC,
/// ///
@ -92,7 +92,7 @@ inline void operator|=(LyXAlignment & la1, LyXAlignment la2) {
/// The different LaTeX-Types /// The different LaTeX-Types
enum LYX_LATEX_TYPES { enum LYX_LATEX_TYPES {
/// ///
LATEX_PARAGRAPH, LATEX_PARAGRAPH = 1,
/// ///
LATEX_COMMAND, LATEX_COMMAND,
/// ///
@ -268,7 +268,7 @@ public:
char labeltype; // add approp. type char labeltype; // add approp. type
/// ///
char margintype; // add approp. type LYX_MARGIN_TYPE margintype;
/// ///
bool fill_top; bool fill_top;

View File

@ -50,7 +50,7 @@ extern "C" void TableSpeCloseCB(FL_OBJECT *, long);
#include "bufferparams.h" #include "bufferparams.h"
extern bool UpdateLayoutDocument(BufferParams *params = 0); extern bool UpdateLayoutDocument(BufferParams * params = 0);
extern bool UpdateLayoutPreamble(); extern bool UpdateLayoutPreamble();
extern bool UpdateLayoutPaper(); extern bool UpdateLayoutPaper();
extern bool UpdateLayoutQuotes(); extern bool UpdateLayoutQuotes();

View File

@ -3549,7 +3549,7 @@ extern "C" void RefHideCB(FL_OBJECT *, long)
// way to do this (and the cleanest for now). This function just inserts // way to do this (and the cleanest for now). This function just inserts
// a newline in the string and the inserts 'depth'-spaces so that the // a newline in the string and the inserts 'depth'-spaces so that the
// code is indented in the right way!!! // code is indented in the right way!!!
void addNewlineAndDepth(string & file, int const depth) void addNewlineAndDepth(string & file, int depth)
{ {
file += '\n'; file += '\n';
file.append(depth, ' '); file.append(depth, ' ');

View File

@ -43,6 +43,7 @@
#include "insets/insetbib.h" #include "insets/insetbib.h"
#include "insets/insettext.h" #include "insets/insettext.h"
#include "insets/insetert.h" #include "insets/insetert.h"
#include "insets/insetgraphics.h"
#include "mathed/formulamacro.h" #include "mathed/formulamacro.h"
#include "toolbar.h" #include "toolbar.h"
#include "spellchecker.h" // RVDK_PATCH_5 #include "spellchecker.h" // RVDK_PATCH_5
@ -117,7 +118,7 @@ extern Buffer * NewLyxFile(string const &);
extern void LoadLyXFile(string const &); extern void LoadLyXFile(string const &);
extern void Reconfigure(BufferView *); extern void Reconfigure(BufferView *);
extern int current_layout; extern LyXTextClass::size_type current_layout;
extern int getISOCodeFromLaTeX(char *); extern int getISOCodeFromLaTeX(char *);
extern void ShowLatexLog(); extern void ShowLatexLog();
@ -835,7 +836,14 @@ string LyXFunc::Dispatch(int ac,
case LFUN_FIGURE: case LFUN_FIGURE:
Figure(); Figure();
break; break;
case LFUN_INSERT_GRAPHICS:
{
Inset * new_inset = new InsetGraphics;
owner->view()->insertInset(new_inset);
break;
}
case LFUN_AUTOSAVE: case LFUN_AUTOSAVE:
AutoSave(); AutoSave();
break; break;
@ -1081,7 +1089,7 @@ string LyXFunc::Dispatch(int ac,
// and current buffer's textclass (number). */ // and current buffer's textclass (number). */
LyXTextClassList::ClassList::size_type tclass = LyXTextClassList::ClassList::size_type tclass =
owner->view()->text->parameters->textclass; owner->view()->text->parameters->textclass;
pair <bool, int> layout = pair <bool, LyXTextClass::size_type> layout =
textclasslist.NumberOfLayout(tclass, argument); textclasslist.NumberOfLayout(tclass, argument);
// If the entry is obsolete, use the new one instead. // If the entry is obsolete, use the new one instead.
@ -1614,20 +1622,28 @@ string LyXFunc::Dispatch(int ac,
// --- text changing commands ------------------------ // --- text changing commands ------------------------
case LFUN_BREAKLINE: case LFUN_BREAKLINE:
#if 1
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->text->InsertChar(LyXParagraph::META_NEWLINE); owner->view()->text->InsertChar(LyXParagraph::META_NEWLINE);
owner->view()->smallUpdate(1); owner->view()->smallUpdate(1);
SetUpdateTimer(0.01); SetUpdateTimer(0.01);
moveCursorUpdate(false); moveCursorUpdate(false);
#else
owner->view()->newline();
#endif
break; break;
case LFUN_PROTECTEDSPACE: case LFUN_PROTECTEDSPACE:
#if 1
owner->view()->protectedBlank();
#else
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->text-> owner->view()->text->
InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR); InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
owner->view()->smallUpdate(1); owner->view()->smallUpdate(1);
SetUpdateTimer(); SetUpdateTimer();
moveCursorUpdate(false); moveCursorUpdate(false);
#endif
break; break;
case LFUN_SETMARK: case LFUN_SETMARK:

View File

@ -78,7 +78,7 @@ public:
/// ///
META_NEWLINE, META_NEWLINE,
/// ///
META_PROTECTED_SEPARATOR, //META_PROTECTED_SEPARATOR,
/// ///
META_INSET META_INSET
}; };
@ -465,8 +465,10 @@ public:
void SetPExtraType(int type, char const * width, char const * widthp); void SetPExtraType(int type, char const * width, char const * widthp);
/// ///
void UnsetPExtraType(); void UnsetPExtraType();
#if 0
/// ///
bool RoffContTableRows(ostream &, size_type i, int actcell); bool RoffContTableRows(ostream &, size_type i, int actcell);
#endif
/// ///
void DocBookContTableRows(string & file, string & extra, int & desc_on, void DocBookContTableRows(string & file, string & extra, int & desc_on,
size_type i, size_type i,

View File

@ -392,7 +392,8 @@ public:
for a list of paragraphs beginning with the specified par for a list of paragraphs beginning with the specified par
return value is the number of wrong conversions return value is the number of wrong conversions
*/ */
int SwitchLayoutsBetweenClasses(char class1, char class2, int SwitchLayoutsBetweenClasses(LyXTextClassList::size_type class1,
LyXTextClassList::size_type class2,
LyXParagraph * par); LyXParagraph * par);
/* for the greater insets */ /* for the greater insets */

View File

@ -330,7 +330,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
int brace = 0; int brace = 0;
int acc_brace = 0; int acc_brace = 0;
int acc_braces[8]; int acc_braces[8];
MathParInset * mt = (mtx) ? *mtx: 0;//(MathParInset*)0; MathParInset * mt = (mtx) ? *mtx : 0;//(MathParInset*)0;
MathedRowSt * crow = (mt) ? mt->getRowSt() : 0; MathedRowSt * crow = (mt) ? mt->getRowSt() : 0;
++plevel; ++plevel;

View File

@ -39,8 +39,6 @@ using std::max;
#include "math_panel.h" #include "math_panel.h"
#include "math_parser.h" #include "math_parser.h"
//extern void Update(signed char);
//extern int UnlockInset(UpdatableInset *);
extern short greek_kb_flag; extern short greek_kb_flag;
extern BufferView * current_view; extern BufferView * current_view;
@ -271,7 +269,7 @@ extern "C" int C_peek_event(FL_FORM *form, void *ptr) {
extern "C" void math_cb(FL_OBJECT* ob, long data) extern "C" void math_cb(FL_OBJECT* ob, long data)
{ {
BitmapMenu* menu = (BitmapMenu*)ob->u_vdata; BitmapMenu * menu = static_cast<BitmapMenu*>(ob->u_vdata);
int i = menu->GetIndex(ob); int i = menu->GetIndex(ob);
char const *s = 0; char const *s = 0;

View File

@ -35,7 +35,7 @@ using std::ios;
#include "texrow.h" #include "texrow.h"
extern void addNewlineAndDepth(string & file, int const depth); // Jug 990923 extern void addNewlineAndDepth(string & file, int depth); // Jug 990923
int tex_code_break_column = 72; // needs non-zero initialization. set later. int tex_code_break_column = 72; // needs non-zero initialization. set later.
// this is a bad idea, but how can LyXParagraph find its buffer to get // this is a bad idea, but how can LyXParagraph find its buffer to get
// parameters? (JMarc) // parameters? (JMarc)
@ -280,10 +280,12 @@ void LyXParagraph::writeFile(ostream & os, BufferParams const & params,
os << "\n\\hfill \n"; os << "\n\\hfill \n";
column = 0; column = 0;
break; break;
#if 0
case META_PROTECTED_SEPARATOR: case META_PROTECTED_SEPARATOR:
os << "\n\\protected_separator \n"; os << "\n\\protected_separator \n";
column = 0; column = 0;
break; break;
#endif
case '\\': case '\\':
os << "\n\\backslash \n"; os << "\n\\backslash \n";
column = 0; column = 0;
@ -297,7 +299,7 @@ void LyXParagraph::writeFile(ostream & os, BufferParams const & params,
break; break;
default: default:
if ((column > 70 && c == ' ') if ((column > 70 && c == ' ')
|| column > 79){ || column > 79) {
os << "\n"; os << "\n";
column = 0; column = 0;
} }
@ -1566,7 +1568,7 @@ void LyXParagraph::CloseFootnote(LyXParagraph::size_type pos)
} }
LyXTextClass::LayoutList::size_type LyXParagraph::GetLayout() const LyXTextClass::size_type LyXParagraph::GetLayout() const
{ {
return FirstPhysicalPar()->layout; return FirstPhysicalPar()->layout;
} }
@ -1614,7 +1616,7 @@ void LyXParagraph::SetLabelWidthString(string const & s)
} }
void LyXParagraph::SetOnlyLayout(LyXTextClass::LayoutList::size_type new_layout) void LyXParagraph::SetOnlyLayout(LyXTextClass::size_type new_layout)
{ {
LyXParagraph * par = FirstPhysicalPar(); LyXParagraph * par = FirstPhysicalPar();
LyXParagraph * ppar = 0; LyXParagraph * ppar = 0;
@ -1659,7 +1661,7 @@ void LyXParagraph::SetOnlyLayout(LyXTextClass::LayoutList::size_type new_layout)
} }
void LyXParagraph::SetLayout(LyXTextClass::LayoutList::size_type new_layout) void LyXParagraph::SetLayout(LyXTextClass::size_type new_layout)
{ {
LyXParagraph LyXParagraph
* par = FirstPhysicalPar(), * par = FirstPhysicalPar(),
@ -1726,7 +1728,8 @@ int LyXParagraph::BeginningOfMainBody() const
// remove unnecessary GetChar() calls // remove unnecessary GetChar() calls
size_type i = 0; size_type i = 0;
if (i < size() if (i < size()
&& GetChar(i) != LyXParagraph::META_NEWLINE) { && GetChar(i) != LyXParagraph::META_NEWLINE
) {
++i; ++i;
char previous_char, temp; char previous_char, temp;
if (i < size() if (i < size()
@ -2054,15 +2057,15 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow)
if (table) if (table)
return SimpleTeXOneTablePar(file, texrow); return SimpleTeXOneTablePar(file, texrow);
char c;
size_type main_body;
bool return_value = false; bool return_value = false;
LyXLayout const & style = textclasslist.Style(current_view->buffer()->params.textclass, GetLayout()); LyXLayout const & style =
textclasslist.Style(current_view->buffer()->params.textclass,
GetLayout());
LyXFont basefont, last_font; LyXFont basefont, last_font;
// Maybe we have to create a optional argument. // Maybe we have to create a optional argument.
size_type main_body;
if (style.labeltype != LABEL_MANUAL) if (style.labeltype != LABEL_MANUAL)
main_body = 0; main_body = 0;
else else
@ -2144,7 +2147,7 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow)
} }
} }
c = GetChar(i); int c = GetChar(i);
// Fully instantiated font // Fully instantiated font
LyXFont font = getFont(i); LyXFont font = getFont(i);
@ -2505,9 +2508,11 @@ bool LyXParagraph::linuxDocConvertChar(char c, string & sgml_string)
case LyXParagraph::META_HFILL: case LyXParagraph::META_HFILL:
sgml_string.clear(); sgml_string.clear();
break; break;
#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR: case LyXParagraph::META_PROTECTED_SEPARATOR:
sgml_string = ' '; sgml_string = ' ';
break; break;
#endif
case LyXParagraph::META_NEWLINE: case LyXParagraph::META_NEWLINE:
sgml_string = '\n'; sgml_string = '\n';
break; break;
@ -2976,10 +2981,11 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
// but I'll leave it as a switch statement // but I'll leave it as a switch statement
// so its simpler to extend. (ARRae) // so its simpler to extend. (ARRae)
switch (c) { switch (c) {
#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR: case LyXParagraph::META_PROTECTED_SEPARATOR:
file += ' '; file += ' ';
break; break;
#endif
default: default:
// make sure that we will not print // make sure that we will not print
// error generating chars to the tex // error generating chars to the tex
@ -2994,10 +3000,11 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
} else { } else {
// Plain mode (i.e. not LaTeX) // Plain mode (i.e. not LaTeX)
switch (c) { switch (c) {
#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR: case LyXParagraph::META_PROTECTED_SEPARATOR:
file += '~'; file += '~';
break; break;
#endif
case '\\': case '\\':
file += "\\textbackslash{}"; file += "\\textbackslash{}";
column += 15; column += 15;
@ -3169,6 +3176,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
} }
#if 0
bool LyXParagraph::RoffContTableRows(ostream & os, bool LyXParagraph::RoffContTableRows(ostream & os,
LyXParagraph::size_type i, LyXParagraph::size_type i,
int actcell) int actcell)
@ -3209,6 +3217,34 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
switch (c) { switch (c) {
case LyXParagraph::META_INSET: case LyXParagraph::META_INSET:
if ((inset = GetInset(i))) { if ((inset = GetInset(i))) {
#if 1
#ifdef HAVE_SSTREAM
stringstream ss(ios::in | ios::out);
inset->Latex(ss, -1);
ss.seekp(0);
ss.get(c);
while (!ss) {
if (c == '\\')
os << "\\\\";
else
os << c;
ss.get(c);
}
#else
strstream ss;
inset->Latex(ss, -1);
ss.seekp(0);
ss.get(c);
while (!ss) {
if (c == '\\')
os << "\\\\";
else
os << c;
ss.get(c);
}
delete [] ss.str();
#endif
#else
fstream fs(fname2.c_str(), fstream fs(fname2.c_str(),
ios::in|ios::out); ios::in|ios::out);
if (!fs) { if (!fs) {
@ -3228,14 +3264,17 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
fs.get(c); fs.get(c);
} }
fs.close(); fs.close();
#endif
} }
break; break;
case LyXParagraph::META_NEWLINE: case LyXParagraph::META_NEWLINE:
break; break;
case LyXParagraph::META_HFILL: case LyXParagraph::META_HFILL:
break; break;
#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR: case LyXParagraph::META_PROTECTED_SEPARATOR:
break; break;
#endif
case '\\': case '\\':
os << "\\\\"; os << "\\\\";
break; break;
@ -3253,6 +3292,7 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
} }
return true; return true;
} }
#endif
LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow, LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow,
@ -3575,8 +3615,9 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
"No footnote!" << endl; "No footnote!" << endl;
LyXParagraph * par = this; LyXParagraph * par = this;
LyXLayout const & style = textclasslist.Style(current_view->buffer()->params.textclass, LyXLayout const & style =
previous->GetLayout()); textclasslist.Style(current_view->buffer()->params.textclass,
previous->GetLayout());
if (style.needprotect && footnotekind != LyXParagraph::FOOTNOTE){ if (style.needprotect && footnotekind != LyXParagraph::FOOTNOTE){
lyxerr << "ERROR (LyXParagraph::TeXFootnote): " lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
@ -3702,8 +3743,10 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
// Process text for all floats except footnotes in body // Process text for all floats except footnotes in body
do { do {
LyXLayout const & style = LyXLayout const & style =
textclasslist.Style(current_view->buffer()->params.textclass, textclasslist
par->layout); .Style(current_view->buffer()->params
.textclass,
par->layout);
if (par->IsDummy()) if (par->IsDummy())
lyxerr << "ERROR (LyXParagraph::TeXFootnote)" lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
<< endl; << endl;
@ -3737,8 +3780,10 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
int dummy_count = 0; int dummy_count = 0;
do { do {
LyXLayout const & style = LyXLayout const & style =
textclasslist.Style(current_view->buffer()->params.textclass, textclasslist
par->layout); .Style(current_view->buffer()->params
.textclass,
par->layout);
if (par->IsDummy()) if (par->IsDummy())
lyxerr << "ERROR (LyXParagraph::TeXFootnote)" lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
<< endl; << endl;

View File

@ -205,7 +205,7 @@ void back(string cmd, int retval)
} }
int main(int, char**) int main(int, char **)
{ {
SystemcallsSingletoncontroller::Startcontroller starter; SystemcallsSingletoncontroller::Startcontroller starter;

View File

@ -14,31 +14,43 @@
#include <cctype> #include <cctype>
/// ///
inline bool IsNewlineChar(char c) { inline
bool IsNewlineChar(char c) {
return (c == LyXParagraph::META_NEWLINE); return (c == LyXParagraph::META_NEWLINE);
} }
/// ///
inline bool IsSeparatorChar(char c) { #if 0
inline
bool IsSeparatorChar(char c) {
return (c == ' ' || c == LyXParagraph::META_PROTECTED_SEPARATOR); return (c == ' ' || c == LyXParagraph::META_PROTECTED_SEPARATOR);
} }
#else
inline
bool IsSeparatorChar(char c) {
return (c == ' ');
}
#endif
/// ///
inline bool IsHfillChar(char c) { inline
bool IsHfillChar(char c) {
return (c == LyXParagraph::META_HFILL); return (c == LyXParagraph::META_HFILL);
} }
/// ///
inline bool IsInsetChar(char c) { inline
bool IsInsetChar(char c) {
return (c == LyXParagraph::META_INSET); return (c == LyXParagraph::META_INSET);
} }
/// ///
inline bool IsFloatChar(char c) { inline
bool IsFloatChar(char c) {
return (c == LyXParagraph::META_FOOTNOTE return (c == LyXParagraph::META_FOOTNOTE
|| c == LyXParagraph::META_MARGIN || c == LyXParagraph::META_MARGIN
|| c == LyXParagraph::META_FIG || c == LyXParagraph::META_FIG
@ -50,13 +62,15 @@ inline bool IsFloatChar(char c) {
/// ///
inline bool IsLineSeparatorChar(char c) { inline
bool IsLineSeparatorChar(char c) {
return (c == ' '); return (c == ' ');
} }
/// ///
inline bool IsKommaChar(char c) { inline
bool IsKommaChar(char c) {
return (c == ',' return (c == ','
|| c == '(' || c == '('
|| c == ')' || c == ')'
@ -81,13 +95,16 @@ inline bool IsKommaChar(char c) {
|| c == '/' || c == '/'
|| c == '\\' || c == '\\'
|| c == LyXParagraph::META_NEWLINE || c == LyXParagraph::META_NEWLINE
#if 0
|| c == LyXParagraph::META_PROTECTED_SEPARATOR || c == LyXParagraph::META_PROTECTED_SEPARATOR
#endif
); );
} }
/// ///
inline bool IsLetterChar(unsigned char c) { inline
bool IsLetterChar(unsigned char c) {
return ((c >= 'A' && c <= 'Z') return ((c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z') || (c >= 'a' && c <= 'z')
|| (c >= 192)); // in iso-8859-x these are accented chars || (c >= 192)); // in iso-8859-x these are accented chars
@ -95,23 +112,26 @@ inline bool IsLetterChar(unsigned char c) {
/// ///
inline bool IsPrintable(unsigned char c) { inline
bool IsPrintable(unsigned char c) {
return (c >= ' '); return (c >= ' ');
} }
/// Word is not IsSeparator or IsKomma or IsHfill or IsFloat or IsInset. /// Word is not IsSeparator or IsKomma or IsHfill or IsFloat or IsInset.
inline bool IsWordChar(unsigned char c) { inline
return !( IsSeparatorChar( c ) bool IsWordChar(unsigned char c) {
|| IsKommaChar( c ) return !( IsSeparatorChar( c )
|| IsHfillChar( c ) || IsKommaChar( c )
|| IsFloatChar( c ) || IsHfillChar( c )
|| IsInsetChar( c ) ) ; || IsFloatChar( c )
|| IsInsetChar( c ) ) ;
} }
/// ///
inline bool IsLetterCharOrDigit(char ch) inline
bool IsLetterCharOrDigit(char ch)
{ {
return IsLetterChar(ch) || isdigit(ch); return IsLetterChar(ch) || isdigit(ch);
} }

View File

@ -24,7 +24,7 @@ using std::max;
#pragma implementation #pragma implementation
#endif #endif
extern void addNewlineAndDepth(string & file, int const depth); // Jug 990923 extern void addNewlineAndDepth(string & file, int depth); // Jug 990923
static int const WIDTH_OF_LINE = 5; static int const WIDTH_OF_LINE = 5;
@ -1289,6 +1289,7 @@ int LyXTable::TexEndOfCell(string & file, int cell)
} }
#if 0
// cell <0 will tex the preamble // cell <0 will tex the preamble
// returns the number of printed newlines // returns the number of printed newlines
int LyXTable::RoffEndOfCell(ostream & os, int cell) int LyXTable::RoffEndOfCell(ostream & os, int cell)
@ -1381,6 +1382,7 @@ int LyXTable::RoffEndOfCell(ostream & os, int cell)
} }
return ret; return ret;
} }
#endif
char const *LyXTable::getDocBookAlign(int cell, bool isColumn) char const *LyXTable::getDocBookAlign(int cell, bool isColumn)

View File

@ -166,8 +166,10 @@ public:
// returns the number of printed newlines // returns the number of printed newlines
/// ///
int TexEndOfCell(string & file, int cell); int TexEndOfCell(string & file, int cell);
#if 0
/// ///
int RoffEndOfCell(ostream &, int cell); int RoffEndOfCell(ostream &, int cell);
#endif
/// ///
char const * getDocBookAlign(int cell, bool isColumn = false); char const * getDocBookAlign(int cell, bool isColumn = false);
/// ///

View File

@ -1826,7 +1826,7 @@ void LyXText::TableFeatures(int feature) const
int cell = 0; int cell = 0;
do{ do{
if (pos && (cursor.par->IsNewline(pos-1))){ if (pos && (cursor.par->IsNewline(pos-1))){
if (cursor.par->table->AppendCellAfterCell(cell_org, cell)){ if (cursor.par->table->AppendCellAfterCell(cell_org, cell)) {
cursor.par->InsertChar(pos, LyXParagraph::META_NEWLINE); cursor.par->InsertChar(pos, LyXParagraph::META_NEWLINE);
if (pos <= cursor.pos) if (pos <= cursor.pos)
cursor.pos++; cursor.pos++;
@ -1837,7 +1837,7 @@ void LyXText::TableFeatures(int feature) const
++pos; ++pos;
} while (pos <= cursor.par->Last()); } while (pos <= cursor.par->Last());
/* remember that the very last cell doesn't end with a newline. /* remember that the very last cell doesn't end with a newline.
This saves one byte memory per table ;-) */ This saves one byte memory per table ;-) */
if (cursor.par->table->AppendCellAfterCell(cell_org, cell)) if (cursor.par->table->AppendCellAfterCell(cell_org, cell))
cursor.par->InsertChar(cursor.par->Last(), LyXParagraph::META_NEWLINE); cursor.par->InsertChar(cursor.par->Last(), LyXParagraph::META_NEWLINE);
@ -2383,7 +2383,7 @@ void LyXText::RedoParagraph() const
/* insert a character, moves all the following breaks in the /* insert a character, moves all the following breaks in the
* same Paragraph one to the right and make a rebreak */ * same Paragraph one to the right and make a rebreak */
void LyXText::InsertChar(char c) void LyXText::InsertChar(char c)
{ {
SetUndo(Undo::INSERT, SetUndo(Undo::INSERT,
cursor.par->ParFromPos(cursor.pos)->previous, cursor.par->ParFromPos(cursor.pos)->previous,
@ -2391,14 +2391,18 @@ void LyXText::InsertChar(char c)
/* 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. */ * all spaces are converted to protected spaces. */
#warning think about this
#if 0
bool freeSpacingBo = bool freeSpacingBo =
textclasslist.Style(parameters->textclass, textclasslist.Style(parameters->textclass,
cursor.row->par->GetLayout()).free_spacing; cursor.row->par->GetLayout()).free_spacing;
if (freeSpacingBo && IsLineSeparatorChar(c) if (freeSpacingBo && IsLineSeparatorChar(c)
&& (!cursor.pos || cursor.par->IsLineSeparator(cursor.pos - 1))) && (!cursor.pos || cursor.par->IsLineSeparator(cursor.pos - 1))) {
c = LyXParagraph::META_PROTECTED_SEPARATOR; c = LyXParagraph::META_PROTECTED_SEPARATOR;
}
#endif
/* table stuff -- begin*/ /* table stuff -- begin*/
if (cursor.par->table) { if (cursor.par->table) {
InsertCharInTable(c); InsertCharInTable(c);
@ -3942,8 +3946,10 @@ void LyXText::GetVisibleRow(int offset,
} else if (row_ptr->par->IsSeparator(pos)) { } else if (row_ptr->par->IsSeparator(pos)) {
tmpx = x; tmpx = x;
x+= SingleWidth(row_ptr->par, pos); x+= SingleWidth(row_ptr->par, pos);
/* -------> Only draw protected spaces when not in #warning Think about this.
* free-spacing mode. */ #if 0
/* -------> Only draw protected spaces when
* not in free-spacing mode. */
if (row_ptr->par->GetChar(pos) == LyXParagraph::META_PROTECTED_SEPARATOR && !layout.free_spacing) { if (row_ptr->par->GetChar(pos) == LyXParagraph::META_PROTECTED_SEPARATOR && !layout.free_spacing) {
pain.line(int(tmpx), pain.line(int(tmpx),
offset + row_ptr->baseline - 3, offset + row_ptr->baseline - 3,
@ -3973,6 +3979,7 @@ void LyXText::GetVisibleRow(int offset,
offset + row_ptr->baseline + 2); offset + row_ptr->baseline + 2);
} }
} }
#endif
++vpos; ++vpos;
} else } else
draw(row_ptr, vpos, offset, x); draw(row_ptr, vpos, offset, x);
@ -4079,8 +4086,10 @@ void LyXText::GetVisibleRow(int offset,
x+= SingleWidth(row_ptr->par, pos); x+= SingleWidth(row_ptr->par, pos);
if (pos >= main_body) if (pos >= main_body)
x+= fill_separator; x+= fill_separator;
/* -------> Only draw protected spaces when not in #warning Think about this
* free-spacing mode. */ #if 0
/* -------> Only draw protected spaces when
* not in free-spacing mode. */
if (row_ptr->par->GetChar(pos) == LyXParagraph::META_PROTECTED_SEPARATOR && !layout.free_spacing) { if (row_ptr->par->GetChar(pos) == LyXParagraph::META_PROTECTED_SEPARATOR && !layout.free_spacing) {
pain.line(int(tmpx), pain.line(int(tmpx),
@ -4111,6 +4120,7 @@ void LyXText::GetVisibleRow(int offset,
offset + row_ptr->baseline + 2); offset + row_ptr->baseline + 2);
} }
} }
#endif
++vpos; ++vpos;
} else } else
draw(row_ptr, vpos, offset, x); draw(row_ptr, vpos, offset, x);
@ -4142,7 +4152,7 @@ int LyXText::GetColumnNearX(Row * row, int & x) const
LyXParagraph::size_type c; LyXParagraph::size_type c;
LyXLayout const & layout = textclasslist.Style(parameters->textclass, LyXLayout const & layout = textclasslist.Style(parameters->textclass,
row->par->GetLayout()); row->par->GetLayout());
/* table stuff -- begin */ /* table stuff -- begin */
if (row->par->table) { if (row->par->table) {
if (row->next && row->next->par == row->par //the last row doesn't need a newline at the end if (row->next && row->next->par == row->par //the last row doesn't need a newline at the end
@ -4356,11 +4366,17 @@ void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind)
|| kind == LyXParagraph::WIDE_TAB || kind == LyXParagraph::WIDE_TAB
|| kind == LyXParagraph::WIDE_FIG || kind == LyXParagraph::WIDE_FIG
|| kind == LyXParagraph::ALGORITHM) { || kind == LyXParagraph::ALGORITHM) {
int lay = textclasslist.NumberOfLayout(parameters->textclass, pair<bool, LyXTextClass::size_type> lres =
"Caption").second; textclasslist.NumberOfLayout(parameters->textclass,
if (lay == -1) // layout not found "Caption");
// use default layout "Standard" (0) LyXTextClass::size_type lay;
lay = 0; if (lres.first) {
// layout fount
lay = lres.second;
} else {
// layout not found
lay = 0; // use default layout "Standard" (0)
}
tmppar->SetLayout(lay); tmppar->SetLayout(lay);
} }
} }

View File

@ -22,6 +22,7 @@
#include "lyxparagraph.h" #include "lyxparagraph.h"
#include "insets/inseterror.h" #include "insets/inseterror.h"
#include "insets/insetbib.h" #include "insets/insetbib.h"
#include "insets/insetspecialchar.h"
#include "layout.h" #include "layout.h"
#include "LyXView.h" #include "LyXView.h"
#include "support/textutils.h" #include "support/textutils.h"
@ -439,11 +440,11 @@ void LyXText::CloseFootnote()
// Asger is not sure we want to do this... // Asger is not sure we want to do this...
void LyXText::MakeFontEntriesLayoutSpecific(LyXParagraph * par) void LyXText::MakeFontEntriesLayoutSpecific(LyXParagraph * par)
{ {
LyXFont layoutfont, tmpfont;
LyXLayout const & layout = LyXLayout const & layout =
textclasslist.Style(parameters->textclass, par->GetLayout()); textclasslist.Style(parameters->textclass, par->GetLayout());
LyXFont layoutfont, tmpfont;
for (LyXParagraph::size_type pos = 0; for (LyXParagraph::size_type pos = 0;
pos < par->Last(); ++pos) { pos < par->Last(); ++pos) {
if (pos < BeginningOfMainBody(par)) if (pos < BeginningOfMainBody(par))
@ -459,7 +460,7 @@ void LyXText::MakeFontEntriesLayoutSpecific(LyXParagraph * par)
// set layout over selection and make a total rebreak of those paragraphs // set layout over selection and make a total rebreak of those paragraphs
void LyXText::SetLayout(LyXTextClass::size_type layout) void LyXText::SetLayout(LyXTextClass::size_type layout)
{ {
LyXCursor tmpcursor; LyXCursor tmpcursor;
@ -694,7 +695,7 @@ void LyXText::DecDepth()
// set font over selection and make a total rebreak of those paragraphs // set font over selection and make a total rebreak of those paragraphs
void LyXText::SetFont(LyXFont const & font, bool toggleall) void LyXText::SetFont(LyXFont const & font, bool toggleall)
{ {
// if there is no selection just set the current_font // if there is no selection just set the current_font
if (!selection) { if (!selection) {
@ -1472,8 +1473,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
if (par->labelwidthstring.empty()) { if (par->labelwidthstring.empty()) {
par->SetLabelWidthString(layout.labelstring()); par->SetLabelWidthString(layout.labelstring());
} }
} } else {
else {
par->SetLabelWidthString(string()); par->SetLabelWidthString(string());
} }
@ -2574,7 +2574,7 @@ void LyXText::InsertStringA(char const * s)
SetCursorParUndo(); SetCursorParUndo();
char flag = bool flag =
textclasslist.Style(parameters->textclass, textclasslist.Style(parameters->textclass,
cursor.par->GetLayout()).isEnvironment(); cursor.par->GetLayout()).isEnvironment();
// only to be sure, should not be neccessary // only to be sure, should not be neccessary
@ -2604,11 +2604,23 @@ void LyXText::InsertStringA(char const * s)
++pos; ++pos;
} }
} else if (str[i] == ' ') { } else if (str[i] == ' ') {
#if 1
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
par->InsertInset(pos, new_inset);
#else
par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR); par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR);
#endif
++pos; ++pos;
} else if (str[i] == '\t') { } else if (str[i] == '\t') {
for (a = pos; a < (pos / 8 + 1) * 8 ; ++a) { for (a = pos; a < (pos / 8 + 1) * 8 ; ++a) {
#if 1
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
par->InsertInset(pos, new_inset);
#else
par->InsertChar(a, LyXParagraph::META_PROTECTED_SEPARATOR); par->InsertChar(a, LyXParagraph::META_PROTECTED_SEPARATOR);
#endif
} }
pos = a; pos = a;
} else if (str[i]!= 13 && } else if (str[i]!= 13 &&
@ -2630,6 +2642,7 @@ void LyXText::InsertStringA(char const * s)
cell = NumberOfCell(par, pos); cell = NumberOfCell(par, pos);
while((pos < par->size()) && while((pos < par->size()) &&
!(par->table->IsFirstCell(cell))) { !(par->table->IsFirstCell(cell))) {
while((pos < par->size()) && while((pos < par->size()) &&
(par->GetChar(pos) != LyXParagraph::META_NEWLINE)) (par->GetChar(pos) != LyXParagraph::META_NEWLINE))
++pos; ++pos;
@ -2641,7 +2654,13 @@ void LyXText::InsertStringA(char const * s)
break; break;
} else { } else {
if (!par->text.size()) { if (!par->text.size()) {
#if 1
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
par->InsertInset(pos, new_inset);
#else
par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR); par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR);
#endif
++pos; ++pos;
} }
par->BreakParagraph(pos, flag); par->BreakParagraph(pos, flag);
@ -2753,7 +2772,8 @@ bool LyXText::GotoNextNote() const
} }
int LyXText::SwitchLayoutsBetweenClasses(char class1, char class2, int LyXText::SwitchLayoutsBetweenClasses(LyXTextClassList::size_type class1,
LyXTextClassList::size_type class2,
LyXParagraph * par) LyXParagraph * par)
{ {
int ret = 0; int ret = 0;