mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
get rid of NO_LATEX, split some methods, small cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2417 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
abf2235642
commit
54e7ddb5d9
@ -889,7 +889,7 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
|
|||||||
(cursor.par()->getInset(cursor.pos() - 1)->editable())) {
|
(cursor.par()->getInset(cursor.pos() - 1)->editable())) {
|
||||||
Inset * tmpinset = cursor.par()->getInset(cursor.pos()-1);
|
Inset * tmpinset = cursor.par()->getInset(cursor.pos()-1);
|
||||||
LyXFont font = text->getFont(buffer_, cursor.par(),
|
LyXFont font = text->getFont(buffer_, cursor.par(),
|
||||||
cursor.pos()-1);
|
cursor.pos() - 1);
|
||||||
int const width = tmpinset->width(bv_, font);
|
int const width = tmpinset->width(bv_, font);
|
||||||
int const inset_x = font.isVisibleRightToLeft()
|
int const inset_x = font.isVisibleRightToLeft()
|
||||||
? cursor.x() : cursor.x() - width;
|
? cursor.x() : cursor.x() - width;
|
||||||
@ -1215,12 +1215,7 @@ void BufferView::Pimpl::setState()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
LyXText * text = bv_->getLyXText();
|
LyXText * text = bv_->getLyXText();
|
||||||
if (text->real_current_font.isRightToLeft()
|
if (text->real_current_font.isRightToLeft()) {
|
||||||
#ifndef NO_LATEX
|
|
||||||
&&
|
|
||||||
text->real_current_font.latex() != LyXFont::ON
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
if (owner_->getIntl()->keymap == Intl::PRIMARY)
|
if (owner_->getIntl()->keymap == Intl::PRIMARY)
|
||||||
owner_->getIntl()->KeyMapSec();
|
owner_->getIntl()->KeyMapSec();
|
||||||
} else {
|
} else {
|
||||||
@ -1602,14 +1597,6 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
|||||||
owner_->getDialogs()->setUserFreeFont();
|
owner_->getDialogs()->setUserFreeFont();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
case LFUN_TEX:
|
|
||||||
Tex(bv_);
|
|
||||||
setState();
|
|
||||||
owner_->showState();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case LFUN_FILE_INSERT:
|
case LFUN_FILE_INSERT:
|
||||||
{
|
{
|
||||||
MenuInsertLyXFile(argument);
|
MenuInsertLyXFile(argument);
|
||||||
@ -2863,18 +2850,6 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_GETLATEX:
|
|
||||||
{
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
LyXFont & font = bv_->getLyXText()->current_font;
|
|
||||||
if (font.latex() == LyXFont::ON)
|
|
||||||
owner_->getLyXFunc()->setMessage("L");
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
owner_->getLyXFunc()->setMessage("0");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
// --- accented characters ---------------------------
|
// --- accented characters ---------------------------
|
||||||
|
|
||||||
case LFUN_UMLAUT:
|
case LFUN_UMLAUT:
|
||||||
@ -3366,9 +3341,6 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout)
|
|||||||
string(),
|
string(),
|
||||||
0);
|
0);
|
||||||
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||||
#ifndef NO_LATEX
|
|
||||||
bv_->text->current_font.setLatex(LyXFont::OFF);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bv_->text->insertInset(bv_, inset);
|
bv_->text->insertInset(bv_, inset);
|
||||||
|
@ -272,9 +272,6 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
|||||||
f.setEmph(LyXFont::INHERIT);
|
f.setEmph(LyXFont::INHERIT);
|
||||||
f.setUnderbar(LyXFont::INHERIT);
|
f.setUnderbar(LyXFont::INHERIT);
|
||||||
f.setNoun(LyXFont::INHERIT);
|
f.setNoun(LyXFont::INHERIT);
|
||||||
#ifndef NO_LATEX
|
|
||||||
f.setLatex(LyXFont::INHERIT);
|
|
||||||
#endif
|
|
||||||
f.setColor(LColor::inherit);
|
f.setColor(LColor::inherit);
|
||||||
lyxerr << "Font '" << f.stateText(0)
|
lyxerr << "Font '" << f.stateText(0)
|
||||||
<< "' matched by\n" << font << endl;
|
<< "' matched by\n" << font << endl;
|
||||||
|
@ -357,7 +357,6 @@ void LyXAction::init()
|
|||||||
{ LFUN_SELFINSERT, "self-insert", "", Noop },
|
{ LFUN_SELFINSERT, "self-insert", "", Noop },
|
||||||
{ LFUN_CHARATCURSOR, "server-char-after", "", ReadOnly },
|
{ LFUN_CHARATCURSOR, "server-char-after", "", ReadOnly },
|
||||||
{ LFUN_GETFONT, "server-get-font", "", ReadOnly },
|
{ LFUN_GETFONT, "server-get-font", "", ReadOnly },
|
||||||
{ LFUN_GETLATEX, "server-get-latex", "", ReadOnly },
|
|
||||||
{ LFUN_GETLAYOUT, "server-get-layout", "", ReadOnly },
|
{ LFUN_GETLAYOUT, "server-get-layout", "", ReadOnly },
|
||||||
{ LFUN_GETNAME, "server-get-name", "", ReadOnly },
|
{ LFUN_GETNAME, "server-get-name", "", ReadOnly },
|
||||||
{ LFUN_GETTIP, "server-get-tip", "", ReadOnly },
|
{ LFUN_GETTIP, "server-get-tip", "", ReadOnly },
|
||||||
@ -376,9 +375,6 @@ void LyXAction::init()
|
|||||||
N_("Tabular Features"), Noop },
|
N_("Tabular Features"), Noop },
|
||||||
{ LFUN_INSET_TABULAR, "tabular-insert",
|
{ LFUN_INSET_TABULAR, "tabular-insert",
|
||||||
N_("Insert a new Tabular Inset"), Noop },
|
N_("Insert a new Tabular Inset"), Noop },
|
||||||
#ifndef NO_LATEX
|
|
||||||
{ LFUN_TEX, "tex-mode", N_("Toggle TeX style"), Noop },
|
|
||||||
#endif
|
|
||||||
{ LFUN_INSET_TEXT, "text-insert",
|
{ LFUN_INSET_TEXT, "text-insert",
|
||||||
N_("Insert a new Text Inset"), Noop },
|
N_("Insert a new Text Inset"), Noop },
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -201,10 +201,9 @@ void LyXView::updateLayoutChoice()
|
|||||||
toolbar->updateLayoutList(true);
|
toolbar->updateLayoutList(true);
|
||||||
last_textclass = int(buffer()->params.textclass);
|
last_textclass = int(buffer()->params.textclass);
|
||||||
current_layout = 0;
|
current_layout = 0;
|
||||||
} else
|
} else {
|
||||||
toolbar->updateLayoutList(false);
|
toolbar->updateLayoutList(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LyXTextClass::size_type layout =
|
LyXTextClass::size_type layout =
|
||||||
bufferview->text->cursor.par()->getLayout();
|
bufferview->text->cursor.par()->getLayout();
|
||||||
|
@ -332,12 +332,11 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (f.underbar() == LyXFont::ON
|
|
||||||
#ifndef NO_LATEX
|
if (f.underbar() == LyXFont::ON) {
|
||||||
&& f.latex() != LyXFont::ON
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
underline(f, x, y, lyxfont::width(s, ls, f));
|
underline(f, x, y, lyxfont::width(s, ls, f));
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,12 +374,11 @@ PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (f.underbar() == LyXFont::ON
|
|
||||||
#ifndef NO_LATEX
|
if (f.underbar() == LyXFont::ON) {
|
||||||
&& f.latex() != LyXFont::ON
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
underline(f, x, y, lyxfont::width(s, ls, f));
|
underline(f, x, y, lyxfont::width(s, ls, f));
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,15 +10,16 @@
|
|||||||
#include "ShareContainer.h"
|
#include "ShareContainer.h"
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
|
|
||||||
|
// Not yet... lyx 1.3.x or so
|
||||||
|
//#define NO_PEXTRA_REALLY 1
|
||||||
|
|
||||||
#include "ParameterStruct.h"
|
#include "ParameterStruct.h"
|
||||||
|
|
||||||
class VSpace;
|
class VSpace;
|
||||||
class Spacing;
|
class Spacing;
|
||||||
|
|
||||||
|
|
||||||
// Not yet... lyx 1.3.x or so
|
|
||||||
//#define NO_PEXTRA_REALLY 1
|
|
||||||
|
|
||||||
///
|
///
|
||||||
class ParagraphParameters {
|
class ParagraphParameters {
|
||||||
public:
|
public:
|
||||||
|
@ -65,9 +65,6 @@ void ToolbarDefaults::init()
|
|||||||
add(LFUN_DEPTH);
|
add(LFUN_DEPTH);
|
||||||
add(SEPARATOR);
|
add(SEPARATOR);
|
||||||
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
add(LFUN_TEX);
|
|
||||||
#endif
|
|
||||||
add(LFUN_MATH_MODE);
|
add(LFUN_MATH_MODE);
|
||||||
add(SEPARATOR);
|
add(SEPARATOR);
|
||||||
|
|
||||||
|
93
src/buffer.C
93
src/buffer.C
@ -285,6 +285,7 @@ namespace {
|
|||||||
|
|
||||||
string last_inset_read;
|
string last_inset_read;
|
||||||
|
|
||||||
|
#ifndef NO_COMPABILITY
|
||||||
struct ErtComp
|
struct ErtComp
|
||||||
{
|
{
|
||||||
ErtComp() : active(false), in_tabular(false) {
|
ErtComp() : active(false), in_tabular(false) {
|
||||||
@ -296,11 +297,12 @@ struct ErtComp
|
|||||||
|
|
||||||
std::stack<ErtComp> ert_stack;
|
std::stack<ErtComp> ert_stack;
|
||||||
ErtComp ert_comp;
|
ErtComp ert_comp;
|
||||||
|
#endif
|
||||||
|
|
||||||
} // anon
|
} // anon
|
||||||
|
|
||||||
|
|
||||||
|
#warning And _why_ is this here? (Lgb)
|
||||||
int unknown_layouts;
|
int unknown_layouts;
|
||||||
|
|
||||||
// candidate for move to BufferView
|
// candidate for move to BufferView
|
||||||
@ -314,12 +316,11 @@ int unknown_layouts;
|
|||||||
bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
|
bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
|
||||||
{
|
{
|
||||||
unknown_layouts = 0;
|
unknown_layouts = 0;
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
ert_comp.contents.erase();
|
ert_comp.contents.erase();
|
||||||
ert_comp.active = false;
|
ert_comp.active = false;
|
||||||
ert_comp.in_tabular = false;
|
ert_comp.in_tabular = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
Paragraph::depth_type depth = 0;
|
Paragraph::depth_type depth = 0;
|
||||||
bool the_end_read = false;
|
bool the_end_read = false;
|
||||||
@ -385,6 +386,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NO_COMPABILITY
|
||||||
void Buffer::insertErtContents(Paragraph * par, int & pos,
|
void Buffer::insertErtContents(Paragraph * par, int & pos,
|
||||||
LyXFont const & font, bool set_inactive)
|
LyXFont const & font, bool set_inactive)
|
||||||
{
|
{
|
||||||
@ -399,6 +401,7 @@ void Buffer::insertErtContents(Paragraph * par, int & pos,
|
|||||||
ert_comp.active = false;
|
ert_comp.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -410,6 +413,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
bool the_end_read = false;
|
bool the_end_read = false;
|
||||||
|
#ifndef NO_COMPABILITY
|
||||||
#ifndef NO_PEXTRA_REALLY
|
#ifndef NO_PEXTRA_REALLY
|
||||||
// This is super temporary but is needed to get the compability
|
// This is super temporary but is needed to get the compability
|
||||||
// mode for minipages work correctly together with new tabulars.
|
// mode for minipages work correctly together with new tabulars.
|
||||||
@ -419,9 +423,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
static Paragraph * minipar;
|
static Paragraph * minipar;
|
||||||
static Paragraph * parBeforeMinipage;
|
static Paragraph * parBeforeMinipage;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
if (token[0] != '\\') {
|
if (token[0] != '\\') {
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
if (ert_comp.active) {
|
if (ert_comp.active) {
|
||||||
ert_comp.contents += token;
|
ert_comp.contents += token;
|
||||||
} else {
|
} else {
|
||||||
@ -431,7 +435,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
par->insertChar(pos, (*cit), font);
|
par->insertChar(pos, (*cit), font);
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (token == "\\i") {
|
} else if (token == "\\i") {
|
||||||
@ -440,7 +444,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
par->insertInset(pos, inset, font);
|
par->insertInset(pos, inset, font);
|
||||||
++pos;
|
++pos;
|
||||||
} else if (token == "\\layout") {
|
} else if (token == "\\layout") {
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
ert_comp.in_tabular = false;
|
ert_comp.in_tabular = false;
|
||||||
// Do the insetert.
|
// Do the insetert.
|
||||||
insertErtContents(par, pos, font);
|
insertErtContents(par, pos, font);
|
||||||
@ -451,7 +455,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
= textclasslist.NumberOfLayout(params.textclass,
|
= textclasslist.NumberOfLayout(params.textclass,
|
||||||
layoutname);
|
layoutname);
|
||||||
|
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
if (compare_no_case(layoutname, "latex") == 0) {
|
if (compare_no_case(layoutname, "latex") == 0) {
|
||||||
ert_comp.active = true;
|
ert_comp.active = true;
|
||||||
}
|
}
|
||||||
@ -546,6 +550,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef NO_COMPABILITY
|
||||||
} else if (token == "\\begin_float") {
|
} else if (token == "\\begin_float") {
|
||||||
insertErtContents(par, pos, font);
|
insertErtContents(par, pos, font);
|
||||||
//insertErtContents(par, pos, font, false);
|
//insertErtContents(par, pos, font, false);
|
||||||
@ -634,6 +639,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
par->insertInset(pos, inset, font);
|
par->insertInset(pos, inset, font);
|
||||||
++pos;
|
++pos;
|
||||||
insertErtContents(par, pos, font);
|
insertErtContents(par, pos, font);
|
||||||
|
#endif
|
||||||
} else if (token == "\\begin_deeper") {
|
} else if (token == "\\begin_deeper") {
|
||||||
++depth;
|
++depth;
|
||||||
} else if (token == "\\end_deeper") {
|
} else if (token == "\\end_deeper") {
|
||||||
@ -932,24 +938,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
} else if (token == "\\size") {
|
} else if (token == "\\size") {
|
||||||
lex.next();
|
lex.next();
|
||||||
font.setLyXSize(lex.GetString());
|
font.setLyXSize(lex.GetString());
|
||||||
#ifndef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
#ifdef WITH_WARNINGS
|
|
||||||
#warning compatability hack needed
|
|
||||||
#endif
|
|
||||||
} else if (token == "\\latex") {
|
|
||||||
lex.next();
|
|
||||||
string const tok = lex.GetString();
|
|
||||||
// This is dirty, but gone with LyX3. (Asger)
|
|
||||||
if (tok == "no_latex")
|
|
||||||
font.setLatex(LyXFont::OFF);
|
|
||||||
else if (tok == "latex")
|
|
||||||
font.setLatex(LyXFont::ON);
|
|
||||||
else if (tok == "default")
|
|
||||||
font.setLatex(LyXFont::INHERIT);
|
|
||||||
else
|
|
||||||
lex.printError("Unknown LaTeX font flag "
|
|
||||||
"`$$Token'");
|
|
||||||
#else
|
|
||||||
} else if (token == "\\latex") {
|
} else if (token == "\\latex") {
|
||||||
lex.next();
|
lex.next();
|
||||||
string const tok = lex.GetString();
|
string const tok = lex.GetString();
|
||||||
@ -1015,6 +1004,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
} else if (token == "\\added_space_bottom") {
|
} else if (token == "\\added_space_bottom") {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
par->params().spaceBottom(VSpace(lex.GetString()));
|
par->params().spaceBottom(VSpace(lex.GetString()));
|
||||||
|
#ifndef NO_COMPABILITY
|
||||||
#ifndef NO_PEXTRA_REALLY
|
#ifndef NO_PEXTRA_REALLY
|
||||||
} else if (token == "\\pextra_type") {
|
} else if (token == "\\pextra_type") {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
@ -1034,6 +1024,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
} else if (token == "\\pextra_start_minipage") {
|
} else if (token == "\\pextra_start_minipage") {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
par->params().pextraStartMinipage(lex.GetInteger());
|
par->params().pextraStartMinipage(lex.GetInteger());
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
} else if (token == "\\labelwidthstring") {
|
} else if (token == "\\labelwidthstring") {
|
||||||
lex.EatLine();
|
lex.EatLine();
|
||||||
@ -1048,13 +1039,13 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
// But insets should read it, it is a part of
|
// But insets should read it, it is a part of
|
||||||
// the inset isn't it? Lgb.
|
// the inset isn't it? Lgb.
|
||||||
} else if (token == "\\begin_inset") {
|
} else if (token == "\\begin_inset") {
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
insertErtContents(par, pos, font, false);
|
insertErtContents(par, pos, font, false);
|
||||||
ert_stack.push(ert_comp);
|
ert_stack.push(ert_comp);
|
||||||
ert_comp = ErtComp();
|
ert_comp = ErtComp();
|
||||||
#endif
|
#endif
|
||||||
readInset(lex, par, pos, font);
|
readInset(lex, par, pos, font);
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
ert_comp = ert_stack.top();
|
ert_comp = ert_stack.top();
|
||||||
ert_stack.pop();
|
ert_stack.pop();
|
||||||
insertErtContents(par, pos, font);
|
insertErtContents(par, pos, font);
|
||||||
@ -1088,8 +1079,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
}
|
}
|
||||||
++pos;
|
++pos;
|
||||||
} else if (token == "\\newline") {
|
} else if (token == "\\newline") {
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
|
|
||||||
if (!ert_comp.in_tabular && ert_comp.active) {
|
if (!ert_comp.in_tabular && ert_comp.active) {
|
||||||
ert_comp.contents += char(Paragraph::META_NEWLINE);
|
ert_comp.contents += char(Paragraph::META_NEWLINE);
|
||||||
} else {
|
} else {
|
||||||
@ -1106,7 +1096,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
++pos;
|
++pos;
|
||||||
#endif
|
#endif
|
||||||
} else if (token == "\\LyXTable") {
|
} else if (token == "\\LyXTable") {
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
ert_comp.in_tabular = true;
|
ert_comp.in_tabular = true;
|
||||||
#endif
|
#endif
|
||||||
Inset * inset = new InsetTabular(*this);
|
Inset * inset = new InsetTabular(*this);
|
||||||
@ -1138,28 +1128,30 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
}
|
}
|
||||||
par->bibkey->read(this, lex);
|
par->bibkey->read(this, lex);
|
||||||
} else if (token == "\\backslash") {
|
} else if (token == "\\backslash") {
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
if (ert_comp.active) {
|
if (ert_comp.active) {
|
||||||
ert_comp.contents += "\\";
|
ert_comp.contents += "\\";
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
par->insertChar(pos, '\\', font);
|
par->insertChar(pos, '\\', font);
|
||||||
++pos;
|
++pos;
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (token == "\\the_end") {
|
} else if (token == "\\the_end") {
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
// If we still have some ert active here we have to insert
|
// If we still have some ert active here we have to insert
|
||||||
// it so we don't loose it. (Lgb)
|
// it so we don't loose it. (Lgb)
|
||||||
insertErtContents(par, pos, font);
|
insertErtContents(par, pos, font);
|
||||||
#endif
|
#endif
|
||||||
the_end_read = true;
|
the_end_read = true;
|
||||||
|
#ifndef NO_COMPABILITY
|
||||||
#ifndef NO_PEXTRA_REALLY
|
#ifndef NO_PEXTRA_REALLY
|
||||||
minipar = parBeforeMinipage = 0;
|
minipar = parBeforeMinipage = 0;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
if (ert_comp.active) {
|
if (ert_comp.active) {
|
||||||
ert_comp.contents += token;
|
ert_comp.contents += token;
|
||||||
} else {
|
} else {
|
||||||
@ -1173,11 +1165,12 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
par->insertChar(pos, (*cit), font);
|
par->insertChar(pos, (*cit), font);
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NO_COMPABILITY
|
||||||
#ifndef NO_PEXTRA_REALLY
|
#ifndef NO_PEXTRA_REALLY
|
||||||
// I wonder if we could use this blanket fix for all the
|
// I wonder if we could use this blanket fix for all the
|
||||||
// checkminipage cases...
|
// checkminipage cases...
|
||||||
@ -1330,6 +1323,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
|||||||
}
|
}
|
||||||
// End of pextra_minipage compability
|
// End of pextra_minipage compability
|
||||||
--call_depth;
|
--call_depth;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return the_end_read;
|
return the_end_read;
|
||||||
}
|
}
|
||||||
@ -1805,9 +1799,6 @@ string const Buffer::asciiParagraph(Paragraph const * par,
|
|||||||
lyxerr << "Should this ever happen?" << endl;
|
lyxerr << "Should this ever happen?" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
LyXFont const font1 = LyXFont(LyXFont::ALL_INHERIT, params.language);
|
|
||||||
#endif
|
|
||||||
for (Paragraph::size_type i = 0; i < par->size(); ++i) {
|
for (Paragraph::size_type i = 0; i < par->size(); ++i) {
|
||||||
if (!i && !noparbreak) {
|
if (!i && !noparbreak) {
|
||||||
if (linelen > 0)
|
if (linelen > 0)
|
||||||
@ -1846,17 +1837,6 @@ string const Buffer::asciiParagraph(Paragraph const * par,
|
|||||||
currlinelen += (ltype_depth-depth)*2;
|
currlinelen += (ltype_depth-depth)*2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef NO_LATEX
|
|
||||||
LyXFont const font2 = par->getFontSettings(params, i);
|
|
||||||
if (font1.latex() != font2.latex()) {
|
|
||||||
if (font2.latex() == LyXFont::OFF)
|
|
||||||
islatex = 0;
|
|
||||||
else
|
|
||||||
islatex = 1;
|
|
||||||
} else {
|
|
||||||
islatex = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char c = par->getUChar(params, i);
|
char c = par->getUChar(params, i);
|
||||||
if (islatex)
|
if (islatex)
|
||||||
@ -2960,11 +2940,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (style.latexparam() == "CDATA") {
|
||||||
#ifndef NO_LATEX
|
|
||||||
font.latex() == LyXFont::ON ||
|
|
||||||
#endif
|
|
||||||
style.latexparam() == "CDATA") {
|
|
||||||
// "TeX"-Mode on == > SGML-Mode on.
|
// "TeX"-Mode on == > SGML-Mode on.
|
||||||
if (c != '\0')
|
if (c != '\0')
|
||||||
os << c;
|
os << c;
|
||||||
@ -3377,13 +3353,6 @@ void Buffer::simpleDocBookOnePar(ostream & os, string & extra,
|
|||||||
else
|
else
|
||||||
os << tmp_out;
|
os << tmp_out;
|
||||||
}
|
}
|
||||||
#ifndef NO_LATEX
|
|
||||||
} else if (font.latex() == LyXFont::ON) {
|
|
||||||
// "TeX"-Mode on ==> SGML-Mode on.
|
|
||||||
if (c != '\0')
|
|
||||||
os << c;
|
|
||||||
++char_line_count;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
string sgml_string;
|
string sgml_string;
|
||||||
if (par->linuxDocConvertChar(c, sgml_string)
|
if (par->linuxDocConvertChar(c, sgml_string)
|
||||||
|
@ -31,6 +31,11 @@ class TeXErrors;
|
|||||||
class LaTeXFeatures;
|
class LaTeXFeatures;
|
||||||
class Language;
|
class Language;
|
||||||
|
|
||||||
|
// When lyx 1.3.x starts we should enable this
|
||||||
|
// btw. we should also test this with 1.2 so that we
|
||||||
|
// do not get any surprises. (Lgb)
|
||||||
|
//#define NO_COMPABILITY 1
|
||||||
|
|
||||||
///
|
///
|
||||||
struct DEPCLEAN {
|
struct DEPCLEAN {
|
||||||
///
|
///
|
||||||
@ -127,10 +132,12 @@ public:
|
|||||||
///
|
///
|
||||||
void insertStringAsLines(Paragraph *&, Paragraph::size_type &,
|
void insertStringAsLines(Paragraph *&, Paragraph::size_type &,
|
||||||
LyXFont const &, string const &) const;
|
LyXFont const &, string const &) const;
|
||||||
|
#ifndef NO_COMPABILITY
|
||||||
///
|
///
|
||||||
void insertErtContents(Paragraph * par, int & pos,
|
void insertErtContents(Paragraph * par, int & pos,
|
||||||
LyXFont const & font,
|
LyXFont const & font,
|
||||||
bool set_inactive = true);
|
bool set_inactive = true);
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
Paragraph * getParFromID(int id) const;
|
Paragraph * getParFromID(int id) const;
|
||||||
private:
|
private:
|
||||||
|
@ -72,16 +72,6 @@ void lang(BufferView * bv, string const & l)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
void tex(BufferView * bv)
|
|
||||||
{
|
|
||||||
LyXFont font(LyXFont::ALL_IGNORE);
|
|
||||||
font.setLatex (LyXFont::TOGGLE);
|
|
||||||
toggleAndShow(bv, font);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Change environment depth.
|
// Change environment depth.
|
||||||
// if decInc >= 0, increment depth
|
// if decInc >= 0, increment depth
|
||||||
// if decInc < 0, decrement depth
|
// if decInc < 0, decrement depth
|
||||||
@ -229,9 +219,6 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
|
|||||||
bv->update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
bv->update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
|
||||||
|
|
||||||
if (font.language() != ignore_language ||
|
if (font.language() != ignore_language ||
|
||||||
#ifndef NO_LATEX
|
|
||||||
font.latex() != LyXFont::IGNORE ||
|
|
||||||
#endif
|
|
||||||
font.number() != LyXFont::IGNORE)
|
font.number() != LyXFont::IGNORE)
|
||||||
{
|
{
|
||||||
LyXCursor & cursor = text->cursor;
|
LyXCursor & cursor = text->cursor;
|
||||||
|
@ -12,9 +12,6 @@
|
|||||||
|
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
|
||||||
// this will not be needed anymore when NO_LATEX is the default.
|
|
||||||
#include "lyxfont.h"
|
|
||||||
|
|
||||||
/** These are all the lyxfunctions (as enums).
|
/** These are all the lyxfunctions (as enums).
|
||||||
Please add new functions at the end of the enum, right
|
Please add new functions at the end of the enum, right
|
||||||
before LFUN_LASTACTION.
|
before LFUN_LASTACTION.
|
||||||
@ -53,9 +50,6 @@ enum kb_action {
|
|||||||
LFUN_HFILL,
|
LFUN_HFILL,
|
||||||
LFUN_DEPTH,
|
LFUN_DEPTH,
|
||||||
LFUN_FREE, // 30
|
LFUN_FREE, // 30
|
||||||
#ifndef NO_LATEX
|
|
||||||
LFUN_TEX,
|
|
||||||
#endif
|
|
||||||
#if 0
|
#if 0
|
||||||
LFUN_FOOTMELT, // schedule for deletion
|
LFUN_FOOTMELT, // schedule for deletion
|
||||||
LFUN_MARGINMELT, // schedule for deletion
|
LFUN_MARGINMELT, // schedule for deletion
|
||||||
@ -125,7 +119,6 @@ enum kb_action {
|
|||||||
LFUN_LINEATCURSOR,
|
LFUN_LINEATCURSOR,
|
||||||
LFUN_GETLAYOUT,
|
LFUN_GETLAYOUT,
|
||||||
LFUN_GETFONT,
|
LFUN_GETFONT,
|
||||||
LFUN_GETLATEX,
|
|
||||||
LFUN_GETNAME, // 100
|
LFUN_GETNAME, // 100
|
||||||
LFUN_NOTIFY,
|
LFUN_NOTIFY,
|
||||||
LFUN_GOTOFILEROW, // Edmar 12/23/98
|
LFUN_GOTOFILEROW, // Edmar 12/23/98
|
||||||
|
@ -143,10 +143,6 @@ character::FONT_STATE ControlCharacter::getBar() const
|
|||||||
|
|
||||||
else if (font_->noun() != LyXFont::IGNORE)
|
else if (font_->noun() != LyXFont::IGNORE)
|
||||||
return character::NOUN_TOGGLE;
|
return character::NOUN_TOGGLE;
|
||||||
#ifndef NO_LATEX
|
|
||||||
else if (font_->latex() != LyXFont::IGNORE)
|
|
||||||
return character::LATEX_TOGGLE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return character::IGNORE;
|
return character::IGNORE;
|
||||||
}
|
}
|
||||||
@ -159,9 +155,6 @@ void ControlCharacter::setBar(character::FONT_STATE val)
|
|||||||
font_->setEmph(LyXFont::IGNORE);
|
font_->setEmph(LyXFont::IGNORE);
|
||||||
font_->setUnderbar(LyXFont::IGNORE);
|
font_->setUnderbar(LyXFont::IGNORE);
|
||||||
font_->setNoun(LyXFont::IGNORE);
|
font_->setNoun(LyXFont::IGNORE);
|
||||||
#ifndef NO_LATEX
|
|
||||||
font_->setLatex(LyXFont::IGNORE);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case character::EMPH_TOGGLE:
|
case character::EMPH_TOGGLE:
|
||||||
@ -176,19 +169,10 @@ void ControlCharacter::setBar(character::FONT_STATE val)
|
|||||||
font_->setNoun(LyXFont::TOGGLE);
|
font_->setNoun(LyXFont::TOGGLE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
case character::LATEX_TOGGLE:
|
|
||||||
font_->setLatex(LyXFont::TOGGLE);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case character::INHERIT:
|
case character::INHERIT:
|
||||||
font_->setEmph(LyXFont::INHERIT);
|
font_->setEmph(LyXFont::INHERIT);
|
||||||
font_->setUnderbar(LyXFont::INHERIT);
|
font_->setUnderbar(LyXFont::INHERIT);
|
||||||
font_->setNoun(LyXFont::INHERIT);
|
font_->setNoun(LyXFont::INHERIT);
|
||||||
#ifndef NO_LATEX
|
|
||||||
font_->setLatex(LyXFont::INHERIT);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2001-08-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||||
|
|
||||||
|
* inset.C (convertFont): delete method. not used.
|
||||||
|
|
||||||
2001-08-03 Juergen Vigna <jug@sad.it>
|
2001-08-03 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* insettext.C (setFont): don't call for a draw update if we're just
|
* insettext.C (setFont): don't call for a draw update if we're just
|
||||||
|
@ -86,10 +86,16 @@ void Inset::edit(BufferView *, bool)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
LyXFont const Inset::convertFont(LyXFont const & font) const
|
LyXFont const Inset::convertFont(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
|
return font;
|
||||||
|
#else
|
||||||
return LyXFont(font);
|
return LyXFont(font);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
string const Inset::editMessage() const
|
string const Inset::editMessage() const
|
||||||
|
@ -148,8 +148,10 @@ public:
|
|||||||
/// update the inset representation
|
/// update the inset representation
|
||||||
virtual void update(BufferView *, LyXFont const &, bool = false)
|
virtual void update(BufferView *, LyXFont const &, bool = false)
|
||||||
{}
|
{}
|
||||||
|
#if 0
|
||||||
///
|
///
|
||||||
virtual LyXFont const convertFont(LyXFont const & font) const;
|
virtual LyXFont const convertFont(LyXFont const & font) const;
|
||||||
|
#endif
|
||||||
/// what appears in the minibuffer when opening
|
/// what appears in the minibuffer when opening
|
||||||
virtual string const editMessage() const;
|
virtual string const editMessage() const;
|
||||||
///
|
///
|
||||||
|
@ -39,11 +39,7 @@ InsetInfo::InsetInfo()
|
|||||||
: form(0), labelfont(LyXFont::ALL_SANE)
|
: form(0), labelfont(LyXFont::ALL_SANE)
|
||||||
{
|
{
|
||||||
labelfont.decSize().decSize()
|
labelfont.decSize().decSize()
|
||||||
.setColor(LColor::note)
|
.setColor(LColor::note);
|
||||||
#ifndef NO_LATEX
|
|
||||||
.setLatex(LyXFont::OFF)
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -51,11 +47,7 @@ InsetInfo::InsetInfo(string const & str)
|
|||||||
: contents(str), form(0), labelfont(LyXFont::ALL_SANE)
|
: contents(str), form(0), labelfont(LyXFont::ALL_SANE)
|
||||||
{
|
{
|
||||||
labelfont.decSize().decSize()
|
labelfont.decSize().decSize()
|
||||||
.setColor(LColor::note)
|
.setColor(LColor::note);
|
||||||
#ifndef NO_LATEX
|
|
||||||
.setLatex(LyXFont::OFF)
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -207,15 +207,17 @@ int InsetQuotes::width(BufferView *, LyXFont const & font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
LyXFont const InsetQuotes::convertFont(LyXFont const & f) const
|
LyXFont const InsetQuotes::convertFont(LyXFont const & f) const
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
|
return f;
|
||||||
|
#else
|
||||||
LyXFont font(f);
|
LyXFont font(f);
|
||||||
#ifndef NO_LATEX
|
|
||||||
// quotes-insets cannot be latex of any kind
|
|
||||||
font.setLatex(LyXFont::OFF);
|
|
||||||
#endif
|
|
||||||
return font;
|
return font;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void InsetQuotes::draw(BufferView * bv, LyXFont const & font,
|
void InsetQuotes::draw(BufferView * bv, LyXFont const & font,
|
||||||
|
@ -80,8 +80,10 @@ public:
|
|||||||
int width(BufferView *, LyXFont const &) const;
|
int width(BufferView *, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
||||||
|
#if 0
|
||||||
///
|
///
|
||||||
LyXFont const convertFont(LyXFont const & font) const;
|
LyXFont const convertFont(LyXFont const & font) const;
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
void write(Buffer const *, std::ostream &) const;
|
void write(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
|
@ -240,7 +240,7 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
|
|||||||
if (token.empty())
|
if (token.empty())
|
||||||
continue;
|
continue;
|
||||||
if (token == "\\end_inset") {
|
if (token == "\\end_inset") {
|
||||||
#ifdef NO_LATEX
|
#ifndef NO_COMPABILITY
|
||||||
const_cast<Buffer*>(buf)->insertErtContents(par, pos, font, false);
|
const_cast<Buffer*>(buf)->insertErtContents(par, pos, font, false);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -43,10 +43,6 @@
|
|||||||
#include "converter.h"
|
#include "converter.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "support/os.h"
|
#include "support/os.h"
|
||||||
// for NO_LATEX
|
|
||||||
#if 1
|
|
||||||
#include "lyxfont.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
|
@ -107,9 +107,6 @@ LyXFont::FontBits LyXFont::sane = {
|
|||||||
SIZE_NORMAL,
|
SIZE_NORMAL,
|
||||||
LColor::none,
|
LColor::none,
|
||||||
OFF,
|
OFF,
|
||||||
#ifndef NO_LATEX
|
|
||||||
OFF,
|
|
||||||
#endif
|
|
||||||
OFF,
|
OFF,
|
||||||
OFF,
|
OFF,
|
||||||
OFF };
|
OFF };
|
||||||
@ -122,9 +119,6 @@ LyXFont::FontBits LyXFont::inherit = {
|
|||||||
INHERIT_SIZE,
|
INHERIT_SIZE,
|
||||||
LColor::inherit,
|
LColor::inherit,
|
||||||
INHERIT,
|
INHERIT,
|
||||||
#ifndef NO_LATEX
|
|
||||||
INHERIT,
|
|
||||||
#endif
|
|
||||||
INHERIT,
|
INHERIT,
|
||||||
INHERIT,
|
INHERIT,
|
||||||
OFF };
|
OFF };
|
||||||
@ -137,9 +131,6 @@ LyXFont::FontBits LyXFont::ignore = {
|
|||||||
IGNORE_SIZE,
|
IGNORE_SIZE,
|
||||||
LColor::ignore,
|
LColor::ignore,
|
||||||
IGNORE,
|
IGNORE,
|
||||||
#ifndef NO_LATEX
|
|
||||||
IGNORE,
|
|
||||||
#endif
|
|
||||||
IGNORE,
|
IGNORE,
|
||||||
IGNORE,
|
IGNORE,
|
||||||
IGNORE };
|
IGNORE };
|
||||||
@ -155,9 +146,6 @@ bool LyXFont::FontBits::operator==(LyXFont::FontBits const & fb1) const
|
|||||||
fb1.emph == emph &&
|
fb1.emph == emph &&
|
||||||
fb1.underbar == underbar &&
|
fb1.underbar == underbar &&
|
||||||
fb1.noun == noun &&
|
fb1.noun == noun &&
|
||||||
#ifndef NO_LATEX
|
|
||||||
fb1.latex == latex &&
|
|
||||||
#endif
|
|
||||||
fb1.number == number;
|
fb1.number == number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,14 +192,6 @@ LyXFont::FONT_MISC_STATE LyXFont::underbar() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
LyXFont::FONT_MISC_STATE LyXFont::latex() const
|
|
||||||
{
|
|
||||||
return bits.latex;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
LColor::color LyXFont::color() const
|
LColor::color LyXFont::color() const
|
||||||
{
|
{
|
||||||
return bits.color;
|
return bits.color;
|
||||||
@ -239,9 +219,6 @@ bool LyXFont::isRightToLeft() const
|
|||||||
bool LyXFont::isVisibleRightToLeft() const
|
bool LyXFont::isVisibleRightToLeft() const
|
||||||
{
|
{
|
||||||
return (lang->RightToLeft() &&
|
return (lang->RightToLeft() &&
|
||||||
#ifndef NO_LATEX
|
|
||||||
latex() != ON &&
|
|
||||||
#endif
|
|
||||||
number() != ON);
|
number() != ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,15 +272,6 @@ LyXFont & LyXFont::setNoun(LyXFont::FONT_MISC_STATE n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
|
|
||||||
{
|
|
||||||
bits.latex = l;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
LyXFont & LyXFont::setColor(LColor::color c)
|
LyXFont & LyXFont::setColor(LColor::color c)
|
||||||
{
|
{
|
||||||
bits.color = c;
|
bits.color = c;
|
||||||
@ -452,9 +420,6 @@ void LyXFont::update(LyXFont const & newfont, bool toggleall)
|
|||||||
setEmph(setMisc(newfont.emph(), emph()));
|
setEmph(setMisc(newfont.emph(), emph()));
|
||||||
setUnderbar(setMisc(newfont.underbar(), underbar()));
|
setUnderbar(setMisc(newfont.underbar(), underbar()));
|
||||||
setNoun(setMisc(newfont.noun(), noun()));
|
setNoun(setMisc(newfont.noun(), noun()));
|
||||||
#ifndef NO_LATEX
|
|
||||||
setLatex(setMisc(newfont.latex(), latex()));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
setNumber(setMisc(newfont.number(), number()));
|
setNumber(setMisc(newfont.number(), number()));
|
||||||
if (newfont.language() == language() && toggleall)
|
if (newfont.language() == language() && toggleall)
|
||||||
@ -486,10 +451,6 @@ void LyXFont::reduce(LyXFont const & tmplt)
|
|||||||
setUnderbar(INHERIT);
|
setUnderbar(INHERIT);
|
||||||
if (noun() == tmplt.noun())
|
if (noun() == tmplt.noun())
|
||||||
setNoun(INHERIT);
|
setNoun(INHERIT);
|
||||||
#ifndef NO_LATEX
|
|
||||||
if (latex() == tmplt.latex())
|
|
||||||
setLatex(INHERIT);
|
|
||||||
#endif
|
|
||||||
if (color() == tmplt.color())
|
if (color() == tmplt.color())
|
||||||
setColor(LColor::inherit);
|
setColor(LColor::inherit);
|
||||||
if (language() == tmplt.language())
|
if (language() == tmplt.language())
|
||||||
@ -536,11 +497,6 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt, Language const * deflang)
|
|||||||
if (bits.noun == INHERIT) {
|
if (bits.noun == INHERIT) {
|
||||||
bits.noun = tmplt.bits.noun;
|
bits.noun = tmplt.bits.noun;
|
||||||
}
|
}
|
||||||
#ifndef NO_LATEX
|
|
||||||
if (bits.latex == INHERIT) {
|
|
||||||
bits.latex = tmplt.bits.latex;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (bits.color == LColor::inherit) {
|
if (bits.color == LColor::inherit) {
|
||||||
bits.color = tmplt.bits.color;
|
bits.color = tmplt.bits.color;
|
||||||
}
|
}
|
||||||
@ -555,9 +511,6 @@ bool LyXFont::resolved() const
|
|||||||
shape() != INHERIT_SHAPE && size() != INHERIT_SIZE &&
|
shape() != INHERIT_SHAPE && size() != INHERIT_SIZE &&
|
||||||
emph() != INHERIT && underbar() != INHERIT &&
|
emph() != INHERIT && underbar() != INHERIT &&
|
||||||
noun() != INHERIT &&
|
noun() != INHERIT &&
|
||||||
#ifndef NO_LATEX
|
|
||||||
latex() != INHERIT &&
|
|
||||||
#endif
|
|
||||||
color() != LColor::inherit &&
|
color() != LColor::inherit &&
|
||||||
language() != inherit_language);
|
language() != inherit_language);
|
||||||
}
|
}
|
||||||
@ -585,10 +538,6 @@ string const LyXFont::stateText(BufferParams * params) const
|
|||||||
<< _(GUIMiscNames[underbar()]) << ", ";
|
<< _(GUIMiscNames[underbar()]) << ", ";
|
||||||
if (noun() != INHERIT)
|
if (noun() != INHERIT)
|
||||||
ost << _("Noun ") << _(GUIMiscNames[noun()]) << ", ";
|
ost << _("Noun ") << _(GUIMiscNames[noun()]) << ", ";
|
||||||
#ifndef NO_LATEX
|
|
||||||
if (latex() != INHERIT)
|
|
||||||
ost << _("Latex ") << _(GUIMiscNames[latex()]) << ", ";
|
|
||||||
#endif
|
|
||||||
if (bits == inherit)
|
if (bits == inherit)
|
||||||
ost << _("Default") << ", ";
|
ost << _("Default") << ", ";
|
||||||
if (!params || (language() != params->language))
|
if (!params || (language() != params->language))
|
||||||
@ -725,19 +674,6 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex)
|
|||||||
lex.next();
|
lex.next();
|
||||||
string const ttok = lex.GetString();
|
string const ttok = lex.GetString();
|
||||||
setLyXSize(ttok);
|
setLyXSize(ttok);
|
||||||
#ifndef NO_LATEX
|
|
||||||
} else if (tok == "latex") {
|
|
||||||
lex.next();
|
|
||||||
string const ttok = lowercase(lex.GetString());
|
|
||||||
|
|
||||||
if (ttok == "no_latex") {
|
|
||||||
setLatex(OFF);
|
|
||||||
} else if (ttok == "latex") {
|
|
||||||
setLatex(ON);
|
|
||||||
} else {
|
|
||||||
lex.printError("Illegal LaTeX type`$$Token'");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else if (tok == "misc") {
|
} else if (tok == "misc") {
|
||||||
lex.next();
|
lex.next();
|
||||||
string const ttok = lowercase(lex.GetString());
|
string const ttok = lowercase(lex.GetString());
|
||||||
@ -812,24 +748,6 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont,
|
|||||||
if (orgfont.noun() != noun()) {
|
if (orgfont.noun() != noun()) {
|
||||||
os << "\\noun " << LyXMiscNames[noun()] << " \n";
|
os << "\\noun " << LyXMiscNames[noun()] << " \n";
|
||||||
}
|
}
|
||||||
#ifndef NO_LATEX
|
|
||||||
if (orgfont.latex() != latex()) {
|
|
||||||
// This is only for backwards compatibility
|
|
||||||
switch (latex()) {
|
|
||||||
case OFF: os << "\\latex no_latex \n"; break;
|
|
||||||
case ON: os << "\\latex latex \n"; break;
|
|
||||||
case TOGGLE: lyxerr << "LyXFont::lyxWriteFontChanges: "
|
|
||||||
"TOGGLE should not appear here!"
|
|
||||||
<< endl;
|
|
||||||
break;
|
|
||||||
case INHERIT: os << "\\latex default \n"; break;
|
|
||||||
case IGNORE: lyxerr << "LyXFont::lyxWriteFontChanges: "
|
|
||||||
"IGNORE should not appear here!"
|
|
||||||
<< endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (orgfont.color() != color()) {
|
if (orgfont.color() != color()) {
|
||||||
// To make us file compatible with older
|
// To make us file compatible with older
|
||||||
// lyx versions we emit "default" instead
|
// lyx versions we emit "default" instead
|
||||||
@ -1020,10 +938,6 @@ int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base,
|
|||||||
|
|
||||||
LColor::color LyXFont::realColor() const
|
LColor::color LyXFont::realColor() const
|
||||||
{
|
{
|
||||||
#ifndef NO_LATEX
|
|
||||||
if (latex() == ON)
|
|
||||||
return LColor::latex;
|
|
||||||
#endif
|
|
||||||
if (color() == LColor::none)
|
if (color() == LColor::none)
|
||||||
return LColor::foreground;
|
return LColor::foreground;
|
||||||
return color();
|
return color();
|
||||||
@ -1047,16 +961,6 @@ LyXFont::FONT_SHAPE LyXFont::realShape() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LyXFont::equalExceptLatex(LyXFont const & f) const
|
|
||||||
{
|
|
||||||
LyXFont f1 = *this;
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
f1.setLatex(f.latex());
|
|
||||||
#endif
|
|
||||||
return f1 == f;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ostream & operator<<(ostream & o, LyXFont::FONT_MISC_STATE fms)
|
ostream & operator<<(ostream & o, LyXFont::FONT_MISC_STATE fms)
|
||||||
{
|
{
|
||||||
return o << int(fms);
|
return o << int(fms);
|
||||||
|
@ -26,8 +26,6 @@ class LyXLex;
|
|||||||
class BufferParams;
|
class BufferParams;
|
||||||
|
|
||||||
|
|
||||||
#define NO_LATEX 1
|
|
||||||
|
|
||||||
///
|
///
|
||||||
class LyXFont {
|
class LyXFont {
|
||||||
public:
|
public:
|
||||||
@ -188,10 +186,6 @@ public:
|
|||||||
///
|
///
|
||||||
FONT_MISC_STATE noun() const;
|
FONT_MISC_STATE noun() const;
|
||||||
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
///
|
|
||||||
FONT_MISC_STATE latex() const;
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
FONT_MISC_STATE number() const;
|
FONT_MISC_STATE number() const;
|
||||||
|
|
||||||
@ -221,10 +215,6 @@ public:
|
|||||||
LyXFont & setUnderbar(LyXFont::FONT_MISC_STATE u);
|
LyXFont & setUnderbar(LyXFont::FONT_MISC_STATE u);
|
||||||
///
|
///
|
||||||
LyXFont & setNoun(LyXFont::FONT_MISC_STATE n);
|
LyXFont & setNoun(LyXFont::FONT_MISC_STATE n);
|
||||||
#ifndef NO_LATEX
|
|
||||||
///
|
|
||||||
LyXFont & setLatex(LyXFont::FONT_MISC_STATE l);
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
LyXFont & setNumber(LyXFont::FONT_MISC_STATE n);
|
LyXFont & setNumber(LyXFont::FONT_MISC_STATE n);
|
||||||
///
|
///
|
||||||
@ -306,9 +296,6 @@ public:
|
|||||||
friend
|
friend
|
||||||
bool operator==(LyXFont const & font1, LyXFont const & font2);
|
bool operator==(LyXFont const & font1, LyXFont const & font2);
|
||||||
|
|
||||||
/// compares two fonts, ignoring the setting of the Latex part.
|
|
||||||
bool equalExceptLatex(LyXFont const &) const;
|
|
||||||
|
|
||||||
/// Converts logical attributes to concrete shape attribute
|
/// Converts logical attributes to concrete shape attribute
|
||||||
LyXFont::FONT_SHAPE realShape() const;
|
LyXFont::FONT_SHAPE realShape() const;
|
||||||
private:
|
private:
|
||||||
@ -334,10 +321,6 @@ private:
|
|||||||
FONT_MISC_STATE underbar;
|
FONT_MISC_STATE underbar;
|
||||||
///
|
///
|
||||||
FONT_MISC_STATE noun;
|
FONT_MISC_STATE noun;
|
||||||
#ifndef NO_LATEX
|
|
||||||
///
|
|
||||||
FONT_MISC_STATE latex;
|
|
||||||
#endif
|
|
||||||
///
|
///
|
||||||
FONT_MISC_STATE number;
|
FONT_MISC_STATE number;
|
||||||
};
|
};
|
||||||
|
@ -725,12 +725,6 @@ func_status::value_type LyXFunc::getStatus(int ac,
|
|||||||
if (font.series() == LyXFont::BOLD_SERIES)
|
if (font.series() == LyXFont::BOLD_SERIES)
|
||||||
box = func_status::ToggleOn;
|
box = func_status::ToggleOn;
|
||||||
break;
|
break;
|
||||||
#ifndef NO_LATEX
|
|
||||||
case LFUN_TEX:
|
|
||||||
if (font.latex() == LyXFont::ON)
|
|
||||||
box = func_status::ToggleOn;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case LFUN_READ_ONLY_TOGGLE:
|
case LFUN_READ_ONLY_TOGGLE:
|
||||||
if (buf->isReadonly())
|
if (buf->isReadonly())
|
||||||
box = func_status::ToggleOn;
|
box = func_status::ToggleOn;
|
||||||
@ -1158,14 +1152,6 @@ string const LyXFunc::dispatch(int ac,
|
|||||||
owner->getDialogs()->setUserFreeFont();
|
owner->getDialogs()->setUserFreeFont();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
case LFUN_TEX:
|
|
||||||
Tex(owner->view());
|
|
||||||
owner->view()->setState();
|
|
||||||
owner->showState();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case LFUN_RECONFIGURE:
|
case LFUN_RECONFIGURE:
|
||||||
Reconfigure(owner->view());
|
Reconfigure(owner->view());
|
||||||
break;
|
break;
|
||||||
|
@ -96,6 +96,10 @@ public:
|
|||||||
LyXFont const getFont(Buffer const *, Paragraph * par,
|
LyXFont const getFont(Buffer const *, Paragraph * par,
|
||||||
Paragraph::size_type pos) const;
|
Paragraph::size_type pos) const;
|
||||||
///
|
///
|
||||||
|
LyXFont const getLayoutFont(Buffer const *, Paragraph * par) const;
|
||||||
|
///
|
||||||
|
LyXFont const getLabelFont(Buffer const *, Paragraph * par) const;
|
||||||
|
///
|
||||||
void setCharFont(Buffer const *, Paragraph * par,
|
void setCharFont(Buffer const *, Paragraph * par,
|
||||||
Paragraph::size_type pos, LyXFont const & font);
|
Paragraph::size_type pos, LyXFont const & font);
|
||||||
void setCharFont(BufferView *, Paragraph * par,
|
void setCharFont(BufferView *, Paragraph * par,
|
||||||
|
@ -559,15 +559,6 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
|
|||||||
//bv->owner()->message(_("math text mode toggled"));
|
//bv->owner()->message(_("math text mode toggled"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef NO_LATEX
|
|
||||||
case LFUN_TEX:
|
|
||||||
if (!mathcursor->selection()) {
|
|
||||||
mathcursor->handleFont(LM_TC_TEX);
|
|
||||||
//bv->owner()->message(_("TeX mode toggled"));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case LFUN_MATH_LIMITS:
|
case LFUN_MATH_LIMITS:
|
||||||
bv->lockedInsetStoreUndo(Undo::INSERT);
|
bv->lockedInsetStoreUndo(Undo::INSERT);
|
||||||
if (mathcursor->toggleLimits())
|
if (mathcursor->toggleLimits())
|
||||||
@ -901,15 +892,22 @@ Inset::Code InsetFormulaBase::lyxCode() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
LyXFont const InsetFormulaBase::convertFont(LyXFont const & f) const
|
LyXFont const InsetFormulaBase::convertFont(LyXFont const & f) const
|
||||||
{
|
{
|
||||||
|
#warning Andre, you should be able to remove this now?
|
||||||
|
// or change it to
|
||||||
|
#if 1
|
||||||
|
return f;
|
||||||
|
#else
|
||||||
|
// (Lgb)
|
||||||
|
|
||||||
// We have already discussed what was here
|
// We have already discussed what was here
|
||||||
LyXFont font(f);
|
LyXFont font(f);
|
||||||
#ifndef NO_LATEX
|
|
||||||
font.setLatex(LyXFont::OFF);
|
|
||||||
#endif
|
|
||||||
return font;
|
return font;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void mathDispatchCreation(BufferView * bv, string const & arg, bool display)
|
void mathDispatchCreation(BufferView * bv, string const & arg, bool display)
|
||||||
|
@ -82,8 +82,10 @@ public:
|
|||||||
virtual Inset * clone(Buffer const &, bool same_id = false) const = 0;
|
virtual Inset * clone(Buffer const &, bool same_id = false) const = 0;
|
||||||
///
|
///
|
||||||
virtual Inset::Code lyxCode() const;
|
virtual Inset::Code lyxCode() const;
|
||||||
|
#if 0
|
||||||
///
|
///
|
||||||
virtual LyXFont const convertFont(LyXFont const & f) const;
|
virtual LyXFont const convertFont(LyXFont const & f) const;
|
||||||
|
#endif
|
||||||
/// what appears in the minibuffer when opening
|
/// what appears in the minibuffer when opening
|
||||||
virtual string const editMessage() const;
|
virtual string const editMessage() const;
|
||||||
///
|
///
|
||||||
|
113
src/paragraph.C
113
src/paragraph.C
@ -613,7 +613,8 @@ LyXFont const Paragraph::getFirstFontSettings() const
|
|||||||
LyXFont const Paragraph::getFont(BufferParams const & bparams,
|
LyXFont const Paragraph::getFont(BufferParams const & bparams,
|
||||||
Paragraph::size_type pos) const
|
Paragraph::size_type pos) const
|
||||||
{
|
{
|
||||||
LyXFont tmpfont;
|
lyx::Assert(pos >= 0);
|
||||||
|
|
||||||
LyXLayout const & layout =
|
LyXLayout const & layout =
|
||||||
textclasslist.Style(bparams.textclass,
|
textclasslist.Style(bparams.textclass,
|
||||||
getLayout());
|
getLayout());
|
||||||
@ -621,40 +622,41 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams,
|
|||||||
if (layout.labeltype == LABEL_MANUAL)
|
if (layout.labeltype == LABEL_MANUAL)
|
||||||
main_body = beginningOfMainBody();
|
main_body = beginningOfMainBody();
|
||||||
|
|
||||||
if (pos >= 0) {
|
|
||||||
LyXFont layoutfont;
|
LyXFont layoutfont;
|
||||||
if (pos < main_body)
|
if (pos < main_body)
|
||||||
layoutfont = layout.labelfont;
|
layoutfont = layout.labelfont;
|
||||||
else
|
else
|
||||||
layoutfont = layout.font;
|
layoutfont = layout.font;
|
||||||
tmpfont = getFontSettings(bparams, pos);
|
|
||||||
|
LyXFont tmpfont = getFontSettings(bparams, pos);
|
||||||
tmpfont.realize(layoutfont, bparams.language);
|
tmpfont.realize(layoutfont, bparams.language);
|
||||||
} else {
|
|
||||||
// process layoutfont for pos == -1 and labelfont for pos < -1
|
return pimpl_->realizeFont(tmpfont, bparams);
|
||||||
if (pos == -1)
|
}
|
||||||
tmpfont = layout.font;
|
|
||||||
else
|
|
||||||
tmpfont = layout.labelfont;
|
LyXFont const Paragraph::getLabelFont(BufferParams const & bparams) const
|
||||||
|
{
|
||||||
|
LyXLayout const & layout =
|
||||||
|
textclasslist.Style(bparams.textclass, getLayout());
|
||||||
|
|
||||||
|
LyXFont tmpfont = layout.labelfont;
|
||||||
tmpfont.setLanguage(getParLanguage(bparams));
|
tmpfont.setLanguage(getParLanguage(bparams));
|
||||||
}
|
|
||||||
|
|
||||||
// check for environment font information
|
return pimpl_->realizeFont(tmpfont, bparams);
|
||||||
char par_depth = getDepth();
|
}
|
||||||
Paragraph const * par = this;
|
|
||||||
while (par && par->getDepth() && !tmpfont.resolved()) {
|
|
||||||
par = par->outerHook();
|
|
||||||
if (par) {
|
|
||||||
tmpfont.realize(textclasslist.
|
|
||||||
Style(bparams.textclass,
|
|
||||||
par->getLayout()).font, bparams.language);
|
|
||||||
par_depth = par->getDepth();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tmpfont.realize(textclasslist
|
|
||||||
.TextClass(bparams.textclass)
|
LyXFont const Paragraph::getLayoutFont(BufferParams const & bparams) const
|
||||||
.defaultfont(), bparams.language);
|
{
|
||||||
return tmpfont;
|
LyXLayout const & layout =
|
||||||
|
textclasslist.Style(bparams.textclass,
|
||||||
|
getLayout());
|
||||||
|
|
||||||
|
LyXFont tmpfont = layout.font;
|
||||||
|
tmpfont.setLanguage(getParLanguage(bparams));
|
||||||
|
|
||||||
|
return pimpl_->realizeFont(tmpfont, bparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -677,12 +679,12 @@ Paragraph::highestFontInRange(Paragraph::size_type startpos,
|
|||||||
++end_it;
|
++end_it;
|
||||||
|
|
||||||
Pimpl::FontTable start_search(startpos, LyXFont());
|
Pimpl::FontTable start_search(startpos, LyXFont());
|
||||||
for (Pimpl::FontList::const_iterator cit =
|
Pimpl::FontList::const_iterator cit =
|
||||||
lower_bound(pimpl_->fontlist.begin(),
|
lower_bound(pimpl_->fontlist.begin(),
|
||||||
pimpl_->fontlist.end(),
|
pimpl_->fontlist.end(),
|
||||||
start_search, Pimpl::matchFT());
|
start_search, Pimpl::matchFT());
|
||||||
cit != end_it; ++cit)
|
|
||||||
{
|
for (; cit != end_it; ++cit) {
|
||||||
LyXFont::FONT_SIZE size = cit->font().size();
|
LyXFont::FONT_SIZE size = cit->font().size();
|
||||||
if (size == LyXFont::INHERIT_SIZE)
|
if (size == LyXFont::INHERIT_SIZE)
|
||||||
size = def_size;
|
size = def_size;
|
||||||
@ -1274,8 +1276,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bparams.inputenc == "auto" &&
|
if (bparams.inputenc == "auto" &&
|
||||||
language->encoding() != previous_language->encoding())
|
language->encoding() != previous_language->encoding()) {
|
||||||
{
|
|
||||||
os << "\\inputencoding{"
|
os << "\\inputencoding{"
|
||||||
<< language->encoding()->LatexName()
|
<< language->encoding()->LatexName()
|
||||||
<< "}" << endl;
|
<< "}" << endl;
|
||||||
@ -1312,7 +1313,10 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
|
|||||||
// Is this really needed ? (Dekel)
|
// Is this really needed ? (Dekel)
|
||||||
// We do not need to use to change the font for the last paragraph
|
// We do not need to use to change the font for the last paragraph
|
||||||
// or for a command.
|
// or for a command.
|
||||||
LyXFont font = getFont(bparams, size() - 1);
|
LyXFont const font =
|
||||||
|
(size() == 0
|
||||||
|
? getLayoutFont(bparams)
|
||||||
|
: getFont(bparams, size() - 1));
|
||||||
|
|
||||||
bool is_command = textclasslist.Style(bparams.textclass,
|
bool is_command = textclasslist.Style(bparams.textclass,
|
||||||
getLayout()).isCommand();
|
getLayout()).isCommand();
|
||||||
@ -1362,8 +1366,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
|
|||||||
|
|
||||||
further_blank_line = false;
|
further_blank_line = false;
|
||||||
if (params().lineBottom()) {
|
if (params().lineBottom()) {
|
||||||
os << "\\lyxline{\\" << getFont(bparams,
|
os << "\\lyxline{\\" << font.latexSize() << '}';
|
||||||
size() - 1).latexSize() << '}';
|
|
||||||
further_blank_line = true;
|
further_blank_line = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1426,9 +1429,9 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
|
|||||||
if (main_body > 0) {
|
if (main_body > 0) {
|
||||||
os << '[';
|
os << '[';
|
||||||
++column;
|
++column;
|
||||||
basefont = getFont(bparams, -2); // Get label font
|
basefont = getLabelFont(bparams);
|
||||||
} else {
|
} else {
|
||||||
basefont = getFont(bparams, -1); // Get layout font
|
basefont = getLayoutFont(bparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (main_body >= 0
|
if (main_body >= 0
|
||||||
@ -1457,7 +1460,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
|
|||||||
column += running_font.latexWriteEndChanges(os, basefont, basefont);
|
column += running_font.latexWriteEndChanges(os, basefont, basefont);
|
||||||
open_font = false;
|
open_font = false;
|
||||||
}
|
}
|
||||||
basefont = getFont(bparams, -1); // Now use the layout font
|
basefont = getLayoutFont(bparams);
|
||||||
running_font = basefont;
|
running_font = basefont;
|
||||||
os << ']';
|
os << ']';
|
||||||
++column;
|
++column;
|
||||||
@ -1480,24 +1483,24 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
|
|||||||
case LYX_ALIGN_LEFT:
|
case LYX_ALIGN_LEFT:
|
||||||
if (getParLanguage(bparams)->babel() != "hebrew") {
|
if (getParLanguage(bparams)->babel() != "hebrew") {
|
||||||
os << "\\begin{flushleft}";
|
os << "\\begin{flushleft}";
|
||||||
column+= 17;
|
column += 17;
|
||||||
} else {
|
} else {
|
||||||
os << "\\begin{flushright}";
|
os << "\\begin{flushright}";
|
||||||
column+= 18;
|
column += 18;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LYX_ALIGN_RIGHT:
|
case LYX_ALIGN_RIGHT:
|
||||||
if (getParLanguage(bparams)->babel() != "hebrew") {
|
if (getParLanguage(bparams)->babel() != "hebrew") {
|
||||||
os << "\\begin{flushright}";
|
os << "\\begin{flushright}";
|
||||||
column+= 18;
|
column += 18;
|
||||||
} else {
|
} else {
|
||||||
os << "\\begin{flushleft}";
|
os << "\\begin{flushleft}";
|
||||||
column+= 17;
|
column += 17;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LYX_ALIGN_CENTER:
|
case LYX_ALIGN_CENTER:
|
||||||
os << "\\begin{center}";
|
os << "\\begin{center}";
|
||||||
column+= 14;
|
column += 14;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1507,18 +1510,21 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
|
|||||||
// Fully instantiated font
|
// Fully instantiated font
|
||||||
LyXFont font = getFont(bparams, i);
|
LyXFont font = getFont(bparams, i);
|
||||||
|
|
||||||
LyXFont last_font = running_font;
|
LyXFont const last_font = running_font;
|
||||||
|
|
||||||
// Spaces at end of font change are simulated to be
|
// Spaces at end of font change are simulated to be
|
||||||
// outside font change, i.e. we write "\textXX{text} "
|
// outside font change, i.e. we write "\textXX{text} "
|
||||||
// rather than "\textXX{text }". (Asger)
|
// rather than "\textXX{text }". (Asger)
|
||||||
if (open_font && c == ' ' && i <= size() - 2
|
if (open_font && c == ' ' && i <= size() - 2) {
|
||||||
&& !getFont(bparams, i + 1).equalExceptLatex(running_font)
|
LyXFont const next_font = getFont(bparams, i + 1);
|
||||||
&& !getFont(bparams, i + 1).equalExceptLatex(font)) {
|
if (next_font != running_font
|
||||||
font = getFont(bparams, i + 1);
|
&& next_font != font) {
|
||||||
|
font = next_font;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// We end font definition before blanks
|
// We end font definition before blanks
|
||||||
if (!font.equalExceptLatex(running_font) && open_font) {
|
if (font != running_font && open_font) {
|
||||||
column += running_font.latexWriteEndChanges(os,
|
column += running_font.latexWriteEndChanges(os,
|
||||||
basefont,
|
basefont,
|
||||||
(i == main_body-1) ? basefont : font);
|
(i == main_body-1) ? basefont : font);
|
||||||
@ -1536,8 +1542,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do we need to change font?
|
// Do we need to change font?
|
||||||
if (!font.equalExceptLatex(running_font)
|
if (font != running_font && i != main_body - 1) {
|
||||||
&& i != main_body-1) {
|
|
||||||
column += font.latexWriteStartChanges(os, basefont,
|
column += font.latexWriteStartChanges(os, basefont,
|
||||||
last_font);
|
last_font);
|
||||||
running_font = font;
|
running_font = font;
|
||||||
@ -1547,18 +1552,14 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
|
|||||||
if (c == Paragraph::META_NEWLINE) {
|
if (c == Paragraph::META_NEWLINE) {
|
||||||
// newlines are handled differently here than
|
// newlines are handled differently here than
|
||||||
// the default in SimpleTeXSpecialChars().
|
// the default in SimpleTeXSpecialChars().
|
||||||
if (!style.newline_allowed
|
if (!style.newline_allowed) {
|
||||||
#ifndef NO_LATEX
|
|
||||||
|| font.latex() == LyXFont::ON
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
os << '\n';
|
os << '\n';
|
||||||
} else {
|
} else {
|
||||||
if (open_font) {
|
if (open_font) {
|
||||||
column += running_font.latexWriteEndChanges(os, basefont, basefont);
|
column += running_font.latexWriteEndChanges(os, basefont, basefont);
|
||||||
open_font = false;
|
open_font = false;
|
||||||
}
|
}
|
||||||
basefont = getFont(bparams, -1);
|
basefont = getLayoutFont(bparams);
|
||||||
running_font = basefont;
|
running_font = basefont;
|
||||||
if (font.family() ==
|
if (font.family() ==
|
||||||
LyXFont::TYPEWRITER_FAMILY) {
|
LyXFont::TYPEWRITER_FAMILY) {
|
||||||
|
@ -252,6 +252,8 @@ public:
|
|||||||
LyXFont::TOGGLE.
|
LyXFont::TOGGLE.
|
||||||
*/
|
*/
|
||||||
LyXFont const getFont(BufferParams const &, size_type pos) const;
|
LyXFont const getFont(BufferParams const &, size_type pos) const;
|
||||||
|
LyXFont const getLayoutFont(BufferParams const &) const;
|
||||||
|
LyXFont const getLabelFont(BufferParams const &) const;
|
||||||
///
|
///
|
||||||
value_type getChar(size_type pos) const;
|
value_type getChar(size_type pos) const;
|
||||||
///
|
///
|
||||||
|
@ -214,12 +214,6 @@ void Paragraph::Pimpl::simpleTeXBlanks(std::ostream & os, TexRow & texrow,
|
|||||||
&& i
|
&& i
|
||||||
&& getChar(i - 1) != ' '
|
&& getChar(i - 1) != ' '
|
||||||
&& (i < size() - 1)
|
&& (i < size() - 1)
|
||||||
#ifndef NO_LATEX
|
|
||||||
// In LaTeX mode, we don't want to
|
|
||||||
// break lines since some commands
|
|
||||||
// do not like this
|
|
||||||
&& ! (font.latex() == LyXFont::ON)
|
|
||||||
#endif
|
|
||||||
// same in FreeSpacing mode
|
// same in FreeSpacing mode
|
||||||
&& !style.free_spacing
|
&& !style.free_spacing
|
||||||
// In typewriter mode, we want to avoid
|
// In typewriter mode, we want to avoid
|
||||||
@ -239,18 +233,11 @@ void Paragraph::Pimpl::simpleTeXBlanks(std::ostream & os, TexRow & texrow,
|
|||||||
texrow.newline();
|
texrow.newline();
|
||||||
texrow.start(owner_, i + 1);
|
texrow.start(owner_, i + 1);
|
||||||
column = 0;
|
column = 0;
|
||||||
} else
|
} else if (style.free_spacing) {
|
||||||
#ifndef NO_LATEX
|
|
||||||
if (font.latex() == LyXFont::OFF) {
|
|
||||||
#endif
|
|
||||||
if (style.free_spacing) {
|
|
||||||
os << '~';
|
os << '~';
|
||||||
} else {
|
} else {
|
||||||
os << ' ';
|
os << ' ';
|
||||||
}
|
}
|
||||||
#ifndef NO_LATEX
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -315,7 +302,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
|
|||||||
basefont);
|
basefont);
|
||||||
open_font = false;
|
open_font = false;
|
||||||
}
|
}
|
||||||
basefont = owner_->getFont(bparams, -1);
|
basefont = owner_->getLayoutFont(bparams);
|
||||||
running_font = basefont;
|
running_font = basefont;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -326,27 +313,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// And now for the special cases within each mode
|
// And now for the special cases within each mode
|
||||||
#ifndef NO_LATEX
|
|
||||||
// Are we in LaTeX mode?
|
|
||||||
if (font.latex() == LyXFont::ON) {
|
|
||||||
// at present we only have one option
|
|
||||||
// but I'll leave it as a switch statement
|
|
||||||
// so its simpler to extend. (ARRae)
|
|
||||||
switch (c) {
|
|
||||||
default:
|
|
||||||
// make sure that we will not print
|
|
||||||
// error generating chars to the tex
|
|
||||||
// file. This test would not be needed
|
|
||||||
// if it were done in the buffer
|
|
||||||
// itself.
|
|
||||||
if (c != '\0') {
|
|
||||||
os << c;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
// Plain mode (i.e. not LaTeX)
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '\\':
|
case '\\':
|
||||||
os << "\\textbackslash{}";
|
os << "\\textbackslash{}";
|
||||||
@ -519,9 +486,6 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifndef NO_LATEX
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,3 +526,27 @@ Paragraph * Paragraph::Pimpl::getParFromID(int id) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LyXFont const Paragraph::Pimpl::realizeFont(LyXFont const & font,
|
||||||
|
BufferParams const & bparams) const
|
||||||
|
{
|
||||||
|
LyXFont tmpfont(font);
|
||||||
|
|
||||||
|
// check for environment font information
|
||||||
|
char par_depth = owner_->getDepth();
|
||||||
|
Paragraph const * par = owner_;
|
||||||
|
while (par && par->getDepth() && !tmpfont.resolved()) {
|
||||||
|
par = par->outerHook();
|
||||||
|
if (par) {
|
||||||
|
tmpfont.realize(textclasslist.
|
||||||
|
Style(bparams.textclass,
|
||||||
|
par->getLayout()).font, bparams.language);
|
||||||
|
par_depth = par->getDepth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpfont.realize(textclasslist
|
||||||
|
.TextClass(bparams.textclass)
|
||||||
|
.defaultfont(), bparams.language);
|
||||||
|
return tmpfont;
|
||||||
|
}
|
||||||
|
@ -49,6 +49,9 @@ struct Paragraph::Pimpl {
|
|||||||
///
|
///
|
||||||
void erase(Paragraph::size_type pos);
|
void erase(Paragraph::size_type pos);
|
||||||
///
|
///
|
||||||
|
LyXFont const realizeFont(LyXFont const & font,
|
||||||
|
BufferParams const & bparams) const;
|
||||||
|
///
|
||||||
Inset * inset_owner;
|
Inset * inset_owner;
|
||||||
///
|
///
|
||||||
boost::array<int, 10> counter_;
|
boost::array<int, 10> counter_;
|
||||||
|
@ -1506,10 +1506,11 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
|
|||||||
|| token == "\\end_float"
|
|| token == "\\end_float"
|
||||||
|| token == "\\end_deeper") {
|
|| token == "\\end_deeper") {
|
||||||
lex.pushToken(token);
|
lex.pushToken(token);
|
||||||
|
#ifndef NO_COMPABILITY
|
||||||
// Here we need to insert the inset_ert_contents into the last
|
// Here we need to insert the inset_ert_contents into the last
|
||||||
// cell of the tabular.
|
// cell of the tabular.
|
||||||
owner_->bufferOwner()->insertErtContents(par, pos, font);
|
owner_->bufferOwner()->insertErtContents(par, pos, font);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (owner_->bufferOwner()->parseSingleLyXformat2Token(lex, par,
|
if (owner_->bufferOwner()->parseSingleLyXformat2Token(lex, par,
|
||||||
|
47
src/text.C
47
src/text.C
@ -253,7 +253,7 @@ void LyXText::computeBidiTables(Buffer const * buf, Row * row) const
|
|||||||
LyXFont font = row->par()->getFontSettings(buf->params, pos);
|
LyXFont font = row->par()->getFontSettings(buf->params, pos);
|
||||||
if (pos != lpos && 0 < lpos && rtl0 && font.isRightToLeft() &&
|
if (pos != lpos && 0 < lpos && rtl0 && font.isRightToLeft() &&
|
||||||
font.number() == LyXFont::ON &&
|
font.number() == LyXFont::ON &&
|
||||||
row->par()->getFontSettings(buf->params, lpos-1).number()
|
row->par()->getFontSettings(buf->params, lpos - 1).number()
|
||||||
== LyXFont::ON) {
|
== LyXFont::ON) {
|
||||||
font = row->par()->getFontSettings(buf->params, lpos);
|
font = row->par()->getFontSettings(buf->params, lpos);
|
||||||
is_space = false;
|
is_space = false;
|
||||||
@ -659,7 +659,7 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LyXFont const labelfont = getFont(bview->buffer(), row->par(), -2);
|
LyXFont const labelfont = getLabelFont(bview->buffer(), row->par());
|
||||||
switch (layout.margintype) {
|
switch (layout.margintype) {
|
||||||
case MARGIN_DYNAMIC:
|
case MARGIN_DYNAMIC:
|
||||||
if (!layout.leftmargin.empty()) {
|
if (!layout.leftmargin.empty()) {
|
||||||
@ -944,7 +944,7 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const
|
|||||||
++i;
|
++i;
|
||||||
if (i == main_body) {
|
if (i == main_body) {
|
||||||
x += lyxfont::width(layout.labelsep,
|
x += lyxfont::width(layout.labelsep,
|
||||||
getFont(bview->buffer(), par, -2));
|
getLabelFont(bview->buffer(), par));
|
||||||
if (par->isLineSeparator(i - 1))
|
if (par->isLineSeparator(i - 1))
|
||||||
x-= singleWidth(bview, par, i - 1);
|
x-= singleWidth(bview, par, i - 1);
|
||||||
int left_margin = labelEnd(bview, row);
|
int left_margin = labelEnd(bview, row);
|
||||||
@ -1000,7 +1000,7 @@ int LyXText::fill(BufferView * bview, Row * row, int paper_width) const
|
|||||||
|
|
||||||
while (i <= last) {
|
while (i <= last) {
|
||||||
if (main_body > 0 && i == main_body) {
|
if (main_body > 0 && i == main_body) {
|
||||||
w += lyxfont::width(layout.labelsep, getFont(bview->buffer(), row->par(), -2));
|
w += lyxfont::width(layout.labelsep, getLabelFont(bview->buffer(), row->par()));
|
||||||
if (row->par()->isLineSeparator(i - 1))
|
if (row->par()->isLineSeparator(i - 1))
|
||||||
w -= singleWidth(bview, row->par(), i - 1);
|
w -= singleWidth(bview, row->par(), i - 1);
|
||||||
int left_margin = labelEnd(bview, row);
|
int left_margin = labelEnd(bview, row);
|
||||||
@ -1011,7 +1011,7 @@ int LyXText::fill(BufferView * bview, Row * row, int paper_width) const
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if (main_body > 0 && main_body > last) {
|
if (main_body > 0 && main_body > last) {
|
||||||
w += lyxfont::width(layout.labelsep, getFont(bview->buffer(), row->par(), -2));
|
w += lyxfont::width(layout.labelsep, getLabelFont(bview->buffer(), row->par()));
|
||||||
if (last >= 0 && row->par()->isLineSeparator(last))
|
if (last >= 0 && row->par()->isLineSeparator(last))
|
||||||
w -= singleWidth(bview, row->par(), last);
|
w -= singleWidth(bview, row->par(), last);
|
||||||
int const left_margin = labelEnd(bview, row);
|
int const left_margin = labelEnd(bview, row);
|
||||||
@ -1059,7 +1059,7 @@ int LyXText::labelFill(BufferView * bview, Row const * row) const
|
|||||||
int fill = 0;
|
int fill = 0;
|
||||||
if (!row->par()->params().labelWidthString().empty()) {
|
if (!row->par()->params().labelWidthString().empty()) {
|
||||||
fill = max(lyxfont::width(row->par()->params().labelWidthString(),
|
fill = max(lyxfont::width(row->par()->params().labelWidthString(),
|
||||||
getFont(bview->buffer(), row->par(), -2)) - w,
|
getLabelFont(bview->buffer(), row->par())) - w,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1210,11 +1210,11 @@ void LyXText::setHeightOfRow(BufferView * bview, Row * row_ptr) const
|
|||||||
// do the assignment below too often.
|
// do the assignment below too often.
|
||||||
LyXFont font = getFont(bview->buffer(), par, row_ptr->pos());
|
LyXFont font = getFont(bview->buffer(), par, row_ptr->pos());
|
||||||
LyXFont::FONT_SIZE const tmpsize = font.size();
|
LyXFont::FONT_SIZE const tmpsize = font.size();
|
||||||
font = getFont(bview->buffer(), par, -1);
|
font = getLayoutFont(bview->buffer(), par);
|
||||||
LyXFont::FONT_SIZE const size = font.size();
|
LyXFont::FONT_SIZE const size = font.size();
|
||||||
font.setSize(tmpsize);
|
font.setSize(tmpsize);
|
||||||
|
|
||||||
LyXFont labelfont = getFont(bview->buffer(), par, -2);
|
LyXFont labelfont = getLabelFont(bview->buffer(), par);
|
||||||
|
|
||||||
float spacing_val = 1.0;
|
float spacing_val = 1.0;
|
||||||
if (!row_ptr->par()->params().spacing().isDefault()) {
|
if (!row_ptr->par()->params().spacing().isDefault()) {
|
||||||
@ -1745,7 +1745,7 @@ void LyXText::insertChar(BufferView * bview, char c)
|
|||||||
cursor.pos()).number() == LyXFont::ON &&
|
cursor.pos()).number() == LyXFont::ON &&
|
||||||
getFont(bview->buffer(),
|
getFont(bview->buffer(),
|
||||||
cursor.par(),
|
cursor.par(),
|
||||||
cursor.pos()-1).number() == LyXFont::ON)
|
cursor.pos() - 1).number() == LyXFont::ON)
|
||||||
)
|
)
|
||||||
number(bview); // Set current_font.number to OFF
|
number(bview); // Set current_font.number to OFF
|
||||||
} else if (isdigit(c) &&
|
} else if (isdigit(c) &&
|
||||||
@ -1767,7 +1767,7 @@ void LyXText::insertChar(BufferView * bview, char c)
|
|||||||
cursor.pos() >= 2 &&
|
cursor.pos() >= 2 &&
|
||||||
getFont(bview->buffer(),
|
getFont(bview->buffer(),
|
||||||
cursor.par(),
|
cursor.par(),
|
||||||
cursor.pos()-2).number() == LyXFont::ON) {
|
cursor.pos() - 2).number() == LyXFont::ON) {
|
||||||
setCharFont(bview->buffer(),
|
setCharFont(bview->buffer(),
|
||||||
cursor.par(),
|
cursor.par(),
|
||||||
cursor.pos() - 1,
|
cursor.pos() - 1,
|
||||||
@ -2086,7 +2086,7 @@ void LyXText::prepareToPrint(BufferView * bview,
|
|||||||
textclasslist.Style(bview->buffer()->params.textclass,
|
textclasslist.Style(bview->buffer()->params.textclass,
|
||||||
row->par()->getLayout());
|
row->par()->getLayout());
|
||||||
x += lyxfont::width(layout.labelsep,
|
x += lyxfont::width(layout.labelsep,
|
||||||
getFont(bview->buffer(), row->par(), -2));
|
getLabelFont(bview->buffer(), row->par()));
|
||||||
if (main_body-1 <= last)
|
if (main_body-1 <= last)
|
||||||
x += fill_label_hfill;
|
x += fill_label_hfill;
|
||||||
}
|
}
|
||||||
@ -2295,12 +2295,7 @@ string const LyXText::selectNextWord(BufferView * bview,
|
|||||||
|
|
||||||
// Now, skip until we have real text (will jump paragraphs)
|
// Now, skip until we have real text (will jump paragraphs)
|
||||||
while ((cursor.par()->size() > cursor.pos()
|
while ((cursor.par()->size() > cursor.pos()
|
||||||
&& (!cursor.par()->isLetter(cursor.pos())
|
&& (!cursor.par()->isLetter(cursor.pos()))
|
||||||
#ifndef NO_LATEX
|
|
||||||
|| cursor.par()->getFont(bview->buffer()->params, cursor.pos())
|
|
||||||
.latex() == LyXFont::ON
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
&& (!cursor.par()->isInset(cursor.pos()) ||
|
&& (!cursor.par()->isInset(cursor.pos()) ||
|
||||||
!cursor.par()->getInset(cursor.pos())->isTextInset()))
|
!cursor.par()->getInset(cursor.pos())->isTextInset()))
|
||||||
|| (cursor.par()->size() == cursor.pos()
|
|| (cursor.par()->size() == cursor.pos()
|
||||||
@ -3083,7 +3078,7 @@ void LyXText::getVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
tmpx += fill_label_hfill +
|
tmpx += fill_label_hfill +
|
||||||
lyxfont::width(textclasslist.Style(bview->buffer()->params.textclass,
|
lyxfont::width(textclasslist.Style(bview->buffer()->params.textclass,
|
||||||
row_ptr->par()->getLayout()).labelsep,
|
row_ptr->par()->getLayout()).labelsep,
|
||||||
getFont(bview->buffer(),row_ptr->par(), -2));
|
getLabelFont(bview->buffer(),row_ptr->par()));
|
||||||
if (row_ptr->par()->isLineSeparator(main_body-1))
|
if (row_ptr->par()->isLineSeparator(main_body-1))
|
||||||
tmpx -= singleWidth(bview, row_ptr->par(), main_body-1);
|
tmpx -= singleWidth(bview, row_ptr->par(), main_body-1);
|
||||||
}
|
}
|
||||||
@ -3271,7 +3266,7 @@ void LyXText::getVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
&& (layout.labeltype != LABEL_STATIC
|
&& (layout.labeltype != LABEL_STATIC
|
||||||
|| layout.latextype != LATEX_ENVIRONMENT
|
|| layout.latextype != LATEX_ENVIRONMENT
|
||||||
|| row_ptr->par()->isFirstInSequence())) {
|
|| row_ptr->par()->isFirstInSequence())) {
|
||||||
font = getFont(bview->buffer(), row_ptr->par(), -2);
|
font = getLabelFont(bview->buffer(), row_ptr->par());
|
||||||
if (!row_ptr->par()->getLabelstring().empty()) {
|
if (!row_ptr->par()->getLabelstring().empty()) {
|
||||||
tmpx = x;
|
tmpx = x;
|
||||||
string const tmpstring =
|
string const tmpstring =
|
||||||
@ -3320,8 +3315,8 @@ void LyXText::getVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
layout.labeltype == LABEL_BIBLIO ||
|
layout.labeltype == LABEL_BIBLIO ||
|
||||||
layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
|
layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
|
||||||
if (row_ptr->par()->isFirstInSequence()) {
|
if (row_ptr->par()->isFirstInSequence()) {
|
||||||
font = getFont(bview->buffer(),
|
font = getLabelFont(bview->buffer(),
|
||||||
row_ptr->par(), -2);
|
row_ptr->par());
|
||||||
if (!row_ptr->par()->getLabelstring().empty()) {
|
if (!row_ptr->par()->getLabelstring().empty()) {
|
||||||
string const tmpstring =
|
string const tmpstring =
|
||||||
row_ptr->par()->getLabelstring();
|
row_ptr->par()->getLabelstring();
|
||||||
@ -3352,7 +3347,7 @@ void LyXText::getVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (layout.labeltype == LABEL_BIBLIO && row_ptr->par()->bibkey) {
|
if (layout.labeltype == LABEL_BIBLIO && row_ptr->par()->bibkey) {
|
||||||
font = getFont(bview->buffer(), row_ptr->par(), -1);
|
font = getLayoutFont(bview->buffer(), row_ptr->par());
|
||||||
if (is_rtl)
|
if (is_rtl)
|
||||||
tmpx = ww - leftMargin(bview, row_ptr)
|
tmpx = ww - leftMargin(bview, row_ptr)
|
||||||
+ lyxfont::width(layout.labelsep, font);
|
+ lyxfont::width(layout.labelsep, font);
|
||||||
@ -3475,7 +3470,7 @@ void LyXText::getVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
string const tmpstring = textclasslist.
|
string const tmpstring = textclasslist.
|
||||||
Style(bview->buffer()->params.textclass,
|
Style(bview->buffer()->params.textclass,
|
||||||
layout).endlabelstring();
|
layout).endlabelstring();
|
||||||
font = getFont(bview->buffer(), row_ptr->par(), -2);
|
font = getLabelFont(bview->buffer(), row_ptr->par());
|
||||||
int const tmpx = is_rtl ?
|
int const tmpx = is_rtl ?
|
||||||
int(x) - lyxfont::width(tmpstring, font)
|
int(x) - lyxfont::width(tmpstring, font)
|
||||||
: ww - rightMargin(bview->buffer(), row_ptr) - row_ptr->fill();
|
: ww - rightMargin(bview->buffer(), row_ptr) - row_ptr->fill();
|
||||||
@ -3503,8 +3498,8 @@ void LyXText::getVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
|||||||
if (main_body > 0 && pos == main_body - 1) {
|
if (main_body > 0 && pos == main_body - 1) {
|
||||||
x += fill_label_hfill
|
x += fill_label_hfill
|
||||||
+ lyxfont::width(layout.labelsep,
|
+ lyxfont::width(layout.labelsep,
|
||||||
getFont(bview->buffer(),
|
getLabelFont(bview->buffer(),
|
||||||
row_ptr->par(), -2))
|
row_ptr->par()))
|
||||||
- singleWidth(bview,
|
- singleWidth(bview,
|
||||||
row_ptr->par(),
|
row_ptr->par(),
|
||||||
main_body - 1);
|
main_body - 1);
|
||||||
@ -3601,7 +3596,7 @@ int LyXText::getColumnNearX(BufferView * bview, Row * row, int & x,
|
|||||||
if (main_body > 0 && c == main_body-1) {
|
if (main_body > 0 && c == main_body-1) {
|
||||||
tmpx += fill_label_hfill +
|
tmpx += fill_label_hfill +
|
||||||
lyxfont::width(layout.labelsep,
|
lyxfont::width(layout.labelsep,
|
||||||
getFont(bview->buffer(), row->par(), -2));
|
getLabelFont(bview->buffer(), row->par()));
|
||||||
if (row->par()->isLineSeparator(main_body - 1))
|
if (row->par()->isLineSeparator(main_body - 1))
|
||||||
tmpx -= singleWidth(bview, row->par(), main_body-1);
|
tmpx -= singleWidth(bview, row->par(), main_body-1);
|
||||||
}
|
}
|
||||||
|
180
src/text2.C
180
src/text2.C
@ -41,6 +41,7 @@
|
|||||||
#include "FloatList.h"
|
#include "FloatList.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "ParagraphParameters.h"
|
#include "ParagraphParameters.h"
|
||||||
|
#include "support/LAssert.h"
|
||||||
|
|
||||||
using std::copy;
|
using std::copy;
|
||||||
using std::find;
|
using std::find;
|
||||||
@ -106,68 +107,14 @@ LyXText::~LyXText()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Gets the fully instantiated font at a given position in a paragraph
|
namespace {
|
||||||
// Basically the same routine as Paragraph::getFont() in paragraph.C.
|
|
||||||
// The difference is that this one is used for displaying, and thus we
|
LyXFont const realizeFont(LyXFont const & font,
|
||||||
// are allowed to make cosmetic improvements. For instance make footnotes
|
Buffer const * buf,
|
||||||
// smaller. (Asger)
|
Paragraph * par)
|
||||||
// If position is -1, we get the layout font of the paragraph.
|
|
||||||
// If position is -2, we get the font of the manual label of the paragraph.
|
|
||||||
LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
|
|
||||||
Paragraph::size_type pos) const
|
|
||||||
{
|
{
|
||||||
LyXLayout const & layout =
|
LyXFont tmpfont(font);
|
||||||
textclasslist.Style(buf->params.textclass, par->getLayout());
|
|
||||||
|
|
||||||
Paragraph::depth_type par_depth = par->getDepth();
|
Paragraph::depth_type par_depth = par->getDepth();
|
||||||
// We specialize the 95% common case:
|
|
||||||
if (!par_depth) {
|
|
||||||
if (pos >= 0){
|
|
||||||
// 95% goes here
|
|
||||||
if (layout.labeltype == LABEL_MANUAL
|
|
||||||
&& pos < beginningOfMainBody(buf, par)) {
|
|
||||||
// 1% goes here
|
|
||||||
LyXFont f = par->getFontSettings(buf->params,
|
|
||||||
pos);
|
|
||||||
return f.realize(layout.reslabelfont, buf->params.language);
|
|
||||||
} else {
|
|
||||||
LyXFont f = par->getFontSettings(buf->params, pos);
|
|
||||||
return f.realize(layout.resfont, buf->params.language);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// 5% goes here.
|
|
||||||
// process layoutfont for pos == -1 and labelfont for pos < -1
|
|
||||||
if (pos == -1)
|
|
||||||
return layout.resfont;
|
|
||||||
else
|
|
||||||
return layout.reslabelfont;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The uncommon case need not be optimized as much
|
|
||||||
|
|
||||||
LyXFont layoutfont, tmpfont;
|
|
||||||
|
|
||||||
if (pos >= 0){
|
|
||||||
// 95% goes here
|
|
||||||
if (pos < beginningOfMainBody(buf, par)) {
|
|
||||||
// 1% goes here
|
|
||||||
layoutfont = layout.labelfont;
|
|
||||||
} else {
|
|
||||||
// 99% goes here
|
|
||||||
layoutfont = layout.font;
|
|
||||||
}
|
|
||||||
tmpfont = par->getFontSettings(buf->params, pos);
|
|
||||||
tmpfont.realize(layoutfont, buf->params.language);
|
|
||||||
} else {
|
|
||||||
// 5% goes here.
|
|
||||||
// process layoutfont for pos == -1 and labelfont for pos < -1
|
|
||||||
if (pos == -1)
|
|
||||||
tmpfont = layout.font;
|
|
||||||
else
|
|
||||||
tmpfont = layout.labelfont;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve against environment font information
|
// Resolve against environment font information
|
||||||
while (par && par_depth && !tmpfont.resolved()) {
|
while (par && par_depth && !tmpfont.resolved()) {
|
||||||
@ -187,6 +134,87 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
|
|||||||
return tmpfont;
|
return tmpfont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Gets the fully instantiated font at a given position in a paragraph
|
||||||
|
// Basically the same routine as Paragraph::getFont() in paragraph.C.
|
||||||
|
// The difference is that this one is used for displaying, and thus we
|
||||||
|
// are allowed to make cosmetic improvements. For instance make footnotes
|
||||||
|
// smaller. (Asger)
|
||||||
|
// If position is -1, we get the layout font of the paragraph.
|
||||||
|
// If position is -2, we get the font of the manual label of the paragraph.
|
||||||
|
LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
|
||||||
|
Paragraph::size_type pos) const
|
||||||
|
{
|
||||||
|
lyx::Assert(pos >= 0);
|
||||||
|
|
||||||
|
LyXLayout const & layout =
|
||||||
|
textclasslist.Style(buf->params.textclass, par->getLayout());
|
||||||
|
|
||||||
|
Paragraph::depth_type par_depth = par->getDepth();
|
||||||
|
// We specialize the 95% common case:
|
||||||
|
if (!par_depth) {
|
||||||
|
if (layout.labeltype == LABEL_MANUAL
|
||||||
|
&& pos < beginningOfMainBody(buf, par)) {
|
||||||
|
// 1% goes here
|
||||||
|
LyXFont f = par->getFontSettings(buf->params,
|
||||||
|
pos);
|
||||||
|
return f.realize(layout.reslabelfont, buf->params.language);
|
||||||
|
} else {
|
||||||
|
LyXFont f = par->getFontSettings(buf->params, pos);
|
||||||
|
return f.realize(layout.resfont, buf->params.language);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The uncommon case need not be optimized as much
|
||||||
|
|
||||||
|
LyXFont layoutfont;
|
||||||
|
|
||||||
|
if (pos < beginningOfMainBody(buf, par)) {
|
||||||
|
// 1% goes here
|
||||||
|
layoutfont = layout.labelfont;
|
||||||
|
} else {
|
||||||
|
// 99% goes here
|
||||||
|
layoutfont = layout.font;
|
||||||
|
}
|
||||||
|
|
||||||
|
LyXFont tmpfont = par->getFontSettings(buf->params, pos);
|
||||||
|
tmpfont.realize(layoutfont, buf->params.language);
|
||||||
|
|
||||||
|
return realizeFont(tmpfont, buf, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LyXFont const LyXText::getLayoutFont(Buffer const * buf, Paragraph * par) const
|
||||||
|
{
|
||||||
|
LyXLayout const & layout =
|
||||||
|
textclasslist.Style(buf->params.textclass, par->getLayout());
|
||||||
|
|
||||||
|
Paragraph::depth_type par_depth = par->getDepth();
|
||||||
|
|
||||||
|
if (!par_depth) {
|
||||||
|
return layout.resfont;
|
||||||
|
}
|
||||||
|
|
||||||
|
return realizeFont(layout.font, buf, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LyXFont const LyXText::getLabelFont(Buffer const * buf, Paragraph * par) const
|
||||||
|
{
|
||||||
|
LyXLayout const & layout =
|
||||||
|
textclasslist.Style(buf->params.textclass, par->getLayout());
|
||||||
|
|
||||||
|
Paragraph::depth_type par_depth = par->getDepth();
|
||||||
|
|
||||||
|
if (!par_depth) {
|
||||||
|
return layout.reslabelfont;
|
||||||
|
}
|
||||||
|
|
||||||
|
return realizeFont(layout.labelfont, buf, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::setCharFont(BufferView * bv, Paragraph * par,
|
void LyXText::setCharFont(BufferView * bv, Paragraph * par,
|
||||||
Paragraph::size_type pos, LyXFont const & fnt,
|
Paragraph::size_type pos, LyXFont const & fnt,
|
||||||
@ -204,7 +232,6 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par,
|
|||||||
static_cast<UpdatableInset *>(inset);
|
static_cast<UpdatableInset *>(inset);
|
||||||
uinset->setFont(bv, fnt, toggleall, true);
|
uinset->setFont(bv, fnt, toggleall, true);
|
||||||
}
|
}
|
||||||
font = inset->convertFont(font);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,10 +274,6 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par,
|
|||||||
Paragraph::size_type pos, LyXFont const & fnt)
|
Paragraph::size_type pos, LyXFont const & fnt)
|
||||||
{
|
{
|
||||||
LyXFont font(fnt);
|
LyXFont font(fnt);
|
||||||
// Let the insets convert their font
|
|
||||||
if (par->getChar(pos) == Paragraph::META_INSET) {
|
|
||||||
font = par->getInset(pos)->convertFont(font);
|
|
||||||
}
|
|
||||||
|
|
||||||
LyXLayout const & layout =
|
LyXLayout const & layout =
|
||||||
textclasslist.Style(buf->params.textclass,
|
textclasslist.Style(buf->params.textclass,
|
||||||
@ -675,11 +698,12 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall)
|
|||||||
// Determine basis font
|
// Determine basis font
|
||||||
LyXFont layoutfont;
|
LyXFont layoutfont;
|
||||||
if (cursor.pos() < beginningOfMainBody(bview->buffer(),
|
if (cursor.pos() < beginningOfMainBody(bview->buffer(),
|
||||||
cursor.par()))
|
cursor.par())) {
|
||||||
{
|
layoutfont = getLabelFont(bview->buffer(),
|
||||||
layoutfont = getFont(bview->buffer(), cursor.par(),-2);
|
cursor.par());
|
||||||
} else {
|
} else {
|
||||||
layoutfont = getFont(bview->buffer(), cursor.par(),-1);
|
layoutfont = getLayoutFont(bview->buffer(),
|
||||||
|
cursor.par());
|
||||||
}
|
}
|
||||||
// Update current font
|
// Update current font
|
||||||
real_current_font.update(font, toggleall);
|
real_current_font.update(font, toggleall);
|
||||||
@ -2084,7 +2108,7 @@ void LyXText::setCursor(BufferView *bview, LyXCursor & cur, Paragraph * par,
|
|||||||
bview->buffer()->params.textclass,
|
bview->buffer()->params.textclass,
|
||||||
row->par()->getLayout())
|
row->par()->getLayout())
|
||||||
.labelsep,
|
.labelsep,
|
||||||
getFont(bview->buffer(), row->par(), -2));
|
getLabelFont(bview->buffer(), row->par()));
|
||||||
if (row->par()->isLineSeparator(main_body-1))
|
if (row->par()->isLineSeparator(main_body-1))
|
||||||
x -= singleWidth(bview, row->par(),main_body-1);
|
x -= singleWidth(bview, row->par(),main_body-1);
|
||||||
}
|
}
|
||||||
@ -2165,23 +2189,7 @@ void LyXText::setCursorFromCoordinates(BufferView * bview, int x, int y) const
|
|||||||
{
|
{
|
||||||
LyXCursor old_cursor = cursor;
|
LyXCursor old_cursor = cursor;
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Get the row first.
|
|
||||||
|
|
||||||
Row * row = getRowNearY(y);
|
|
||||||
|
|
||||||
bool bound = false;
|
|
||||||
int column = getColumnNearX(bview, row, x, bound);
|
|
||||||
|
|
||||||
cursor.par(row->par());
|
|
||||||
cursor.pos(row->pos() + column);
|
|
||||||
cursor.x(x);
|
|
||||||
cursor.y(y + row->baseline());
|
|
||||||
cursor.row(row);
|
|
||||||
cursor.boundary(bound);
|
|
||||||
#else
|
|
||||||
setCursorFromCoordinates(bview, cursor, x, y);
|
setCursorFromCoordinates(bview, cursor, x, y);
|
||||||
#endif
|
|
||||||
setCurrentFont(bview);
|
setCurrentFont(bview);
|
||||||
deleteEmptyParagraphMechanism(bview, old_cursor);
|
deleteEmptyParagraphMechanism(bview, old_cursor);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user