mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
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:
parent
a2c6689c71
commit
ba5e47f1a9
40
ChangeLog
40
ChangeLog
@ -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>
|
||||
|
||||
* src/lyxtext.h: change SetLayout() to take a
|
||||
@ -14,6 +45,15 @@
|
||||
* 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
|
||||
|
@ -183,9 +183,9 @@ dnl Check the version of g++
|
||||
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
|
||||
@ -195,11 +195,13 @@ dnl Check the version of g++
|
||||
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
|
||||
|
@ -183,9 +183,9 @@ dnl Check the version of g++
|
||||
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
|
||||
@ -195,11 +195,13 @@ dnl Check the version of g++
|
||||
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
|
||||
|
@ -88,7 +88,7 @@ Style List
|
||||
{\settowidth{\labelwidth}{#1}
|
||||
\setlength{\leftmargin}{\labelwidth}
|
||||
\addtolength{\leftmargin}{\labelsep}
|
||||
\renewcommand{\makelabel}[1]{##1 \hfill}}}
|
||||
\renewcommand{\makelabel}[1]{\makebox[\labelwidth][l]{##1}}}}
|
||||
{\end{list}}
|
||||
EndPreamble
|
||||
|
||||
|
@ -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
|
||||
if (buffer_ && screen && button == 1) {
|
||||
|
@ -244,7 +244,7 @@ private:
|
||||
///
|
||||
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_;
|
||||
///
|
||||
|
@ -203,12 +203,18 @@ void BufferView::insertInset(Inset * inset, string const & lout,
|
||||
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,
|
||||
@ -481,8 +487,14 @@ void BufferView::newline()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@ -492,8 +504,14 @@ void BufferView::protectedBlank()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,13 @@ struct LaTeXFeatures {
|
||||
//@{
|
||||
///
|
||||
bool color; // color.sty
|
||||
#ifdef USE_GRAPHICX
|
||||
///
|
||||
bool graphicx; // graphicx.sty
|
||||
#else
|
||||
///
|
||||
bool graphics; // graphics.sty
|
||||
#endif
|
||||
///
|
||||
bool setspace; // setspace.sty
|
||||
///
|
||||
|
@ -180,6 +180,8 @@ void LyXAction::init()
|
||||
{ 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 },
|
||||
|
@ -38,7 +38,7 @@ extern FD_form_document * fd_form_document;
|
||||
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;
|
||||
|
@ -381,16 +381,16 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
// 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;
|
||||
@ -402,7 +402,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
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;
|
||||
|
115
src/buffer.C
115
src/buffer.C
@ -75,6 +75,7 @@ using std::setw;
|
||||
#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"
|
||||
@ -294,8 +295,9 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
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,
|
||||
@ -701,66 +703,72 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
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);
|
||||
@ -786,6 +794,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
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
|
||||
@ -839,6 +848,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
cmdname += "{" + opt + "}";
|
||||
inset = new InsetRef(cmdname, this);
|
||||
}
|
||||
#endif
|
||||
} else if (inscmd.getCmdName() == "tableofcontents") {
|
||||
inset = new InsetTOC(this);
|
||||
} else if (inscmd.getCmdName() == "listoffigures") {
|
||||
@ -888,9 +898,16 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
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);
|
||||
@ -898,9 +915,16 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
|
||||
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)
|
||||
@ -1261,6 +1285,21 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
|
||||
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);
|
||||
@ -1268,7 +1307,8 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
|
||||
}
|
||||
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)
|
||||
@ -1411,9 +1451,11 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
|
||||
case LyXParagraph::META_HFILL:
|
||||
ofs << "\t";
|
||||
break;
|
||||
#if 0
|
||||
case LyXParagraph::META_PROTECTED_SEPARATOR:
|
||||
ofs << " ";
|
||||
break;
|
||||
#endif
|
||||
case '\\':
|
||||
ofs << "\\";
|
||||
break;
|
||||
@ -1901,8 +1943,9 @@ void Buffer::makeLaTeXFile(string const & fname,
|
||||
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) {
|
||||
@ -2660,9 +2703,10 @@ void Buffer::makeDocBookFile(string const & fname, int column)
|
||||
}
|
||||
|
||||
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 */
|
||||
@ -3283,6 +3327,7 @@ int Buffer::runChktex()
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
|
||||
{
|
||||
LyXFont font1(LyXFont::ALL_INHERIT);
|
||||
@ -3317,6 +3362,34 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
|
||||
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:"),
|
||||
@ -3336,6 +3409,7 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
|
||||
fs >> c;
|
||||
}
|
||||
fs.close();
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case LyXParagraph::META_NEWLINE:
|
||||
@ -3346,8 +3420,10 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
|
||||
break;
|
||||
case LyXParagraph::META_HFILL:
|
||||
break;
|
||||
#if 0
|
||||
case LyXParagraph::META_PROTECTED_SEPARATOR:
|
||||
break;
|
||||
#endif
|
||||
case '\\':
|
||||
ofs << "\\\\";
|
||||
break;
|
||||
@ -3398,6 +3474,7 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
|
||||
ifs.close();
|
||||
remove(fname2.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// changed Heinrich Bauer, 23/03/98
|
||||
|
@ -361,10 +361,12 @@ private:
|
||||
/// 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;
|
||||
|
||||
|
@ -242,6 +242,7 @@ enum kb_action {
|
||||
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 */
|
||||
};
|
||||
|
||||
|
35
src/insets/BoundingBox.h
Normal file
35
src/insets/BoundingBox.h
Normal 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
|
@ -19,6 +19,8 @@ libinsets_la_SOURCES = \
|
||||
inseterror.h \
|
||||
insetert.C \
|
||||
insetert.h \
|
||||
insetgraphics.C \
|
||||
insetgraphics.h \
|
||||
insetinclude.C \
|
||||
insetinclude.h \
|
||||
insetindex.C \
|
||||
|
@ -235,11 +235,10 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
// 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
|
||||
@ -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
|
||||
{
|
||||
if (lyxerr.debugging()) {
|
||||
@ -458,7 +458,8 @@ int FindBmpIndex(figdata * tmpdata)
|
||||
}
|
||||
|
||||
|
||||
static void freefigdata(figdata * tmpdata)
|
||||
static
|
||||
void freefigdata(figdata * tmpdata)
|
||||
{
|
||||
tmpdata->ref--;
|
||||
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
|
||||
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
|
||||
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 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
|
||||
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;
|
||||
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();
|
||||
fi->form = 0;
|
||||
@ -916,7 +920,7 @@ static void RegisterFigure(InsetFig * fi)
|
||||
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;
|
||||
}
|
||||
@ -944,7 +948,8 @@ int FindFigIndex(Figref * tmpfig)
|
||||
}
|
||||
|
||||
|
||||
static void UnregisterFigure(InsetFig * fi)
|
||||
static
|
||||
void UnregisterFigure(InsetFig * fi)
|
||||
{
|
||||
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;
|
||||
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);
|
||||
|
||||
|
@ -107,6 +107,7 @@ void UpdatableInset::ToggleInsetCursor(BufferView *)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
|
||||
{
|
||||
LyXFont
|
||||
|
@ -116,9 +116,9 @@ void InsetERT::draw_closed(Painter & pain, LyXFont const & f,
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
257
src/insets/insetgraphics.C
Normal file
257
src/insets/insetgraphics.C
Normal 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
161
src/insets/insetgraphics.h
Normal 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
|
@ -81,7 +81,10 @@ InsetQuotes::InsetQuotes(char c, BufferParams const & params)
|
||||
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;
|
||||
|
@ -38,26 +38,36 @@ int InsetSpecialChar::descent(Painter &, LyXFont const & font) const
|
||||
|
||||
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
|
||||
}
|
||||
@ -104,6 +114,34 @@ void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,6 +156,11 @@ void InsetSpecialChar::Write(ostream & os) const
|
||||
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";
|
||||
}
|
||||
@ -137,6 +180,8 @@ void InsetSpecialChar::Read(LyXLex & lex)
|
||||
kind = LDOTS;
|
||||
else if (command == "\\menuseparator")
|
||||
kind = MENU_SEPARATOR;
|
||||
else if (command == "\\protected_separator")
|
||||
kind = PROTECTED_SEPARATOR;
|
||||
else
|
||||
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 LDOTS: file += "\\ldots{}"; break;
|
||||
case MENU_SEPARATOR: file += "\\lyxarrow{}"; break;
|
||||
case PROTECTED_SEPARATOR: file += "~"; break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -171,6 +217,7 @@ int InsetSpecialChar::Linuxdoc(string & file) const
|
||||
case END_OF_SENTENCE: file += ""; break;
|
||||
case LDOTS: file += "..."; break;
|
||||
case MENU_SEPARATOR: file += "->"; break;
|
||||
case PROTECTED_SEPARATOR: file += " "; break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -183,6 +230,7 @@ int InsetSpecialChar::DocBook(string & file) const
|
||||
case END_OF_SENTENCE: file += ""; break;
|
||||
case LDOTS: file += "..."; break;
|
||||
case MENU_SEPARATOR: file += "->"; break;
|
||||
case PROTECTED_SEPARATOR: file += " "; break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -33,7 +33,13 @@ public:
|
||||
/// End of sentence punctuation (\@)
|
||||
END_OF_SENTENCE,
|
||||
/// Menu separator
|
||||
MENU_SEPARATOR
|
||||
MENU_SEPARATOR,
|
||||
#if 0
|
||||
/// Newline
|
||||
NEWLINE,
|
||||
#endif
|
||||
/// Protected Separator
|
||||
PROTECTED_SEPARATOR
|
||||
};
|
||||
|
||||
///
|
||||
@ -65,7 +71,7 @@ public:
|
||||
///
|
||||
Inset::Code LyxCode() const
|
||||
{
|
||||
return Inset::NO_CODE;
|
||||
return Inset::SPECIALCHAR_CODE;
|
||||
}
|
||||
/// We don't need \begin_inset and \end_inset
|
||||
bool DirectWrite() const
|
||||
|
@ -347,10 +347,14 @@ void InsetText::Read(LyXLex & lex)
|
||||
++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
|
||||
@ -358,7 +362,7 @@ void InsetText::Read(LyXLex & lex)
|
||||
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;
|
||||
@ -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) {
|
||||
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) {
|
||||
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) {
|
||||
computeTextRows(pain);
|
||||
@ -418,7 +422,7 @@ int InsetText::getMaxWidth(UpdatableInset * inset) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (the_locking_inset==inset)
|
||||
if (the_locking_inset == inset)
|
||||
return maxWidth;
|
||||
|
||||
return the_locking_inset->getMaxWidth(inset);
|
||||
@ -439,9 +443,9 @@ void InsetText::draw(Painter & pain, LyXFont const & f,
|
||||
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) {
|
||||
@ -604,11 +608,11 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
|
||||
}
|
||||
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;
|
||||
@ -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;
|
||||
|
||||
@ -859,7 +863,7 @@ int InsetText::SingleWidth(Painter & pain, LyXParagraph * par, int pos) const
|
||||
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
|
||||
@ -905,7 +909,7 @@ LyXFont InsetText::GetFont(LyXParagraph * par, int pos) const
|
||||
{
|
||||
char par_depth = par->GetDepth();
|
||||
|
||||
LyXLayout layout =
|
||||
LyXLayout const & layout =
|
||||
textclasslist.Style(buffer->params.textclass, par->GetLayout());
|
||||
|
||||
// We specialize the 95% common case:
|
||||
@ -989,8 +993,7 @@ int InsetText::InsetInInsetY()
|
||||
if (!the_locking_inset)
|
||||
return 0;
|
||||
|
||||
int
|
||||
y = inset_y;
|
||||
int y = inset_y;
|
||||
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)
|
||||
{
|
||||
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;
|
||||
@ -1247,7 +1251,7 @@ void InsetText::SetCharFont(int pos, LyXFont const & f)
|
||||
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
|
||||
@ -1292,7 +1296,7 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
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)
|
||||
@ -1310,7 +1314,7 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
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);
|
||||
@ -1323,13 +1327,13 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
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;
|
||||
@ -1360,14 +1364,14 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
} 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;
|
||||
@ -1377,7 +1381,7 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
width = lastWordWidth;
|
||||
}
|
||||
wordAscent = wordDescent = lastWordWidth = 0;
|
||||
nwp = p+1;
|
||||
nwp = p + 1;
|
||||
continue;
|
||||
}
|
||||
owidth = width;
|
||||
@ -1386,7 +1390,7 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
if (odesc < wordDescent)
|
||||
odesc = wordDescent;
|
||||
wordAscent = wordDescent = lastWordWidth = 0;
|
||||
nwp = p+1;
|
||||
nwp = p + 1;
|
||||
is_first_word_in_row = false;
|
||||
}
|
||||
}
|
||||
@ -1394,13 +1398,13 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
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;
|
||||
@ -1412,8 +1416,8 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
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
|
||||
@ -1422,7 +1426,7 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
// 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
|
||||
@ -1430,7 +1434,7 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
computeBaselines(top_baseline);
|
||||
actpos = inset_pos;
|
||||
resetPos(bv);
|
||||
inset_x = cx-top_x;
|
||||
inset_x = cx - top_x;
|
||||
inset_y = cy;
|
||||
}
|
||||
#endif
|
||||
@ -1440,8 +1444,8 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,9 @@ public:
|
||||
///
|
||||
BIBTEX_CODE,
|
||||
///
|
||||
TEXT_CODE
|
||||
TEXT_CODE,
|
||||
///
|
||||
SPECIALCHAR_CODE
|
||||
};
|
||||
|
||||
///
|
||||
|
321
src/layout.C
321
src/layout.C
@ -94,6 +94,7 @@ enum LayoutTags {
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
// This table is sorted alphabetically [asierra 30March96]
|
||||
static keyword_item layoutTags[] = {
|
||||
{ "align", LT_ALIGN },
|
||||
@ -133,6 +134,7 @@ static keyword_item layoutTags[] = {
|
||||
{ "textfont", LT_TEXTFONT },
|
||||
{ "topsep", LT_TOPSEP }
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////
|
||||
@ -171,6 +173,47 @@ LyXLayout::LyXLayout ()
|
||||
// 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);
|
||||
@ -392,6 +435,7 @@ enum AlignTags {
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
static keyword_item alignTags[] = {
|
||||
{ "block", AT_BLOCK },
|
||||
{ "center", AT_CENTER },
|
||||
@ -399,10 +443,19 @@ static keyword_item alignTags[] = {
|
||||
{ "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) {
|
||||
@ -433,6 +486,15 @@ void LyXLayout::readAlign(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);
|
||||
alignpossible = LYX_ALIGN_NONE;
|
||||
int lineno = lexrc.GetLineNo();
|
||||
@ -487,6 +549,7 @@ enum LabelTypeTags {
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
static keyword_item labelTypeTags[] = {
|
||||
{ "bibliography", LA_BIBLIO },
|
||||
{ "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT },
|
||||
@ -506,10 +569,32 @@ static keyword_item labelTypeTags[] = {
|
||||
{ "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) {
|
||||
@ -574,97 +659,87 @@ void LyXLayout::readLabelType(LyXLex & lexrc)
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
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_MANUAL:
|
||||
margintype = MARGIN_MANUAL;
|
||||
break;
|
||||
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;
|
||||
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;
|
||||
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_COMMAND:
|
||||
latextype= LATEX_COMMAND;
|
||||
break;
|
||||
case LX_ENVIRONMENT:
|
||||
latextype= LATEX_ENVIRONMENT;
|
||||
break;
|
||||
case LX_ITEM_ENVIRONMENT:
|
||||
latextype= LATEX_ITEM_ENVIRONMENT;
|
||||
break;
|
||||
case LX_LIST_ENVIRONMENT:
|
||||
latextype= LATEX_LIST_ENVIRONMENT;
|
||||
default:
|
||||
lyxerr << "Unhandled value " << le
|
||||
<< " in LyXLayout::readLatexType." << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -678,16 +753,26 @@ enum SpacingTags {
|
||||
};
|
||||
|
||||
|
||||
#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) {
|
||||
@ -773,6 +858,7 @@ enum TextClassTags {
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
static keyword_item textClassTags[] = {
|
||||
{ "classoptions", TC_CLASSOPTIONS },
|
||||
{ "columns", TC_COLUMNS },
|
||||
@ -793,11 +879,34 @@ static keyword_item textClassTags[] = {
|
||||
{ "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)
|
||||
@ -972,44 +1081,42 @@ bool LyXTextClass::Read(string const & filename, bool merge)
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
return;
|
||||
case LATEX:
|
||||
case LINUXDOC:
|
||||
case DOCBOOK:
|
||||
case LITERATE:
|
||||
outputType_ = static_cast<OutputType>(le);
|
||||
break;
|
||||
case OT_OTLINUXDOC:
|
||||
outputType_ = LINUXDOC;
|
||||
break;
|
||||
case OT_OTDOCBOOK:
|
||||
outputType_ = DOCBOOK;
|
||||
break;
|
||||
case OT_OTLITERATE:
|
||||
outputType_ = LITERATE;
|
||||
default:
|
||||
lyxerr << "Unhandled value " << le
|
||||
<< " in LyXTextClass::readOutputType." << endl;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1029,6 +1136,7 @@ enum MaxCounterTags {
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
static keyword_item maxCounterTags[] = {
|
||||
{"counter_chapter", MC_COUNTER_CHAPTER },
|
||||
{"counter_enumi", MC_COUNTER_ENUMI },
|
||||
@ -1041,10 +1149,25 @@ static keyword_item maxCounterTags[] = {
|
||||
{"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) {
|
||||
@ -1096,16 +1219,26 @@ enum ClassOptionsTags {
|
||||
};
|
||||
|
||||
|
||||
#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()) {
|
||||
|
@ -42,7 +42,7 @@ enum { // no good name for this
|
||||
/// The different output types
|
||||
enum OutputType {
|
||||
///
|
||||
LATEX,
|
||||
LATEX = 1,
|
||||
///
|
||||
LINUXDOC,
|
||||
///
|
||||
@ -54,7 +54,7 @@ enum OutputType {
|
||||
/// The different margin types
|
||||
enum LYX_MARGIN_TYPE {
|
||||
///
|
||||
MARGIN_MANUAL,
|
||||
MARGIN_MANUAL = 1,
|
||||
///
|
||||
MARGIN_FIRST_DYNAMIC,
|
||||
///
|
||||
@ -92,7 +92,7 @@ inline void operator|=(LyXAlignment & la1, LyXAlignment la2) {
|
||||
/// The different LaTeX-Types
|
||||
enum LYX_LATEX_TYPES {
|
||||
///
|
||||
LATEX_PARAGRAPH,
|
||||
LATEX_PARAGRAPH = 1,
|
||||
///
|
||||
LATEX_COMMAND,
|
||||
///
|
||||
@ -268,7 +268,7 @@ public:
|
||||
char labeltype; // add approp. type
|
||||
|
||||
///
|
||||
char margintype; // add approp. type
|
||||
LYX_MARGIN_TYPE margintype;
|
||||
|
||||
///
|
||||
bool fill_top;
|
||||
|
@ -50,7 +50,7 @@ extern "C" void TableSpeCloseCB(FL_OBJECT *, long);
|
||||
|
||||
#include "bufferparams.h"
|
||||
|
||||
extern bool UpdateLayoutDocument(BufferParams *params = 0);
|
||||
extern bool UpdateLayoutDocument(BufferParams * params = 0);
|
||||
extern bool UpdateLayoutPreamble();
|
||||
extern bool UpdateLayoutPaper();
|
||||
extern bool UpdateLayoutQuotes();
|
||||
|
@ -3549,7 +3549,7 @@ extern "C" void RefHideCB(FL_OBJECT *, long)
|
||||
// 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, ' ');
|
||||
|
@ -43,6 +43,7 @@
|
||||
#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
|
||||
@ -117,7 +118,7 @@ extern Buffer * NewLyxFile(string const &);
|
||||
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();
|
||||
@ -835,7 +836,14 @@ string LyXFunc::Dispatch(int ac,
|
||||
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;
|
||||
@ -1081,7 +1089,7 @@ string LyXFunc::Dispatch(int ac,
|
||||
// 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.
|
||||
@ -1614,20 +1622,28 @@ string LyXFunc::Dispatch(int ac,
|
||||
|
||||
// --- 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:
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
///
|
||||
META_NEWLINE,
|
||||
///
|
||||
META_PROTECTED_SEPARATOR,
|
||||
//META_PROTECTED_SEPARATOR,
|
||||
///
|
||||
META_INSET
|
||||
};
|
||||
@ -465,8 +465,10 @@ public:
|
||||
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,
|
||||
|
@ -392,7 +392,8 @@ public:
|
||||
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 */
|
||||
|
@ -330,7 +330,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array,
|
||||
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;
|
||||
|
@ -39,8 +39,6 @@ using std::max;
|
||||
#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;
|
||||
@ -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)
|
||||
{
|
||||
BitmapMenu* menu = (BitmapMenu*)ob->u_vdata;
|
||||
BitmapMenu * menu = static_cast<BitmapMenu*>(ob->u_vdata);
|
||||
int i = menu->GetIndex(ob);
|
||||
char const *s = 0;
|
||||
|
||||
|
@ -35,7 +35,7 @@ using std::ios;
|
||||
#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)
|
||||
@ -280,10 +280,12 @@ void LyXParagraph::writeFile(ostream & os, BufferParams const & params,
|
||||
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;
|
||||
@ -297,7 +299,7 @@ void LyXParagraph::writeFile(ostream & os, BufferParams const & params,
|
||||
break;
|
||||
default:
|
||||
if ((column > 70 && c == ' ')
|
||||
|| column > 79){
|
||||
|| column > 79) {
|
||||
os << "\n";
|
||||
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;
|
||||
}
|
||||
@ -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 * 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
|
||||
* par = FirstPhysicalPar(),
|
||||
@ -1726,7 +1728,8 @@ int LyXParagraph::BeginningOfMainBody() const
|
||||
// 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()
|
||||
@ -2054,15 +2057,15 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow)
|
||||
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
|
||||
@ -2144,7 +2147,7 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow)
|
||||
}
|
||||
}
|
||||
|
||||
c = GetChar(i);
|
||||
int c = GetChar(i);
|
||||
|
||||
// Fully instantiated font
|
||||
LyXFont font = getFont(i);
|
||||
@ -2505,9 +2508,11 @@ bool LyXParagraph::linuxDocConvertChar(char c, string & sgml_string)
|
||||
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;
|
||||
@ -2976,10 +2981,11 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
|
||||
// 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
|
||||
@ -2994,10 +3000,11 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
|
||||
} else {
|
||||
// Plain mode (i.e. not LaTeX)
|
||||
switch (c) {
|
||||
#if 0
|
||||
case LyXParagraph::META_PROTECTED_SEPARATOR:
|
||||
file += '~';
|
||||
break;
|
||||
|
||||
#endif
|
||||
case '\\':
|
||||
file += "\\textbackslash{}";
|
||||
column += 15;
|
||||
@ -3169,6 +3176,7 @@ void LyXParagraph::SimpleTeXSpecialChars(string & file, TexRow & texrow,
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
bool LyXParagraph::RoffContTableRows(ostream & os,
|
||||
LyXParagraph::size_type i,
|
||||
int actcell)
|
||||
@ -3209,6 +3217,34 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
|
||||
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) {
|
||||
@ -3228,14 +3264,17 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
|
||||
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;
|
||||
@ -3253,6 +3292,7 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow,
|
||||
@ -3575,8 +3615,9 @@ LyXParagraph * LyXParagraph::TeXFootnote(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): "
|
||||
@ -3702,8 +3743,10 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
|
||||
// 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;
|
||||
@ -3737,8 +3780,10 @@ LyXParagraph * LyXParagraph::TeXFootnote(string & file, TexRow & texrow,
|
||||
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;
|
||||
|
@ -205,7 +205,7 @@ void back(string cmd, int retval)
|
||||
}
|
||||
|
||||
|
||||
int main(int, char**)
|
||||
int main(int, char **)
|
||||
{
|
||||
|
||||
SystemcallsSingletoncontroller::Startcontroller starter;
|
||||
|
@ -14,31 +14,43 @@
|
||||
#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
|
||||
@ -50,13 +62,15 @@ inline bool IsFloatChar(char c) {
|
||||
|
||||
|
||||
///
|
||||
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 == ')'
|
||||
@ -81,13 +95,16 @@ inline bool IsKommaChar(char 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
|
||||
@ -95,23 +112,26 @@ inline bool IsLetterChar(unsigned char c) {
|
||||
|
||||
|
||||
///
|
||||
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);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ using std::max;
|
||||
#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;
|
||||
|
||||
@ -1289,6 +1289,7 @@ int LyXTable::TexEndOfCell(string & file, int cell)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// cell <0 will tex the preamble
|
||||
// returns the number of printed newlines
|
||||
int LyXTable::RoffEndOfCell(ostream & os, int cell)
|
||||
@ -1381,6 +1382,7 @@ int LyXTable::RoffEndOfCell(ostream & os, int cell)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
char const *LyXTable::getDocBookAlign(int cell, bool isColumn)
|
||||
|
@ -166,8 +166,10 @@ public:
|
||||
// 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);
|
||||
///
|
||||
|
48
src/text.C
48
src/text.C
@ -1826,7 +1826,7 @@ void LyXText::TableFeatures(int feature) const
|
||||
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++;
|
||||
@ -1837,7 +1837,7 @@ void LyXText::TableFeatures(int feature) const
|
||||
++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);
|
||||
|
||||
@ -2383,7 +2383,7 @@ void LyXText::RedoParagraph() const
|
||||
|
||||
/* 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,
|
||||
@ -2391,14 +2391,18 @@ void LyXText::InsertChar(char c)
|
||||
|
||||
/* 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);
|
||||
@ -3942,8 +3946,10 @@ void LyXText::GetVisibleRow(int offset,
|
||||
} 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,
|
||||
@ -3973,6 +3979,7 @@ void LyXText::GetVisibleRow(int offset,
|
||||
offset + row_ptr->baseline + 2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
++vpos;
|
||||
} else
|
||||
draw(row_ptr, vpos, offset, x);
|
||||
@ -4079,8 +4086,10 @@ void LyXText::GetVisibleRow(int offset,
|
||||
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),
|
||||
@ -4111,6 +4120,7 @@ void LyXText::GetVisibleRow(int offset,
|
||||
offset + row_ptr->baseline + 2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
++vpos;
|
||||
} else
|
||||
draw(row_ptr, vpos, offset, x);
|
||||
@ -4142,7 +4152,7 @@ int LyXText::GetColumnNearX(Row * row, int & x) const
|
||||
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
|
||||
@ -4356,11 +4366,17 @@ void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind)
|
||||
|| 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);
|
||||
}
|
||||
}
|
||||
|
34
src/text2.C
34
src/text2.C
@ -22,6 +22,7 @@
|
||||
#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"
|
||||
@ -439,11 +440,11 @@ void LyXText::CloseFootnote()
|
||||
// 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))
|
||||
@ -459,7 +460,7 @@ void LyXText::MakeFontEntriesLayoutSpecific(LyXParagraph * 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;
|
||||
|
||||
@ -694,7 +695,7 @@ void LyXText::DecDepth()
|
||||
|
||||
|
||||
// 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) {
|
||||
@ -1472,8 +1473,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
|
||||
if (par->labelwidthstring.empty()) {
|
||||
par->SetLabelWidthString(layout.labelstring());
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
par->SetLabelWidthString(string());
|
||||
}
|
||||
|
||||
@ -2574,7 +2574,7 @@ void LyXText::InsertStringA(char const * s)
|
||||
|
||||
SetCursorParUndo();
|
||||
|
||||
char flag =
|
||||
bool flag =
|
||||
textclasslist.Style(parameters->textclass,
|
||||
cursor.par->GetLayout()).isEnvironment();
|
||||
// only to be sure, should not be neccessary
|
||||
@ -2604,11 +2604,23 @@ void LyXText::InsertStringA(char const * s)
|
||||
++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 &&
|
||||
@ -2630,6 +2642,7 @@ void LyXText::InsertStringA(char const * s)
|
||||
cell = NumberOfCell(par, pos);
|
||||
while((pos < par->size()) &&
|
||||
!(par->table->IsFirstCell(cell))) {
|
||||
|
||||
while((pos < par->size()) &&
|
||||
(par->GetChar(pos) != LyXParagraph::META_NEWLINE))
|
||||
++pos;
|
||||
@ -2641,7 +2654,13 @@ void LyXText::InsertStringA(char const * s)
|
||||
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);
|
||||
@ -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)
|
||||
{
|
||||
int ret = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user