+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>
* src/lyxtext.h: change SetLayout() to take a
* lib/layouts/llncs.layout: new layout, contributed by Martin
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>
* src/insets/insettext.C (LocalDispatch): remove extra break
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
case $gxx_version in
- 2.7*) CXXFLAGS="$lyx_opt";;
2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
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";;
*) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
esac
if test x$with_warnings = xyes ; then
case $gxx_version in
2.95.*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
+ 2.96*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
*) CXXFLAGS="$CXXFLAGS -ansi -Wall -W";;
esac
if test $lyx_devel_version = yes ; then
case $gxx_version in
2.95.*) ;;
+ 2.96*) ;;
*) CXXFLAGS="$CXXFLAGS -pedantic";;
esac
fi
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
case $gxx_version in
- 2.7*) CXXFLAGS="$lyx_opt";;
2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
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";;
*) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";;
esac
if test x$with_warnings = xyes ; then
case $gxx_version in
2.95.*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
+ 2.96*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
*) CXXFLAGS="$CXXFLAGS -ansi -Wall -W";;
esac
if test $lyx_devel_version = yes ; then
case $gxx_version in
2.95.*) ;;
+ 2.96*) ;;
*) CXXFLAGS="$CXXFLAGS -pedantic";;
esac
fi
{\settowidth{\labelwidth}{#1}
\setlength{\leftmargin}{\labelwidth}
\addtolength{\leftmargin}{\labelsep}
- \renewcommand{\makelabel}[1]{##1 \hfill}}}
+ \renewcommand{\makelabel}[1]{\makebox[\labelwidth][l]{##1}}}}
{\end{list}}
EndPreamble
}
-void BufferView::trippleClick(int /*x*/, int /*y*/, unsigned int button)
+void BufferView::tripleClick(int /*x*/, int /*y*/, unsigned int button)
{
// select a line
if (buffer_ && screen && button == 1) {
///
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_;
///
update(-1);
}
- int lay = textclasslist.NumberOfLayout(buffer()->params.textclass,
- lout).second;
- if (lay == -1) // layout not found
- // use default layout "Standard" (0)
+ pair<bool, LyXTextClass::size_type> lres =
+ textclasslist.NumberOfLayout(buffer()->params
+ .textclass, lout);
+ LyXTextClass::size_type lay;
+ if (lres.first != false) {
+ // layout found
+ lay = lres.second;
+ } else {
+ // layout not fount using default "Standard" (0)
lay = 0;
-
+ }
+
text->SetLayout(lay);
text->SetParagraph(0, 0,
if (available()) {
hideCursor();
update(-2);
+#if 0
+ InsetSpecialChar * new_inset =
+ new InsetSpecialChar(InsetSpecialChar::NEWLINE);
+ insertInset(new_inset);
+#else
text->InsertChar(LyXParagraph::META_NEWLINE);
update(-1);
+#endif
}
}
if (available()) {
hideCursor();
update(-2);
+#if 1
+ InsetSpecialChar * new_inset =
+ new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
+ insertInset(new_inset);
+#else
text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
update(-1);
+#endif
}
}
//@{
///
bool color; // color.sty
+#ifdef USE_GRAPHICX
+ ///
+ bool graphicx; // graphicx.sty
+#else
///
bool graphics; // graphics.sty
+#endif
///
bool setspace; // setspace.sty
///
{ LFUN_INSET_ERT, "ert-inset-insert",
N_("Insert a new ERT Inset"), 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_ASCII, "file-insert-ascii", "", Noop },
{ LFUN_FILE_NEW, "file-new", "", NoBuffer },
extern void AutoSave();
extern char updatetimer;
extern void QuitLyX();
-int current_layout = 0;
+LyXTextClass::size_type current_layout = 0;
// This is very temporary
BufferView * current_view;
// Done by the raw callback:
// case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break;
case FL_FOCUS:
- lyxerr.debug() << "Workarea event: FOCUS" << endl;
+ lyxerr << "Workarea event: FOCUS" << endl;
break;
case FL_UNFOCUS:
- lyxerr.debug() << "Workarea event: UNFOCUS" << endl;
+ lyxerr << "Workarea event: UNFOCUS" << endl;
break;
case FL_ENTER:
- lyxerr.debug() << "Workarea event: ENTER" << endl;
+ lyxerr << "Workarea event: ENTER" << endl;
break;
case FL_LEAVE:
- lyxerr.debug() << "Workarea event: LEAVE" << endl;
+ lyxerr << "Workarea event: LEAVE" << endl;
break;
case FL_DBLCLICK:
if (!ev) break;
case FL_TRPLCLICK:
if (!ev) break;
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.button);
break;
#include "insets/figinset.h"
#include "insets/insettext.h"
#include "insets/insetert.h"
+#include "insets/insetgraphics.h"
#include "support/filetools.h"
#include "support/path.h"
#include "LaTeX.h"
par->layout = 0;
}
// Test whether the layout is obsolete.
- LyXLayout const & layout = textclasslist.Style(params.textclass,
- par->layout);
+ LyXLayout const & layout =
+ textclasslist.Style(params.textclass,
+ par->layout);
if (!layout.obsoleted_by().empty())
par->layout =
textclasslist.NumberOfLayout(params.textclass,
if (tmptok == "Quotes") {
inset = new InsetQuotes;
inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
+ par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "\\i") {
inset = new InsetLatexAccent;
inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
+ par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "FormulaMacro") {
inset = new InsetFormulaMacro;
inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
+ par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Formula") {
inset = new InsetFormula;
inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
+ par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Figure") {
inset = new InsetFig(100, 100, this);
inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
+ par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Info") {
inset = new InsetInfo;
inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
+ par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Include") {
inset = new InsetInclude(string(), this);
inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
+ par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "ERT") {
inset = new InsetERT(this);
inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
+ par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Text") {
inset = new InsetText(this);
inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
+ par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++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") {
InsetCommand inscmd;
inscmd.Read(lex);
inset = new InsetRef(inscmd, this);
}
#warning Verify that this else clause is still needed. (Lgb)
+#if 0
// This condition comes from a
// temporary solution to the latexdel
// ref inset that was transformed to
cmdname += "{" + opt + "}";
inset = new InsetRef(cmdname, this);
}
+#endif
} else if (inscmd.getCmdName() == "tableofcontents") {
inset = new InsetTOC(this);
} else if (inscmd.getCmdName() == "listoffigures") {
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
- } else if (token == "\\newline") {
+ } else if (token == "\\newline") { // soon obsolete
+#if 1
par->InsertChar(pos, LyXParagraph::META_NEWLINE);
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;
} else if (token == "\\LyXTable") {
par->table = new LyXTable(lex);
par->InsertChar(pos, LyXParagraph::META_HFILL);
par->SetFont(pos, font);
++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->SetFont(pos, font);
+#endif
++pos;
} else if (token == "\\bibitem") { // ale970302
if (!par->bibkey)
c = par->GetChar(i);
if (c == LyXParagraph::META_INSET) {
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());
if (!fs) {
WriteFSAlert(_("Error: Cannot open temporary file:"), fname1);
}
inset->Latex(fs, -1);
h += fs.tellp() - 1;
- remove(fname1.c_str());
+ ::remove(fname1.c_str());
+#endif
}
} else if (c == LyXParagraph::META_NEWLINE) {
if (clen[j] < h)
case LyXParagraph::META_HFILL:
ofs << "\t";
break;
+#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR:
ofs << " ";
break;
+#endif
case '\\':
ofs << "\\";
break;
if (par->IsDummy())
lyxerr[Debug::LATEX] << "Error in MakeLateXFile."
<< endl;
- LyXLayout const & layout = textclasslist.Style(params.textclass,
- par->layout);
+ LyXLayout const & layout =
+ textclasslist.Style(params.textclass,
+ par->layout);
if (layout.intitle) {
if (already_title) {
}
while (par) {
- int desc_on= 0; /* description mode*/
- LyXLayout const & style = textclasslist.Style(users->buffer()->params.textclass,
- par->layout);
+ int desc_on = 0; /* description mode*/
+ LyXLayout const & style =
+ textclasslist.Style(users->buffer()->params.textclass,
+ par->layout);
par->AutoDeleteInsets();
/* environment tag closing */
}
+#if 0
void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
{
LyXFont font1(LyXFont::ALL_INHERIT);
switch (c) {
case LyXParagraph::META_INSET:
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);
if (!fs) {
WriteAlert(_("LYX_ERROR:"),
fs >> c;
}
fs.close();
+#endif
}
break;
case LyXParagraph::META_NEWLINE:
break;
case LyXParagraph::META_HFILL:
break;
+#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR:
break;
+#endif
case '\\':
ofs << "\\\\";
break;
ifs.close();
remove(fname2.c_str());
}
+#endif
/// changed Heinrich Bauer, 23/03/98
/// LinuxDoc.
void pop_tag(ostream & os, char const * tag,
int & pos, char stack[5][3]);
-
+
+#if 0
///
void RoffAsciiTable(ostream &, LyXParagraph * par);
-
+#endif
+
/// is save needed
mutable bool lyx_clean;
LFUN_RTL, // Dekel 20000203
LFUN_INSET_TEXT, // Jug 20000214
LFUN_INSET_ERT, // Jug 20000218
+ LFUN_INSERT_GRAPHICS, // Lgb 20000226
LFUN_LASTACTION /* this marks the end of the table */
};
--- /dev/null
+// -*- 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
inseterror.h \
insetert.C \
insetert.h \
+ insetgraphics.C \
+ insetgraphics.h \
insetinclude.C \
insetinclude.h \
insetindex.C \
// query current colormap
XColor * cmap = new XColor[gs_allcolors];
for (i = 0; i < gs_allcolors; ++i) cmap[i].pixel = i;
-#if 1
- XQueryColors(tmpdisp, fl_state[fl_get_vclass()].colormap, cmap, gs_allcolors);
-#else
- XQueryColors(tmpdisp, color_map, cmap, gs_allcolors);
-#endif
+ XQueryColors(tmpdisp,
+ fl_state[fl_get_vclass()]
+ .colormap, cmap,
+ gs_allcolors);
XFlush(tmpdisp);
wid1 = p->wid - 1;
// now we process all the image
}
-static void AllocColors(int num)
+static
+void AllocColors(int num)
// allocate color cube numxnumxnum, if possible
{
if (lyxerr.debugging()) {
}
-static void freefigdata(figdata * tmpdata)
+static
+void freefigdata(figdata * tmpdata)
{
tmpdata->ref--;
if (tmpdata->ref) return;
}
-static void runqueue()
+static
+void runqueue()
{
// run queued requests for ghostscript, if any
if (!gsrunning && gs_color && !gs_xcolor) {
}
-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
queue_element p;
}
-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 raw_wid, int raw_hgh, float angle, char flags)
{
}
// add inset figures[i]->inset into to_update list
current_view->pushIntoUpdateList(figures[i]->inset);
-
- //PutInsetIntoInsetUpdateList(figures[i]->inset);
}
}
}
-static void getbitmaps()
+static
+void getbitmaps()
{
bitmap_waiting = false;
for (int i = 0; i < bmpinsref; ++i)
}
-static void RegisterFigure(InsetFig * fi)
+static
+void RegisterFigure(InsetFig * fi)
{
if (figinsref == 0) InitFigures();
fi->form = 0;
typedef Figref * Figref_p;
Figref ** tmp = new Figref_p[figarrsize];
memcpy(tmp, figures,
- sizeof(Figref*)*(figarrsize-figallocchunk));
+ sizeof(Figref*) * (figarrsize-figallocchunk));
delete[] figures;
figures = tmp;
}
}
-static void UnregisterFigure(InsetFig * fi)
+static
+void UnregisterFigure(InsetFig * fi)
{
Figref * tmpfig = fi->figure;
}
-static string NextToken(istream & is)
+static
+string NextToken(istream & is)
{
string token;
char c;
}
-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);
{
}
+
void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
{
LyXFont
font.decSize();
font.setColor(LColor::ert);
int width;
- pain.buttonText(int(x)+TEXT_TO_INSET_OFFSET, baseline, _("ERT"), font,
- true, width);
- x += width + (2*TEXT_TO_INSET_OFFSET);
+ pain.buttonText(int(x) + TEXT_TO_INSET_OFFSET, baseline,
+ _("ERT"), font, true, width);
+ x += width + (2 * TEXT_TO_INSET_OFFSET);
}
--- /dev/null
+/* 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;
+}
+
+
--- /dev/null
+// -*- 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
switch(c) {
case ' ': case '(': case '{': case '[': case '-': case ':':
case LyXParagraph::META_HFILL:
+#warning think about this
+#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR:
+#endif
case LyXParagraph::META_NEWLINE:
side = InsetQuotes::LeftQ; // left quote
break;
int InsetSpecialChar::width(Painter &, LyXFont const & font) const
{
- LyXFont f(font);
switch (kind) {
case HYPHENATION:
{
- int w = f.textWidth("-", 1);
+ int w = font.textWidth("-", 1);
if (w > 5)
w -= 2; // to make it look shorter
return w;
}
case END_OF_SENTENCE:
{
- return f.textWidth(".", 1);
+ return font.textWidth(".", 1);
}
case LDOTS:
{
- return f.textWidth(". . .", 5);
+ return font.textWidth(". . .", 5);
}
- case MENU_SEPARATOR: {
- return f.textWidth(" x ", 3);
+ case MENU_SEPARATOR:
+ {
+ return font.textWidth(" x ", 3);
+ }
+#if 0
+ case NEWLINE:
+ {
+ }
+#endif
+ case PROTECTED_SEPARATOR:
+ {
+ return font.textWidth("x", 1);
}
+
}
return 1; // To shut up gcc
}
pain.lines(xp, yp, 4, LColor::special);
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;
}
}
}
case END_OF_SENTENCE: command = "\\@."; break;
case LDOTS: command = "\\ldots{}"; 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";
}
kind = LDOTS;
else if (command == "\\menuseparator")
kind = MENU_SEPARATOR;
+ else if (command == "\\protected_separator")
+ kind = PROTECTED_SEPARATOR;
else
lex.printError("InsetSpecialChar: Unknown kind: `$$Token'");
}
case END_OF_SENTENCE: file += "\\@."; break;
case LDOTS: file += "\\ldots{}"; break;
case MENU_SEPARATOR: file += "\\lyxarrow{}"; break;
+ case PROTECTED_SEPARATOR: file += "~"; break;
}
return 0;
}
case END_OF_SENTENCE: file += ""; break;
case LDOTS: file += "..."; break;
case MENU_SEPARATOR: file += "->"; break;
+ case PROTECTED_SEPARATOR: file += " "; break;
}
return 0;
}
case END_OF_SENTENCE: file += ""; break;
case LDOTS: file += "..."; break;
case MENU_SEPARATOR: file += "->"; break;
+ case PROTECTED_SEPARATOR: file += " "; break;
}
return 0;
}
/// End of sentence punctuation (\@)
END_OF_SENTENCE,
/// Menu separator
- MENU_SEPARATOR
+ MENU_SEPARATOR,
+#if 0
+ /// Newline
+ NEWLINE,
+#endif
+ /// Protected Separator
+ PROTECTED_SEPARATOR
};
///
///
Inset::Code LyxCode() const
{
- return Inset::NO_CODE;
+ return Inset::SPECIALCHAR_CODE;
}
/// We don't need \begin_inset and \end_inset
bool DirectWrite() const
++pos;
} else if (token == "\\protected_separator") {
// now obsolete, but we have a back compability
+#if 0
par->InsertChar(pos, LyXParagraph::META_PROTECTED_SEPARATOR);
- //Inset * inset = new InsetSpecialChar(LyXParagraph::META_PROTECTED_SEPARATOR);
-// par->InsertChar(pos, LyXParagraph::META_INSET);
-// par->InsertInset(pos, inset);
+#else
+ Inset * inset =
+ new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
+ par->InsertChar(pos, LyXParagraph::META_INSET);
+ par->InsertInset(pos, inset);
+#endif
par->SetFont(pos, font);
++pos;
#endif
if (!par->bibkey)
par->bibkey = new InsetBibKey;
par->bibkey->Read(lex);
- }else if (token == "\\backslash") {
+ } else if (token == "\\backslash") {
par->InsertChar(pos, '\\');
par->SetFont(pos, font);
++pos;
}
-int InsetText::ascent(Painter &pain, LyXFont const & font) const
+int InsetText::ascent(Painter & pain, LyXFont const & font) const
{
if (init_inset) {
computeTextRows(pain);
}
-int InsetText::descent(Painter &pain, LyXFont const & font) const
+int InsetText::descent(Painter & pain, LyXFont const & font) const
{
if (init_inset) {
computeTextRows(pain);
}
-int InsetText::width(Painter &pain, LyXFont const &) const
+int InsetText::width(Painter & pain, LyXFont const &) const
{
if (init_inset) {
computeTextRows(pain);
return 0;
}
- if (the_locking_inset==inset)
+ if (the_locking_inset == inset)
return maxWidth;
return the_locking_inset->getMaxWidth(inset);
top_baseline = baseline;
computeBaselines(baseline);
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);
- 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;
if (!the_locking_inset && do_reset_pos) {
}
no_selection = false;
if (the_locking_inset) {
- setPos(bv, x,y,false);
+ setPos(bv, x, y, false);
UpdatableInset
- *inset=0;
- if (par->GetChar(actpos)==LyXParagraph::META_INSET)
- inset=(UpdatableInset*)par->GetInset(actpos);
+ *inset = 0;
+ if (par->GetChar(actpos) == LyXParagraph::META_INSET)
+ inset = static_cast<UpdatableInset*>(par->GetInset(actpos));
if (the_locking_inset == inset) {
the_locking_inset->InsetButtonPress(bv,x-inset_x,y-inset_y,button);
return;
}
-int InsetText::Latex(ostream &os, signed char fragile) const
+int InsetText::Latex(ostream & os, signed char fragile) const
{
string fstr;
if (IsPrintable(c)) {
return font.width(c);
} else if (c == LyXParagraph::META_INSET) {
- Inset const * tmpinset=par->GetInset(pos);
+ Inset const * tmpinset = par->GetInset(pos);
if (tmpinset)
return tmpinset->width(pain, font);
else
{
char par_depth = par->GetDepth();
- LyXLayout layout =
+ LyXLayout const & layout =
textclasslist.Style(buffer->params.textclass, par->GetLayout());
// We specialize the 95% common case:
if (!the_locking_inset)
return 0;
- int
- y = inset_y;
+ int y = inset_y;
return (y + the_locking_inset->InsetInInsetY());
}
void InsetText::setPos(BufferView * bv, int x, int y, bool activate_inset)
{
- int ox = x,
- oy = y;
+ int ox = x;
+ int oy = y;
+
// search right X-pos x==0 -> top_x
actpos = actrow = 0;
cy = top_baseline;
if (par->GetInset(pos))
font = par->GetInset(pos)->ConvertFont(font);
}
- LyXLayout layout =
+ LyXLayout const & layout =
textclasslist.Style(buffer->params.textclass,par->GetLayout());
// Get concrete layout font to reduce against
row.baseline = 0;
rows.push_back(row);
if (maxWidth < 0) {
- for(p=0; p < par->Last(); ++p) {
+ for(p = 0; p < par->Last(); ++p) {
insetWidth += SingleWidth(pain, par, p);
SingleHeight(pain, par, p, asc, desc);
if (asc > maxAscent)
bool is_first_word_in_row = true;
int cw,
- lastWordWidth=0;
+ lastWordWidth = 0;
for(p = 0; p < par->Last(); ++p) {
cw = SingleWidth(pain, par, p);
wordDescent = desc;
Inset const * inset = 0;
if (((p + 1) < par->Last()) &&
- (par->GetChar(p+1)==LyXParagraph::META_INSET))
- inset = par->GetInset(p+1);
+ (par->GetChar(p + 1)==LyXParagraph::META_INSET))
+ inset = par->GetInset(p + 1);
if (inset && inset->display()) {
if (!is_first_word_in_row && (width >= maxWidth)) {
// we have to split also the row above
- rows[rows.size()-1].asc = oasc;
- rows[rows.size()-1].desc = odesc;
+ rows[rows.size() - 1].asc = oasc;
+ rows[rows.size() - 1].desc = odesc;
row.pos = nwp;
rows.push_back(row);
oasc = wordAscent;
} else if (par->IsSeparator(p)) {
if (width >= maxWidth) {
if (is_first_word_in_row) {
- rows[rows.size()-1].asc = wordAscent;
- rows[rows.size()-1].desc = wordDescent;
- row.pos = p+1;
+ rows[rows.size() - 1].asc = wordAscent;
+ rows[rows.size() - 1].desc = wordDescent;
+ row.pos = p + 1;
rows.push_back(row);
oasc = odesc = width = 0;
} else {
- rows[rows.size()-1].asc = oasc;
- rows[rows.size()-1].desc = odesc;
+ rows[rows.size() - 1].asc = oasc;
+ rows[rows.size() - 1].desc = odesc;
row.pos = nwp;
rows.push_back(row);
oasc = wordAscent;
width = lastWordWidth;
}
wordAscent = wordDescent = lastWordWidth = 0;
- nwp = p+1;
+ nwp = p + 1;
continue;
}
owidth = width;
if (odesc < wordDescent)
odesc = wordDescent;
wordAscent = wordDescent = lastWordWidth = 0;
- nwp = p+1;
+ nwp = p + 1;
is_first_word_in_row = false;
}
}
if (p) {
if (width >= maxWidth) {
// assign upper row
- rows[rows.size()-1].asc = oasc;
- rows[rows.size()-1].desc = odesc;
+ rows[rows.size() - 1].asc = oasc;
+ rows[rows.size() - 1].desc = odesc;
// assign and allocate lower row
row.pos = nwp;
rows.push_back(row);
- rows[rows.size()-1].asc = wordAscent;
- rows[rows.size()-1].desc = wordDescent;
+ rows[rows.size() - 1].asc = wordAscent;
+ rows[rows.size() - 1].desc = wordDescent;
if (insetWidth < owidth)
insetWidth = owidth;
width -= owidth;
oasc = wordAscent;
if (odesc < wordDescent)
odesc = wordDescent;
- rows[rows.size()-1].asc = oasc;
- rows[rows.size()-1].desc = odesc;
+ rows[rows.size() - 1].asc = oasc;
+ rows[rows.size() - 1].desc = odesc;
}
}
// alocate a dummy row for the endpos
// calculate maxAscent/Descent
maxAscent = rows[0].asc;
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;
}
#if 0
computeBaselines(top_baseline);
actpos = inset_pos;
resetPos(bv);
- inset_x = cx-top_x;
+ inset_x = cx - top_x;
inset_y = cy;
}
#endif
void InsetText::computeBaselines(int baseline) const
{
rows[0].baseline = baseline;
- for (unsigned int i=1; i<rows.size()-1; i++) {
- rows[i].baseline = rows[i-1].baseline + rows[i-1].desc +
+ for (unsigned int i = 1; i < rows.size() - 1; i++) {
+ rows[i].baseline = rows[i - 1].baseline + rows[i - 1].desc +
rows[i].asc + interline_space;
}
}
///
BIBTEX_CODE,
///
- TEXT_CODE
+ TEXT_CODE,
+ ///
+ SPECIALCHAR_CODE
};
///
};
+#if 0
// This table is sorted alphabetically [asierra 30March96]
static keyword_item layoutTags[] = {
{ "align", LT_ALIGN },
{ "textfont", LT_TEXTFONT },
{ "topsep", LT_TOPSEP }
};
+#endif
/////////////////////
// Reads a layout definition from file
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 finished = false;
lexrc.pushTable(layoutTags, LT_INTITLE);
};
+#if 0
static keyword_item alignTags[] = {
{ "block", AT_BLOCK },
{ "center", AT_CENTER },
{ "left", AT_LEFT },
{ "right", AT_RIGHT }
};
-
+#endif
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);
int le = lexrc.lex();
switch (le) {
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);
alignpossible = LYX_ALIGN_NONE;
int lineno = lexrc.GetLineNo();
};
+#if 0
static keyword_item labelTypeTags[] = {
{ "bibliography", LA_BIBLIO },
{ "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT },
{ "static", LA_STATIC },
{ "top_environment", LA_TOP_ENVIRONMENT }
};
+#endif
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);
int le = lexrc.lex();
switch (le) {
}
-enum MarginTags {
- MT_STATIC = 1,
- MT_MANUAL,
- MT_DYNAMIC,
- MT_FIRST_DYNAMIC,
- MT_RIGHT_ADDRESS_BOX
-};
-
-
+#if 0
static keyword_item marginTags[] = {
- { "dynamic", MT_DYNAMIC },
- { "first_dynamic", MT_FIRST_DYNAMIC },
- { "manual", MT_MANUAL },
- { "right_address_box", MT_RIGHT_ADDRESS_BOX },
- { "static", MT_STATIC }
+ { "dynamic", MARGIN_DYNAMIC },
+ { "first_dynamic", MARGIN_FIRST_DYNAMIC },
+ { "manual", MARGIN_MANUAL },
+ { "right_address_box", MARGIN_RIGHT_ADDRESS_BOX },
+ { "static", MARGIN_STATIC }
};
-
+#endif
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();
switch(le) {
case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown margin type tag `$$Token'");
- return;
- default: break;
- }
- switch(static_cast<MarginTags>(le)) {
- case MT_STATIC:
- margintype = MARGIN_STATIC;
- break;
- case MT_MANUAL:
- margintype = MARGIN_MANUAL;
- break;
- case MT_DYNAMIC:
- margintype = MARGIN_DYNAMIC;
- break;
- case MT_FIRST_DYNAMIC:
- margintype = MARGIN_FIRST_DYNAMIC;
+ return;
+ case MARGIN_STATIC:
+ case MARGIN_MANUAL:
+ case MARGIN_DYNAMIC:
+ case MARGIN_FIRST_DYNAMIC:
+ case MARGIN_RIGHT_ADDRESS_BOX:
+ margintype = static_cast<LYX_MARGIN_TYPE>(le);
break;
- case MT_RIGHT_ADDRESS_BOX:
- margintype = MARGIN_RIGHT_ADDRESS_BOX;
+ default:
+ lyxerr << "Unhandled value " << le
+ << " in LyXLayout::readMargin." << endl;
break;
}
}
-enum LatexTypeTags {
- LX_PARAGRAPH = 1,
- LX_COMMAND,
- LX_ENVIRONMENT,
- LX_ITEM_ENVIRONMENT,
- LX_LIST_ENVIRONMENT
-};
-
-
+#if 0
static keyword_item latexTypeTags[] = {
- { "command", LX_COMMAND },
- { "environment", LX_ENVIRONMENT },
- { "item_environment", LX_ITEM_ENVIRONMENT },
- { "list_environment", LX_LIST_ENVIRONMENT },
- { "paragraph", LX_PARAGRAPH }
+ { "command", LATEX_COMMAND },
+ { "environment", LATEX_ENVIRONMENT },
+ { "item_environment", LATEX_ITEM_ENVIRONMENT },
+ { "list_environment", LATEX_LIST_ENVIRONMENT },
+ { "paragraph", LATEX_PARAGRAPH }
};
+#endif
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();
switch (le) {
case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown latextype tag `$$Token'");
- return;
- default: break;
- }
- switch (static_cast<LatexTypeTags>(le)) {
- case LX_PARAGRAPH:
- latextype= LATEX_PARAGRAPH;
- break;
- case LX_COMMAND:
- latextype= LATEX_COMMAND;
- break;
- case LX_ENVIRONMENT:
- latextype= LATEX_ENVIRONMENT;
- break;
- case LX_ITEM_ENVIRONMENT:
- latextype= LATEX_ITEM_ENVIRONMENT;
+ return;
+ case LATEX_PARAGRAPH:
+ case LATEX_COMMAND:
+ case LATEX_ENVIRONMENT:
+ case LATEX_ITEM_ENVIRONMENT:
+ case LATEX_LIST_ENVIRONMENT:
+ latextype = static_cast<LYX_LATEX_TYPES>(le);
break;
- case LX_LIST_ENVIRONMENT:
- latextype= LATEX_LIST_ENVIRONMENT;
+ default:
+ lyxerr << "Unhandled value " << le
+ << " in LyXLayout::readLatexType." << endl;
break;
}
}
};
+#if 0
static keyword_item spacingTags[] = {
{"double", ST_SPACING_DOUBLE },
{"onehalf", ST_SPACING_ONEHALF },
{"other", ST_OTHER },
{"single", ST_SPACING_SINGLE }
};
+#endif
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);
int le = lexrc.lex();
switch(le) {
};
+#if 0
static keyword_item textClassTags[] = {
{ "classoptions", TC_CLASSOPTIONS },
{ "columns", TC_COLUMNS },
{ "style", TC_STYLE },
{ "tocdepth", TC_TOCDEPTH }
};
+#endif
// Reads a textclass structure from file.
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)
lyxerr[Debug::TCLASS] << "Reading textclass "
<< MakeDisplayPath(filename)
}
-enum OutputTypeTags {
- OT_OTLATEX = 1,
- OT_OTLINUXDOC,
- OT_OTDOCBOOK,
- OT_OTLITERATE
-};
-
-
+#if 0
static keyword_item outputTypeTags[] = {
- { "docbook", OT_OTDOCBOOK },
- { "latex", OT_OTLATEX },
- { "linuxdoc", OT_OTLINUXDOC },
- { "literate", OT_OTLITERATE }
+ { "docbook", DOCBOOK },
+ { "latex", LATEX },
+ { "linuxdoc", LINUXDOC },
+ { "literate", LITERATE }
};
-
+#endif
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();
switch(le) {
case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown output type `$$Token'");
- return;
- default: break;
- }
- switch(static_cast<OutputTypeTags>(le)) {
- case OT_OTLATEX:
- outputType_ = LATEX;
- break;
- case OT_OTLINUXDOC:
- outputType_ = LINUXDOC;
- break;
- case OT_OTDOCBOOK:
- outputType_ = DOCBOOK;
+ return;
+ case LATEX:
+ case LINUXDOC:
+ case DOCBOOK:
+ case LITERATE:
+ outputType_ = static_cast<OutputType>(le);
break;
- case OT_OTLITERATE:
- outputType_ = LITERATE;
+ default:
+ lyxerr << "Unhandled value " << le
+ << " in LyXTextClass::readOutputType." << endl;
+
break;
}
}
};
+#if 0
static keyword_item maxCounterTags[] = {
{"counter_chapter", MC_COUNTER_CHAPTER },
{"counter_enumi", MC_COUNTER_ENUMI },
{"counter_subsection", MC_COUNTER_SUBSECTION },
{"counter_subsubsection", MC_COUNTER_SUBSUBSECTION }
};
+#endif
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);
int le = lexrc.lex();
switch(le) {
};
+#if 0
static keyword_item classOptionsTags[] = {
{"end", CO_END },
{"fontsize", CO_FONTSIZE },
{"other", CO_OTHER },
{"pagestyle", CO_PAGESTYLE }
};
+#endif
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);
bool getout = false;
while (!getout && lexrc.IsOK()) {
/// The different output types
enum OutputType {
///
- LATEX,
+ LATEX = 1,
///
LINUXDOC,
///
/// The different margin types
enum LYX_MARGIN_TYPE {
///
- MARGIN_MANUAL,
+ MARGIN_MANUAL = 1,
///
MARGIN_FIRST_DYNAMIC,
///
/// The different LaTeX-Types
enum LYX_LATEX_TYPES {
///
- LATEX_PARAGRAPH,
+ LATEX_PARAGRAPH = 1,
///
LATEX_COMMAND,
///
char labeltype; // add approp. type
///
- char margintype; // add approp. type
+ LYX_MARGIN_TYPE margintype;
///
bool fill_top;
#include "bufferparams.h"
-extern bool UpdateLayoutDocument(BufferParams *params = 0);
+extern bool UpdateLayoutDocument(BufferParams * params = 0);
extern bool UpdateLayoutPreamble();
extern bool UpdateLayoutPaper();
extern bool UpdateLayoutQuotes();
// 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
// code is indented in the right way!!!
-void addNewlineAndDepth(string & file, int const depth)
+void addNewlineAndDepth(string & file, int depth)
{
file += '\n';
file.append(depth, ' ');
#include "insets/insetbib.h"
#include "insets/insettext.h"
#include "insets/insetert.h"
+#include "insets/insetgraphics.h"
#include "mathed/formulamacro.h"
#include "toolbar.h"
#include "spellchecker.h" // RVDK_PATCH_5
extern void LoadLyXFile(string const &);
extern void Reconfigure(BufferView *);
-extern int current_layout;
+extern LyXTextClass::size_type current_layout;
extern int getISOCodeFromLaTeX(char *);
extern void ShowLatexLog();
case LFUN_FIGURE:
Figure();
break;
-
+
+ case LFUN_INSERT_GRAPHICS:
+ {
+ Inset * new_inset = new InsetGraphics;
+ owner->view()->insertInset(new_inset);
+ break;
+ }
+
case LFUN_AUTOSAVE:
AutoSave();
break;
// and current buffer's textclass (number). */
LyXTextClassList::ClassList::size_type tclass =
owner->view()->text->parameters->textclass;
- pair <bool, int> layout =
+ pair <bool, LyXTextClass::size_type> layout =
textclasslist.NumberOfLayout(tclass, argument);
// If the entry is obsolete, use the new one instead.
// --- text changing commands ------------------------
case LFUN_BREAKLINE:
+#if 1
owner->view()->beforeChange();
owner->view()->text->InsertChar(LyXParagraph::META_NEWLINE);
owner->view()->smallUpdate(1);
SetUpdateTimer(0.01);
moveCursorUpdate(false);
+#else
+ owner->view()->newline();
+#endif
break;
case LFUN_PROTECTEDSPACE:
+#if 1
+ owner->view()->protectedBlank();
+#else
owner->view()->beforeChange();
owner->view()->text->
InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
owner->view()->smallUpdate(1);
SetUpdateTimer();
moveCursorUpdate(false);
+#endif
break;
case LFUN_SETMARK:
///
META_NEWLINE,
///
- META_PROTECTED_SEPARATOR,
+ //META_PROTECTED_SEPARATOR,
///
META_INSET
};
void SetPExtraType(int type, char const * width, char const * widthp);
///
void UnsetPExtraType();
+#if 0
///
bool RoffContTableRows(ostream &, size_type i, int actcell);
+#endif
///
void DocBookContTableRows(string & file, string & extra, int & desc_on,
size_type i,
for a list of paragraphs beginning with the specified par
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);
/* for the greater insets */
int brace = 0;
int acc_brace = 0;
int acc_braces[8];
- MathParInset * mt = (mtx) ? *mtx: 0;//(MathParInset*)0;
+ MathParInset * mt = (mtx) ? *mtx : 0;//(MathParInset*)0;
MathedRowSt * crow = (mt) ? mt->getRowSt() : 0;
++plevel;
#include "math_panel.h"
#include "math_parser.h"
-//extern void Update(signed char);
-//extern int UnlockInset(UpdatableInset *);
extern short greek_kb_flag;
extern BufferView * current_view;
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);
char const *s = 0;
#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.
// this is a bad idea, but how can LyXParagraph find its buffer to get
// parameters? (JMarc)
os << "\n\\hfill \n";
column = 0;
break;
+#if 0
case META_PROTECTED_SEPARATOR:
os << "\n\\protected_separator \n";
column = 0;
break;
+#endif
case '\\':
os << "\n\\backslash \n";
column = 0;
break;
default:
if ((column > 70 && c == ' ')
- || column > 79){
+ || column > 79) {
os << "\n";
column = 0;
}
}
-LyXTextClass::LayoutList::size_type LyXParagraph::GetLayout() const
+LyXTextClass::size_type LyXParagraph::GetLayout() const
{
return FirstPhysicalPar()->layout;
}
}
-void LyXParagraph::SetOnlyLayout(LyXTextClass::LayoutList::size_type new_layout)
+void LyXParagraph::SetOnlyLayout(LyXTextClass::size_type new_layout)
{
LyXParagraph * par = FirstPhysicalPar();
LyXParagraph * ppar = 0;
}
-void LyXParagraph::SetLayout(LyXTextClass::LayoutList::size_type new_layout)
+void LyXParagraph::SetLayout(LyXTextClass::size_type new_layout)
{
LyXParagraph
* par = FirstPhysicalPar(),
// remove unnecessary GetChar() calls
size_type i = 0;
if (i < size()
- && GetChar(i) != LyXParagraph::META_NEWLINE) {
+ && GetChar(i) != LyXParagraph::META_NEWLINE
+ ) {
++i;
char previous_char, temp;
if (i < size()
if (table)
return SimpleTeXOneTablePar(file, texrow);
- char c;
- size_type main_body;
-
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;
// Maybe we have to create a optional argument.
+ size_type main_body;
if (style.labeltype != LABEL_MANUAL)
main_body = 0;
else
}
}
- c = GetChar(i);
+ int c = GetChar(i);
// Fully instantiated font
LyXFont font = getFont(i);
case LyXParagraph::META_HFILL:
sgml_string.clear();
break;
+#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR:
sgml_string = ' ';
break;
+#endif
case LyXParagraph::META_NEWLINE:
sgml_string = '\n';
break;
// but I'll leave it as a switch statement
// so its simpler to extend. (ARRae)
switch (c) {
+#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR:
file += ' ';
break;
-
+#endif
default:
// make sure that we will not print
// error generating chars to the tex
} else {
// Plain mode (i.e. not LaTeX)
switch (c) {
+#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR:
file += '~';
break;
-
+#endif
case '\\':
file += "\\textbackslash{}";
column += 15;
}
+#if 0
bool LyXParagraph::RoffContTableRows(ostream & os,
LyXParagraph::size_type i,
int actcell)
switch (c) {
case LyXParagraph::META_INSET:
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(),
ios::in|ios::out);
if (!fs) {
fs.get(c);
}
fs.close();
+#endif
}
break;
case LyXParagraph::META_NEWLINE:
break;
case LyXParagraph::META_HFILL:
break;
+#if 0
case LyXParagraph::META_PROTECTED_SEPARATOR:
break;
+#endif
case '\\':
os << "\\\\";
break;
}
return true;
}
+#endif
LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow,
"No footnote!" << endl;
LyXParagraph * par = this;
- LyXLayout const & style = textclasslist.Style(current_view->buffer()->params.textclass,
- previous->GetLayout());
+ LyXLayout const & style =
+ textclasslist.Style(current_view->buffer()->params.textclass,
+ previous->GetLayout());
if (style.needprotect && footnotekind != LyXParagraph::FOOTNOTE){
lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
// Process text for all floats except footnotes in body
do {
LyXLayout const & style =
- textclasslist.Style(current_view->buffer()->params.textclass,
- par->layout);
+ textclasslist
+ .Style(current_view->buffer()->params
+ .textclass,
+ par->layout);
if (par->IsDummy())
lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
<< endl;
int dummy_count = 0;
do {
LyXLayout const & style =
- textclasslist.Style(current_view->buffer()->params.textclass,
- par->layout);
+ textclasslist
+ .Style(current_view->buffer()->params
+ .textclass,
+ par->layout);
if (par->IsDummy())
lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
<< endl;
}
-int main(int, char**)
+int main(int, char **)
{
SystemcallsSingletoncontroller::Startcontroller starter;
#include <cctype>
///
-inline bool IsNewlineChar(char c) {
+inline
+bool IsNewlineChar(char c) {
return (c == LyXParagraph::META_NEWLINE);
}
///
-inline bool IsSeparatorChar(char c) {
+#if 0
+inline
+bool IsSeparatorChar(char c) {
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);
}
///
-inline bool IsInsetChar(char c) {
+inline
+bool IsInsetChar(char c) {
return (c == LyXParagraph::META_INSET);
}
///
-inline bool IsFloatChar(char c) {
+inline
+bool IsFloatChar(char c) {
return (c == LyXParagraph::META_FOOTNOTE
|| c == LyXParagraph::META_MARGIN
|| c == LyXParagraph::META_FIG
///
-inline bool IsLineSeparatorChar(char c) {
+inline
+bool IsLineSeparatorChar(char c) {
return (c == ' ');
}
///
-inline bool IsKommaChar(char c) {
+inline
+bool IsKommaChar(char c) {
return (c == ','
|| c == '('
|| c == ')'
|| c == '/'
|| c == '\\'
|| c == LyXParagraph::META_NEWLINE
+#if 0
|| c == LyXParagraph::META_PROTECTED_SEPARATOR
+#endif
);
}
///
-inline bool IsLetterChar(unsigned char c) {
+inline
+bool IsLetterChar(unsigned char c) {
return ((c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z')
|| (c >= 192)); // in iso-8859-x these are accented chars
///
-inline bool IsPrintable(unsigned char c) {
+inline
+bool IsPrintable(unsigned char c) {
return (c >= ' ');
}
/// Word is not IsSeparator or IsKomma or IsHfill or IsFloat or IsInset.
-inline bool IsWordChar(unsigned char c) {
- return !( IsSeparatorChar( c )
- || IsKommaChar( c )
- || IsHfillChar( c )
- || IsFloatChar( c )
- || IsInsetChar( c ) ) ;
+inline
+bool IsWordChar(unsigned char c) {
+ return !( IsSeparatorChar( c )
+ || IsKommaChar( c )
+ || IsHfillChar( c )
+ || IsFloatChar( c )
+ || IsInsetChar( c ) ) ;
}
///
-inline bool IsLetterCharOrDigit(char ch)
+inline
+bool IsLetterCharOrDigit(char ch)
{
return IsLetterChar(ch) || isdigit(ch);
}
#pragma implementation
#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;
}
+#if 0
// cell <0 will tex the preamble
// returns the number of printed newlines
int LyXTable::RoffEndOfCell(ostream & os, int cell)
}
return ret;
}
+#endif
char const *LyXTable::getDocBookAlign(int cell, bool isColumn)
// returns the number of printed newlines
///
int TexEndOfCell(string & file, int cell);
+#if 0
///
int RoffEndOfCell(ostream &, int cell);
+#endif
///
char const * getDocBookAlign(int cell, bool isColumn = false);
///
int cell = 0;
do{
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);
if (pos <= cursor.pos)
cursor.pos++;
++pos;
} while (pos <= cursor.par->Last());
/* 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))
cursor.par->InsertChar(cursor.par->Last(), LyXParagraph::META_NEWLINE);
/* insert a character, moves all the following breaks in the
* same Paragraph one to the right and make a rebreak */
-void LyXText::InsertChar(char c)
+void LyXText::InsertChar(char c)
{
SetUndo(Undo::INSERT,
cursor.par->ParFromPos(cursor.pos)->previous,
/* When the free-spacing option is set for the current layout,
* all spaces are converted to protected spaces. */
+#warning think about this
+#if 0
bool freeSpacingBo =
textclasslist.Style(parameters->textclass,
cursor.row->par->GetLayout()).free_spacing;
-
+
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;
-
+ }
+#endif
+
/* table stuff -- begin*/
if (cursor.par->table) {
InsertCharInTable(c);
} else if (row_ptr->par->IsSeparator(pos)) {
tmpx = x;
x+= SingleWidth(row_ptr->par, pos);
- /* -------> Only draw protected spaces when not in
- * free-spacing mode. */
+#warning Think about this.
+#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) {
pain.line(int(tmpx),
offset + row_ptr->baseline - 3,
offset + row_ptr->baseline + 2);
}
}
+#endif
++vpos;
} else
draw(row_ptr, vpos, offset, x);
x+= SingleWidth(row_ptr->par, pos);
if (pos >= main_body)
x+= fill_separator;
- /* -------> Only draw protected spaces when not in
- * free-spacing mode. */
+#warning Think about this
+#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) {
pain.line(int(tmpx),
offset + row_ptr->baseline + 2);
}
}
+#endif
++vpos;
} else
draw(row_ptr, vpos, offset, x);
LyXParagraph::size_type c;
LyXLayout const & layout = textclasslist.Style(parameters->textclass,
- row->par->GetLayout());
+ row->par->GetLayout());
/* table stuff -- begin */
if (row->par->table) {
if (row->next && row->next->par == row->par //the last row doesn't need a newline at the end
|| kind == LyXParagraph::WIDE_TAB
|| kind == LyXParagraph::WIDE_FIG
|| kind == LyXParagraph::ALGORITHM) {
- int lay = textclasslist.NumberOfLayout(parameters->textclass,
- "Caption").second;
- if (lay == -1) // layout not found
- // use default layout "Standard" (0)
- lay = 0;
+ pair<bool, LyXTextClass::size_type> lres =
+ textclasslist.NumberOfLayout(parameters->textclass,
+ "Caption");
+ LyXTextClass::size_type lay;
+ if (lres.first) {
+ // layout fount
+ lay = lres.second;
+ } else {
+ // layout not found
+ lay = 0; // use default layout "Standard" (0)
+ }
tmppar->SetLayout(lay);
}
}
#include "lyxparagraph.h"
#include "insets/inseterror.h"
#include "insets/insetbib.h"
+#include "insets/insetspecialchar.h"
#include "layout.h"
#include "LyXView.h"
#include "support/textutils.h"
// Asger is not sure we want to do this...
void LyXText::MakeFontEntriesLayoutSpecific(LyXParagraph * par)
{
- LyXFont layoutfont, tmpfont;
LyXLayout const & layout =
textclasslist.Style(parameters->textclass, par->GetLayout());
+ LyXFont layoutfont, tmpfont;
for (LyXParagraph::size_type pos = 0;
pos < par->Last(); ++pos) {
if (pos < BeginningOfMainBody(par))
// 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;
// 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 (!selection) {
if (par->labelwidthstring.empty()) {
par->SetLabelWidthString(layout.labelstring());
}
- }
- else {
+ } else {
par->SetLabelWidthString(string());
}
SetCursorParUndo();
- char flag =
+ bool flag =
textclasslist.Style(parameters->textclass,
cursor.par->GetLayout()).isEnvironment();
// only to be sure, should not be neccessary
++pos;
}
} 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);
+#endif
++pos;
} else if (str[i] == '\t') {
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);
+#endif
}
pos = a;
} else if (str[i]!= 13 &&
cell = NumberOfCell(par, pos);
while((pos < par->size()) &&
!(par->table->IsFirstCell(cell))) {
+
while((pos < par->size()) &&
(par->GetChar(pos) != LyXParagraph::META_NEWLINE))
++pos;
break;
} else {
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);
+#endif
++pos;
}
par->BreakParagraph(pos, flag);
}
-int LyXText::SwitchLayoutsBetweenClasses(char class1, char class2,
+int LyXText::SwitchLayoutsBetweenClasses(LyXTextClassList::size_type class1,
+ LyXTextClassList::size_type class2,
LyXParagraph * par)
{
int ret = 0;