mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
ws cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3802 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0fde5a4c78
commit
a654de29ea
@ -1,5 +1,7 @@
|
|||||||
2002-03-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
2002-03-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||||
|
|
||||||
|
* all files: ws cleanup
|
||||||
|
|
||||||
* Makefile.am: remove ld -r stuff
|
* Makefile.am: remove ld -r stuff
|
||||||
|
|
||||||
2002-03-21 Juergen Vigna <jug@sad.it>
|
2002-03-21 Juergen Vigna <jug@sad.it>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -52,11 +52,11 @@ ExternalTemplateManager::ExternalTemplateManager()
|
|||||||
|
|
||||||
class dumpTemplate {
|
class dumpTemplate {
|
||||||
public:
|
public:
|
||||||
dumpTemplate(ostream & o)
|
dumpTemplate(ostream & o)
|
||||||
: ost(o) {}
|
: ost(o) {}
|
||||||
void operator()(ExternalTemplateManager::Templates::value_type const & vt) {
|
void operator()(ExternalTemplateManager::Templates::value_type const & vt) {
|
||||||
ExternalTemplate const & et = vt.second;
|
ExternalTemplate const & et = vt.second;
|
||||||
|
|
||||||
ost << "Template " << et.lyxName << "\n"
|
ost << "Template " << et.lyxName << "\n"
|
||||||
<< "\tGuiName " << et.guiName << "\n"
|
<< "\tGuiName " << et.guiName << "\n"
|
||||||
<< "\tHelpText\n"
|
<< "\tHelpText\n"
|
||||||
@ -68,7 +68,7 @@ public:
|
|||||||
<< "\tAutomaticProduction " << et.automaticProduction << "\n";
|
<< "\tAutomaticProduction " << et.automaticProduction << "\n";
|
||||||
et.dumpFormats(ost);
|
et.dumpFormats(ost);
|
||||||
ost << "TemplateEnd" << endl;
|
ost << "TemplateEnd" << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -77,7 +77,7 @@ private:
|
|||||||
|
|
||||||
class dumpFormat {
|
class dumpFormat {
|
||||||
public:
|
public:
|
||||||
dumpFormat(ostream & o)
|
dumpFormat(ostream & o)
|
||||||
: ost(o) {}
|
: ost(o) {}
|
||||||
void operator()(ExternalTemplate::Formats::value_type const & vt) const{
|
void operator()(ExternalTemplate::Formats::value_type const & vt) const{
|
||||||
ExternalTemplate::FormatTemplate const & ft = vt.second;
|
ExternalTemplate::FormatTemplate const & ft = vt.second;
|
||||||
@ -96,13 +96,13 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void ExternalTemplate::dumpFormats(ostream & os) const
|
void ExternalTemplate::dumpFormats(ostream & os) const
|
||||||
{
|
{
|
||||||
for_each(formats.begin(), formats.end(), dumpFormat(os));
|
for_each(formats.begin(), formats.end(), dumpFormat(os));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExternalTemplateManager::dumpTemplates() const
|
void ExternalTemplateManager::dumpTemplates() const
|
||||||
{
|
{
|
||||||
for_each(templates.begin(), templates.end(), dumpTemplate(lyxerr));
|
for_each(templates.begin(), templates.end(), dumpTemplate(lyxerr));
|
||||||
}
|
}
|
||||||
@ -134,8 +134,8 @@ ExternalTemplate const & ExternalTemplateManager::getTemplateByName(string const
|
|||||||
return templates[name];
|
return templates[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExternalTemplateManager::readTemplates(string const & path)
|
void ExternalTemplateManager::readTemplates(string const & path)
|
||||||
{
|
{
|
||||||
Path p(path);
|
Path p(path);
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ void ExternalTemplateManager::readTemplates(string const & path)
|
|||||||
TM_TEMPLATE = 1,
|
TM_TEMPLATE = 1,
|
||||||
TM_END
|
TM_END
|
||||||
};
|
};
|
||||||
|
|
||||||
keyword_item templatetags[] = {
|
keyword_item templatetags[] = {
|
||||||
{ "template", TM_TEMPLATE },
|
{ "template", TM_TEMPLATE },
|
||||||
{ "templateend", TM_END }
|
{ "templateend", TM_END }
|
||||||
@ -162,7 +162,7 @@ void ExternalTemplateManager::readTemplates(string const & path)
|
|||||||
"No template file" << endl;
|
"No template file" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (lex.isOK()) {
|
while (lex.isOK()) {
|
||||||
switch (lex.lex()) {
|
switch (lex.lex()) {
|
||||||
case TM_TEMPLATE: {
|
case TM_TEMPLATE: {
|
||||||
@ -173,7 +173,7 @@ void ExternalTemplateManager::readTemplates(string const & path)
|
|||||||
tmp.readTemplate(lex);
|
tmp.readTemplate(lex);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TM_END:
|
case TM_END:
|
||||||
lex.printError("Warning: End outside Template.");
|
lex.printError("Warning: End outside Template.");
|
||||||
break;
|
break;
|
||||||
@ -207,46 +207,46 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
|
|||||||
};
|
};
|
||||||
|
|
||||||
pushpophelper pph(lex, templateoptiontags, TO_END);
|
pushpophelper pph(lex, templateoptiontags, TO_END);
|
||||||
|
|
||||||
while (lex.isOK()) {
|
while (lex.isOK()) {
|
||||||
switch (lex.lex()) {
|
switch (lex.lex()) {
|
||||||
case TO_GUINAME:
|
case TO_GUINAME:
|
||||||
lex.next(true);
|
lex.next(true);
|
||||||
guiName = lex.getString();
|
guiName = lex.getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TO_HELPTEXT:
|
case TO_HELPTEXT:
|
||||||
helpText = lex.getLongString("HelpTextEnd");
|
helpText = lex.getLongString("HelpTextEnd");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TO_FILTER:
|
case TO_FILTER:
|
||||||
lex.next(true);
|
lex.next(true);
|
||||||
fileRegExp = lex.getString();
|
fileRegExp = lex.getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TO_VIEWCMD:
|
case TO_VIEWCMD:
|
||||||
lex.next(true);
|
lex.next(true);
|
||||||
viewCommand = lex.getString();
|
viewCommand = lex.getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TO_EDITCMD:
|
case TO_EDITCMD:
|
||||||
lex.next(true);
|
lex.next(true);
|
||||||
editCommand = lex.getString();
|
editCommand = lex.getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TO_AUTOMATIC:
|
case TO_AUTOMATIC:
|
||||||
lex.next();
|
lex.next();
|
||||||
automaticProduction = lex.getBool();
|
automaticProduction = lex.getBool();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TO_FORMAT:
|
case TO_FORMAT:
|
||||||
lex.next(true);
|
lex.next(true);
|
||||||
formats[lex.getString()].readFormat(lex);
|
formats[lex.getString()].readFormat(lex);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TO_END:
|
case TO_END:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
lex.printError("ExternalTemplate::readTemplate: "
|
lex.printError("ExternalTemplate::readTemplate: "
|
||||||
"Wrong tag: $$Token");
|
"Wrong tag: $$Token");
|
||||||
@ -257,7 +257,7 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
|
void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
|
||||||
{
|
{
|
||||||
enum FormatTags {
|
enum FormatTags {
|
||||||
FO_PRODUCT = 1,
|
FO_PRODUCT = 1,
|
||||||
@ -267,7 +267,7 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
|
|||||||
FO_PREAMBLE,
|
FO_PREAMBLE,
|
||||||
FO_END
|
FO_END
|
||||||
};
|
};
|
||||||
|
|
||||||
keyword_item formattags[] = {
|
keyword_item formattags[] = {
|
||||||
{ "formatend", FO_END },
|
{ "formatend", FO_END },
|
||||||
{ "preamble", FO_PREAMBLE },
|
{ "preamble", FO_PREAMBLE },
|
||||||
@ -278,14 +278,14 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
|
|||||||
};
|
};
|
||||||
|
|
||||||
pushpophelper pph(lex, formattags, FO_END);
|
pushpophelper pph(lex, formattags, FO_END);
|
||||||
|
|
||||||
while (lex.isOK()) {
|
while (lex.isOK()) {
|
||||||
switch (lex.lex()) {
|
switch (lex.lex()) {
|
||||||
case FO_PRODUCT:
|
case FO_PRODUCT:
|
||||||
lex.next(true);
|
lex.next(true);
|
||||||
product = lex.getString();
|
product = lex.getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FO_UPDATECMD:
|
case FO_UPDATECMD:
|
||||||
lex.next(true);
|
lex.next(true);
|
||||||
updateCommand = lex.getString();
|
updateCommand = lex.getString();
|
||||||
@ -295,16 +295,16 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
|
|||||||
lex.next(true);
|
lex.next(true);
|
||||||
updateResult = lex.getString();
|
updateResult = lex.getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FO_REQUIREMENT:
|
case FO_REQUIREMENT:
|
||||||
lex.next(true);
|
lex.next(true);
|
||||||
requirement = lex.getString();
|
requirement = lex.getString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FO_PREAMBLE:
|
case FO_PREAMBLE:
|
||||||
preamble = lex.getLongString("preambleend");
|
preamble = lex.getLongString("preambleend");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FO_END:
|
case FO_END:
|
||||||
if (lyxerr.debugging())
|
if (lyxerr.debugging())
|
||||||
lex.printError("FormatEnd");
|
lex.printError("FormatEnd");
|
||||||
@ -312,4 +312,3 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -64,10 +64,10 @@ struct ExternalTemplate {
|
|||||||
Formats formats;
|
Formats formats;
|
||||||
///
|
///
|
||||||
void dumpFormats(std::ostream &) const;
|
void dumpFormats(std::ostream &) const;
|
||||||
|
|
||||||
/// We have to have default commands for safety reasons!
|
/// We have to have default commands for safety reasons!
|
||||||
ExternalTemplate();
|
ExternalTemplate();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ public:
|
|||||||
static ExternalTemplateManager & get();
|
static ExternalTemplateManager & get();
|
||||||
Templates & getTemplates();
|
Templates & getTemplates();
|
||||||
Templates const & getTemplates() const;
|
Templates const & getTemplates() const;
|
||||||
/// return the template by LyX name
|
/// return the template by LyX name
|
||||||
ExternalTemplate const & getTemplateByName(const string & name);
|
ExternalTemplate const & getTemplateByName(const string & name);
|
||||||
private:
|
private:
|
||||||
ExternalTemplateManager();
|
ExternalTemplateManager();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -99,7 +99,7 @@ LyXFont const Inset::convertFont(LyXFont const & font) const
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
string const Inset::editMessage() const
|
string const Inset::editMessage() const
|
||||||
{
|
{
|
||||||
return _("Opened inset");
|
return _("Opened inset");
|
||||||
}
|
}
|
||||||
@ -251,7 +251,7 @@ void UpdatableInset::draw(BufferView *, LyXFont const &,
|
|||||||
void UpdatableInset::scroll(BufferView * bv, float s) const
|
void UpdatableInset::scroll(BufferView * bv, float s) const
|
||||||
{
|
{
|
||||||
LyXFont font;
|
LyXFont font;
|
||||||
|
|
||||||
if (!s) {
|
if (!s) {
|
||||||
scx = 0;
|
scx = 0;
|
||||||
return;
|
return;
|
||||||
@ -259,8 +259,8 @@ void UpdatableInset::scroll(BufferView * bv, float s) const
|
|||||||
|
|
||||||
int const workW = bv->workWidth();
|
int const workW = bv->workWidth();
|
||||||
int const tmp_top_x = top_x - scx;
|
int const tmp_top_x = top_x - scx;
|
||||||
|
|
||||||
if (tmp_top_x > 0 &&
|
if (tmp_top_x > 0 &&
|
||||||
(tmp_top_x + width(bv, font)) < workW)
|
(tmp_top_x + width(bv, font)) < workW)
|
||||||
return;
|
return;
|
||||||
if (s > 0 && top_x > 0)
|
if (s > 0 && top_x > 0)
|
||||||
@ -268,7 +268,7 @@ void UpdatableInset::scroll(BufferView * bv, float s) const
|
|||||||
|
|
||||||
// int mx_scx=abs((width(bv,font) - bv->workWidth())/2);
|
// int mx_scx=abs((width(bv,font) - bv->workWidth())/2);
|
||||||
//int const save_scx = scx;
|
//int const save_scx = scx;
|
||||||
|
|
||||||
scx = int(s * workW / 2);
|
scx = int(s * workW / 2);
|
||||||
// if (!display())
|
// if (!display())
|
||||||
// scx += 20;
|
// scx += 20;
|
||||||
@ -295,7 +295,7 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
|
|||||||
if (!scx && (top_x + width(bv, font)) < (bv->workWidth() - 20))
|
if (!scx && (top_x + width(bv, font)) < (bv->workWidth() - 20))
|
||||||
return;
|
return;
|
||||||
if ((top_x - scx + offset + width(bv, font)) < (bv->workWidth() - 20)) {
|
if ((top_x - scx + offset + width(bv, font)) < (bv->workWidth() - 20)) {
|
||||||
scx = bv->workWidth() - width(bv, font) - top_x + scx - 20;
|
scx = bv->workWidth() - width(bv, font) - top_x + scx - 20;
|
||||||
} else {
|
} else {
|
||||||
scx += offset;
|
scx += offset;
|
||||||
}
|
}
|
||||||
@ -306,8 +306,8 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
|
|||||||
|
|
||||||
/// An updatable inset could handle lyx editing commands
|
/// An updatable inset could handle lyx editing commands
|
||||||
UpdatableInset::RESULT
|
UpdatableInset::RESULT
|
||||||
UpdatableInset::localDispatch(BufferView * bv,
|
UpdatableInset::localDispatch(BufferView * bv,
|
||||||
kb_action action, string const & arg)
|
kb_action action, string const & arg)
|
||||||
{
|
{
|
||||||
if (!arg.empty() && (action==LFUN_SCROLL_INSET)) {
|
if (!arg.empty() && (action==LFUN_SCROLL_INSET)) {
|
||||||
if (arg.find('.') != arg.npos) {
|
if (arg.find('.') != arg.npos) {
|
||||||
@ -318,10 +318,10 @@ UpdatableInset::localDispatch(BufferView * bv,
|
|||||||
scroll(bv, xx);
|
scroll(bv, xx);
|
||||||
}
|
}
|
||||||
bv->updateInset(this, false);
|
bv->updateInset(this, false);
|
||||||
|
|
||||||
return DISPATCHED;
|
return DISPATCHED;
|
||||||
}
|
}
|
||||||
return UNDISPATCHED;
|
return UNDISPATCHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ string const UpdatableInset::selectNextWordToSpellcheck(BufferView *bv,
|
|||||||
|
|
||||||
|
|
||||||
bool UpdatableInset::searchForward(BufferView * bv, string const &,
|
bool UpdatableInset::searchForward(BufferView * bv, string const &,
|
||||||
bool, bool)
|
bool, bool)
|
||||||
{
|
{
|
||||||
// we have to unlock ourself in this function by default!
|
// we have to unlock ourself in this function by default!
|
||||||
bv->unlockInset(const_cast<UpdatableInset *>(this));
|
bv->unlockInset(const_cast<UpdatableInset *>(this));
|
||||||
@ -384,7 +384,7 @@ bool UpdatableInset::searchForward(BufferView * bv, string const &,
|
|||||||
|
|
||||||
|
|
||||||
bool UpdatableInset::searchBackward(BufferView * bv, string const &,
|
bool UpdatableInset::searchBackward(BufferView * bv, string const &,
|
||||||
bool, bool)
|
bool, bool)
|
||||||
{
|
{
|
||||||
// we have to unlock ourself in this function by default!
|
// we have to unlock ourself in this function by default!
|
||||||
bv->unlockInset(const_cast<UpdatableInset *>(this));
|
bv->unlockInset(const_cast<UpdatableInset *>(this));
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995-2001 the LyX Team.
|
* Copyright 1995-2001 the LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
@ -129,7 +129,7 @@ public:
|
|||||||
///
|
///
|
||||||
HIGHLY_EDITABLE
|
HIGHLY_EDITABLE
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
Inset();
|
Inset();
|
||||||
///
|
///
|
||||||
@ -190,7 +190,7 @@ public:
|
|||||||
bool free_spc) const = 0;
|
bool free_spc) const = 0;
|
||||||
///
|
///
|
||||||
virtual int ascii(Buffer const *,
|
virtual int ascii(Buffer const *,
|
||||||
std::ostream &, int linelen = 0) const = 0;
|
std::ostream &, int linelen = 0) const = 0;
|
||||||
///
|
///
|
||||||
virtual int linuxdoc(Buffer const *, std::ostream &) const = 0;
|
virtual int linuxdoc(Buffer const *, std::ostream &) const = 0;
|
||||||
///
|
///
|
||||||
@ -199,17 +199,17 @@ public:
|
|||||||
virtual void validate(LaTeXFeatures & features) const;
|
virtual void validate(LaTeXFeatures & features) const;
|
||||||
///
|
///
|
||||||
virtual bool deletable() const;
|
virtual bool deletable() const;
|
||||||
|
|
||||||
/// returns LyX code associated with the inset. Used for TOC, ...)
|
/// returns LyX code associated with the inset. Used for TOC, ...)
|
||||||
virtual Inset::Code lyxCode() const { return NO_CODE; }
|
virtual Inset::Code lyxCode() const { return NO_CODE; }
|
||||||
|
|
||||||
virtual std::vector<string> const getLabelList() const {
|
virtual std::vector<string> const getLabelList() const {
|
||||||
return std::vector<string>();
|
return std::vector<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
virtual Inset * clone(Buffer const &, bool same_ids = false) const = 0;
|
virtual Inset * clone(Buffer const &, bool same_ids = false) const = 0;
|
||||||
|
|
||||||
/// returns true to override begin and end inset in file
|
/// returns true to override begin and end inset in file
|
||||||
virtual bool directWrite() const;
|
virtual bool directWrite() const;
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ public:
|
|||||||
virtual bool checkInsertChar(LyXFont &);
|
virtual bool checkInsertChar(LyXFont &);
|
||||||
/// we need this here because collapsed insets are only EDITABLE
|
/// we need this here because collapsed insets are only EDITABLE
|
||||||
virtual void setFont(BufferView *, LyXFont const &,
|
virtual void setFont(BufferView *, LyXFont const &,
|
||||||
bool toggleall = false, bool selectall = false);
|
bool toggleall = false, bool selectall = false);
|
||||||
///
|
///
|
||||||
// needed for spellchecking text
|
// needed for spellchecking text
|
||||||
///
|
///
|
||||||
@ -352,8 +352,8 @@ private:
|
|||||||
|
|
||||||
inline
|
inline
|
||||||
bool Inset::insetAllowed(Inset * in) const
|
bool Inset::insetAllowed(Inset * in) const
|
||||||
{
|
{
|
||||||
return insetAllowed(in->lyxCode());
|
return insetAllowed(in->lyxCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -366,26 +366,26 @@ bool Inset::checkInsertChar(LyXFont &)
|
|||||||
// Updatable Insets. These insets can be locked and receive
|
// Updatable Insets. These insets can be locked and receive
|
||||||
// directly user interaction. Currently used only for mathed.
|
// directly user interaction. Currently used only for mathed.
|
||||||
// Note that all pure methods from Inset class are pure here too.
|
// Note that all pure methods from Inset class are pure here too.
|
||||||
// [Alejandro 080596]
|
// [Alejandro 080596]
|
||||||
|
|
||||||
/** Extracted from Matthias notes:
|
/** Extracted from Matthias notes:
|
||||||
*
|
*
|
||||||
* An inset can simple call LockInset in it's edit call and *ONLY*
|
* An inset can simple call LockInset in it's edit call and *ONLY*
|
||||||
* in it's edit call.
|
* in it's edit call.
|
||||||
*
|
*
|
||||||
* Unlocking is either done by LyX or the inset itself with a
|
* Unlocking is either done by LyX or the inset itself with a
|
||||||
* UnlockInset-call
|
* UnlockInset-call
|
||||||
*
|
*
|
||||||
* During the lock, all button and keyboard events will be modified
|
* During the lock, all button and keyboard events will be modified
|
||||||
* and send to the inset through the following inset-features. Note that
|
* and send to the inset through the following inset-features. Note that
|
||||||
* Inset::insetUnlock will be called from inside UnlockInset. It is meant
|
* Inset::insetUnlock will be called from inside UnlockInset. It is meant
|
||||||
* to contain the code for restoring the menus and things like this.
|
* to contain the code for restoring the menus and things like this.
|
||||||
*
|
*
|
||||||
* If a inset wishes any redraw and/or update it just has to call
|
* If a inset wishes any redraw and/or update it just has to call
|
||||||
* updateInset(this).
|
* updateInset(this).
|
||||||
*
|
*
|
||||||
* It's is completly irrelevant, where the inset is. UpdateInset will
|
* It's is completly irrelevant, where the inset is. UpdateInset will
|
||||||
* find it in any paragraph in any buffer.
|
* find it in any paragraph in any buffer.
|
||||||
* Of course the_locking_inset and the insets in the current paragraph/buffer
|
* Of course the_locking_inset and the insets in the current paragraph/buffer
|
||||||
* are checked first, so no performance problem should occur.
|
* are checked first, so no performance problem should occur.
|
||||||
*/
|
*/
|
||||||
@ -394,22 +394,22 @@ public:
|
|||||||
/** Dispatch result codes
|
/** Dispatch result codes
|
||||||
Now that nested updatable insets are allowed, the local dispatch
|
Now that nested updatable insets are allowed, the local dispatch
|
||||||
becomes a bit complex, just two possible results (boolean)
|
becomes a bit complex, just two possible results (boolean)
|
||||||
are not enough.
|
are not enough.
|
||||||
|
|
||||||
DISPATCHED = the inset catched the action
|
DISPATCHED = the inset catched the action
|
||||||
DISPATCHED_NOUPDATE = the inset catched the action and no update
|
DISPATCHED_NOUPDATE = the inset catched the action and no update
|
||||||
is needed here to redraw the inset
|
is needed here to redraw the inset
|
||||||
FINISHED = the inset must be unlocked as a result
|
FINISHED = the inset must be unlocked as a result
|
||||||
of the action
|
of the action
|
||||||
FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of
|
FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of
|
||||||
the inset.
|
the inset.
|
||||||
FINISHED_UP = FINISHED, but put the cursor UP of
|
FINISHED_UP = FINISHED, but put the cursor UP of
|
||||||
the inset.
|
the inset.
|
||||||
FINISHED_DOWN = FINISHED, but put the cursor DOWN of
|
FINISHED_DOWN = FINISHED, but put the cursor DOWN of
|
||||||
the inset.
|
the inset.
|
||||||
UNDISPATCHED = the action was not catched, it should be
|
UNDISPATCHED = the action was not catched, it should be
|
||||||
dispatched by lower level insets
|
dispatched by lower level insets
|
||||||
*/
|
*/
|
||||||
enum RESULT {
|
enum RESULT {
|
||||||
UNDISPATCHED = 0,
|
UNDISPATCHED = 0,
|
||||||
DISPATCHED,
|
DISPATCHED,
|
||||||
@ -419,7 +419,7 @@ public:
|
|||||||
FINISHED_UP,
|
FINISHED_UP,
|
||||||
FINISHED_DOWN
|
FINISHED_DOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
/// To convert old binary dispatch results
|
/// To convert old binary dispatch results
|
||||||
RESULT DISPATCH_RESULT(bool b) {
|
RESULT DISPATCH_RESULT(bool b) {
|
||||||
return b ? DISPATCHED : FINISHED;
|
return b ? DISPATCHED : FINISHED;
|
||||||
@ -435,7 +435,7 @@ public:
|
|||||||
virtual bool checkInsertChar(LyXFont &);
|
virtual bool checkInsertChar(LyXFont &);
|
||||||
///
|
///
|
||||||
virtual EDITABLE editable() const;
|
virtual EDITABLE editable() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
virtual void toggleInsetCursor(BufferView *);
|
virtual void toggleInsetCursor(BufferView *);
|
||||||
///
|
///
|
||||||
@ -454,7 +454,7 @@ public:
|
|||||||
// if that one has one!
|
// if that one has one!
|
||||||
///
|
///
|
||||||
virtual bool insetButtonRelease(BufferView *,
|
virtual bool insetButtonRelease(BufferView *,
|
||||||
int x, int y, int button);
|
int x, int y, int button);
|
||||||
///
|
///
|
||||||
virtual void insetKeyPress(XKeyEvent * ev);
|
virtual void insetKeyPress(XKeyEvent * ev);
|
||||||
///
|
///
|
||||||
@ -487,7 +487,7 @@ public:
|
|||||||
{ return false; }
|
{ return false; }
|
||||||
///
|
///
|
||||||
virtual bool unlockInsetInInset(BufferView *, UpdatableInset *,
|
virtual bool unlockInsetInInset(BufferView *, UpdatableInset *,
|
||||||
bool /*lr*/ = false)
|
bool /*lr*/ = false)
|
||||||
{ return false; }
|
{ return false; }
|
||||||
/// An updatable inset could handle lyx editing commands
|
/// An updatable inset could handle lyx editing commands
|
||||||
virtual RESULT localDispatch(BufferView *, kb_action, string const &);
|
virtual RESULT localDispatch(BufferView *, kb_action, string const &);
|
||||||
@ -526,11 +526,11 @@ public:
|
|||||||
// needed for search/replace functionality
|
// needed for search/replace functionality
|
||||||
///
|
///
|
||||||
virtual bool searchForward(BufferView *, string const &,
|
virtual bool searchForward(BufferView *, string const &,
|
||||||
bool = true, bool = false);
|
bool = true, bool = false);
|
||||||
///
|
///
|
||||||
virtual bool searchBackward(BufferView *, string const &,
|
virtual bool searchBackward(BufferView *, string const &,
|
||||||
bool = true, bool = false);
|
bool = true, bool = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
void toggleCursorVisible() const {
|
void toggleCursorVisible() const {
|
||||||
@ -564,9 +564,9 @@ bool UpdatableInset::checkInsertChar(LyXFont &)
|
|||||||
*/
|
*/
|
||||||
inline bool isEditableInset(Inset * i)
|
inline bool isEditableInset(Inset * i)
|
||||||
{
|
{
|
||||||
return i && i->editable();
|
return i && i->editable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns true if pointer argument is valid
|
* returns true if pointer argument is valid
|
||||||
* and points to a highly editable inset
|
* and points to a highly editable inset
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
#include "lyxtextclasslist.h"
|
#include "lyxtextclasslist.h"
|
||||||
|
|
||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
@ -58,15 +58,15 @@ Inset * InsetBibKey::clone(Buffer const &, bool) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetBibKey::setCounter(int c)
|
void InsetBibKey::setCounter(int c)
|
||||||
{
|
{
|
||||||
counter = c;
|
counter = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// I'm sorry but this is still necessary because \bibitem is used also
|
// I'm sorry but this is still necessary because \bibitem is used also
|
||||||
// as a LyX 2.x command, and lyxlex is not enough smart to understand
|
// as a LyX 2.x command, and lyxlex is not enough smart to understand
|
||||||
// real LaTeX commands. Yes, that could be fixed, but would be a waste
|
// real LaTeX commands. Yes, that could be fixed, but would be a waste
|
||||||
// of time cause LyX3 won't use lyxlex anyway. (ale)
|
// of time cause LyX3 won't use lyxlex anyway. (ale)
|
||||||
void InsetBibKey::write(Buffer const *, ostream & os) const
|
void InsetBibKey::write(Buffer const *, ostream & os) const
|
||||||
{
|
{
|
||||||
@ -111,7 +111,7 @@ string const InsetBibKey::getScreenLabel(Buffer const *) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetBibKey::edit(BufferView * bv, int, int, unsigned int)
|
void InsetBibKey::edit(BufferView * bv, int, int, unsigned int)
|
||||||
{
|
{
|
||||||
bv->owner()->getDialogs()->showBibitem(this);
|
bv->owner()->getDialogs()->showBibitem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buffer->niceFile
|
if (!buffer->niceFile
|
||||||
&& IsFileReadable(MakeAbsPath(style, buffer->filePath()) + ".bst")) {
|
&& IsFileReadable(MakeAbsPath(style, buffer->filePath()) + ".bst")) {
|
||||||
style = MakeAbsPath(style, buffer->filePath());
|
style = MakeAbsPath(style, buffer->filePath());
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bibtotoc-Option
|
// bibtotoc-Option
|
||||||
if (!bibtotoc.empty()) {
|
if (!bibtotoc.empty()) {
|
||||||
// maybe a problem when a textclass has no "art" as
|
// maybe a problem when a textclass has no "art" as
|
||||||
// part of its name, because it's than book.
|
// part of its name, because it's than book.
|
||||||
// For the "official" lyx-layouts it's no problem to support
|
// For the "official" lyx-layouts it's no problem to support
|
||||||
@ -189,7 +189,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// article class
|
// article class
|
||||||
os << "\\addcontentsline{toc}{section}{\\refname}";
|
os << "\\addcontentsline{toc}{section}{\\refname}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,8 +200,8 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
|
|||||||
string db_out;
|
string db_out;
|
||||||
while (!adb.empty()) {
|
while (!adb.empty()) {
|
||||||
if (!buffer->niceFile &&
|
if (!buffer->niceFile &&
|
||||||
IsFileReadable(MakeAbsPath(adb, buffer->filePath())+".bib"))
|
IsFileReadable(MakeAbsPath(adb, buffer->filePath())+".bib"))
|
||||||
adb = os::external_path(MakeAbsPath(adb, buffer->filePath()));
|
adb = os::external_path(MakeAbsPath(adb, buffer->filePath()));
|
||||||
db_out += adb;
|
db_out += adb;
|
||||||
db_out += ',';
|
db_out += ',';
|
||||||
db_in= split(db_in, adb,',');
|
db_in= split(db_in, adb,',');
|
||||||
@ -229,9 +229,9 @@ vector<string> const InsetBibtex::getFiles(Buffer const & buffer) const
|
|||||||
// If we didn't find a matching file name just fail silently
|
// If we didn't find a matching file name just fail silently
|
||||||
if (!file.empty())
|
if (!file.empty())
|
||||||
vec.push_back(file);
|
vec.push_back(file);
|
||||||
|
|
||||||
// Get next file name
|
// Get next file name
|
||||||
bibfiles = split(bibfiles, tmp, ',');
|
bibfiles = split(bibfiles, tmp, ',');
|
||||||
}
|
}
|
||||||
|
|
||||||
return vec;
|
return vec;
|
||||||
@ -273,7 +273,7 @@ vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ bool InsetBibtex::addDatabase(string const & db)
|
|||||||
{
|
{
|
||||||
string contents(getContents());
|
string contents(getContents());
|
||||||
if (!contains(contents, db)) {
|
if (!contains(contents, db)) {
|
||||||
if (!contents.empty())
|
if (!contents.empty())
|
||||||
contents += ",";
|
contents += ",";
|
||||||
setContents(contents + db);
|
setContents(contents + db);
|
||||||
return true;
|
return true;
|
||||||
@ -314,7 +314,7 @@ bool InsetBibtex::delDatabase(string const & db)
|
|||||||
setContents(subst(getContents(), tmp, ", "));
|
setContents(subst(getContents(), tmp, ", "));
|
||||||
} else if (n == 0)
|
} else if (n == 0)
|
||||||
setContents(split(getContents(), bd, ','));
|
setContents(split(getContents(), bd, ','));
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -328,7 +328,7 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const & font)
|
|||||||
// Ha, now we are mainly at 1.2.0 and it is still here (Jug)
|
// Ha, now we are mainly at 1.2.0 and it is still here (Jug)
|
||||||
// Does look like a hack? It is! (but will change at 0.13)
|
// Does look like a hack? It is! (but will change at 0.13)
|
||||||
Paragraph * par = bv->buffer()->paragraph;
|
Paragraph * par = bv->buffer()->paragraph;
|
||||||
|
|
||||||
while (par) {
|
while (par) {
|
||||||
if (par->bibkey) {
|
if (par->bibkey) {
|
||||||
int const wx = par->bibkey->width(bv, font);
|
int const wx = par->bibkey->width(bv, font);
|
||||||
@ -348,7 +348,7 @@ string const bibitemWidest(Buffer const * buffer)
|
|||||||
Paragraph * par = buffer->paragraph;
|
Paragraph * par = buffer->paragraph;
|
||||||
InsetBibKey * bkey = 0;
|
InsetBibKey * bkey = 0;
|
||||||
LyXFont font;
|
LyXFont font;
|
||||||
|
|
||||||
while (par) {
|
while (par) {
|
||||||
if (par->bibkey) {
|
if (par->bibkey) {
|
||||||
int const wx =
|
int const wx =
|
||||||
@ -361,9 +361,9 @@ string const bibitemWidest(Buffer const * buffer)
|
|||||||
}
|
}
|
||||||
par = par->next();
|
par = par->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bkey && !bkey->getBibLabel().empty())
|
if (bkey && !bkey->getBibLabel().empty())
|
||||||
return bkey->getBibLabel();
|
return bkey->getBibLabel();
|
||||||
|
|
||||||
return "99";
|
return "99";
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef INSET_BIB_H
|
#ifndef INSET_BIB_H
|
||||||
@ -22,9 +22,9 @@
|
|||||||
class Buffer;
|
class Buffer;
|
||||||
|
|
||||||
/** Used to insert bibitem's information (key and label)
|
/** Used to insert bibitem's information (key and label)
|
||||||
|
|
||||||
Must be automatically inserted as the first object in a
|
Must be automatically inserted as the first object in a
|
||||||
bibliography paragraph.
|
bibliography paragraph.
|
||||||
*/
|
*/
|
||||||
class InsetBibKey : public InsetCommand {
|
class InsetBibKey : public InsetCommand {
|
||||||
public:
|
public:
|
||||||
@ -47,7 +47,7 @@ public:
|
|||||||
///
|
///
|
||||||
void edit(BufferView * bv, bool front = true);
|
void edit(BufferView * bv, bool front = true);
|
||||||
///
|
///
|
||||||
EDITABLE editable() const { return IS_EDITABLE; }
|
EDITABLE editable() const { return IS_EDITABLE; }
|
||||||
/// A user can't neither insert nor delete this inset
|
/// A user can't neither insert nor delete this inset
|
||||||
bool deletable() const {
|
bool deletable() const {
|
||||||
return false;
|
return false;
|
||||||
@ -63,7 +63,7 @@ public:
|
|||||||
InsetBibKey * inset;
|
InsetBibKey * inset;
|
||||||
BufferView * view;
|
BufferView * view;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
int counter;
|
int counter;
|
||||||
@ -74,7 +74,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Used to insert BibTeX's information
|
/** Used to insert BibTeX's information
|
||||||
*/
|
*/
|
||||||
class InsetBibtex : public InsetCommand {
|
class InsetBibtex : public InsetCommand {
|
||||||
public:
|
public:
|
||||||
@ -96,9 +96,9 @@ public:
|
|||||||
void edit(BufferView *, int x, int y, unsigned int button);
|
void edit(BufferView *, int x, int y, unsigned int button);
|
||||||
///
|
///
|
||||||
void edit(BufferView * bv, bool front = true);
|
void edit(BufferView * bv, bool front = true);
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &,
|
int latex(Buffer const *, std::ostream &,
|
||||||
bool fragile, bool freespace) const;
|
bool fragile, bool freespace) const;
|
||||||
///
|
///
|
||||||
std::vector<std::pair<string,string> > const getKeys(Buffer const *) const;
|
std::vector<std::pair<string,string> > const getKeys(Buffer const *) const;
|
||||||
///
|
///
|
||||||
@ -108,9 +108,9 @@ public:
|
|||||||
///
|
///
|
||||||
bool delDatabase(string const &);
|
bool delDatabase(string const &);
|
||||||
///
|
///
|
||||||
bool display() const { return true; }
|
bool display() const { return true; }
|
||||||
///
|
///
|
||||||
struct Holder {
|
struct Holder {
|
||||||
InsetBibtex * inset;
|
InsetBibtex * inset;
|
||||||
BufferView * view;
|
BufferView * view;
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 2000-2001 The LyX Team.
|
* Copyright 2000-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -29,16 +29,16 @@ using std::endl;
|
|||||||
int InsetButton::ascent(BufferView * bv, LyXFont const &) const
|
int InsetButton::ascent(BufferView * bv, LyXFont const &) const
|
||||||
{
|
{
|
||||||
lyx::Assert(bv);
|
lyx::Assert(bv);
|
||||||
|
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
font.decSize();
|
font.decSize();
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
int ascent;
|
int ascent;
|
||||||
int descent;
|
int descent;
|
||||||
string const s = getScreenLabel(bv->buffer());
|
string const s = getScreenLabel(bv->buffer());
|
||||||
|
|
||||||
if (editable()) {
|
if (editable()) {
|
||||||
lyxfont::buttonText(s, font, width, ascent, descent);
|
lyxfont::buttonText(s, font, width, ascent, descent);
|
||||||
} else {
|
} else {
|
||||||
lyxfont::rectText(s, font, width, ascent, descent);
|
lyxfont::rectText(s, font, width, ascent, descent);
|
||||||
@ -51,16 +51,16 @@ int InsetButton::ascent(BufferView * bv, LyXFont const &) const
|
|||||||
int InsetButton::descent(BufferView * bv, LyXFont const &) const
|
int InsetButton::descent(BufferView * bv, LyXFont const &) const
|
||||||
{
|
{
|
||||||
lyx::Assert(bv);
|
lyx::Assert(bv);
|
||||||
|
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
font.decSize();
|
font.decSize();
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
int ascent;
|
int ascent;
|
||||||
int descent;
|
int descent;
|
||||||
string const s = getScreenLabel(bv->buffer());
|
string const s = getScreenLabel(bv->buffer());
|
||||||
|
|
||||||
if (editable()) {
|
if (editable()) {
|
||||||
lyxfont::buttonText(s, font, width, ascent, descent);
|
lyxfont::buttonText(s, font, width, ascent, descent);
|
||||||
} else {
|
} else {
|
||||||
lyxfont::rectText(s, font, width, ascent, descent);
|
lyxfont::rectText(s, font, width, ascent, descent);
|
||||||
@ -76,13 +76,13 @@ int InsetButton::width(BufferView * bv, LyXFont const &) const
|
|||||||
|
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
font.decSize();
|
font.decSize();
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
int ascent;
|
int ascent;
|
||||||
int descent;
|
int descent;
|
||||||
string const s = getScreenLabel(bv->buffer());
|
string const s = getScreenLabel(bv->buffer());
|
||||||
|
|
||||||
if (editable()) {
|
if (editable()) {
|
||||||
lyxfont::buttonText(s, font, width, ascent, descent);
|
lyxfont::buttonText(s, font, width, ascent, descent);
|
||||||
} else {
|
} else {
|
||||||
lyxfont::rectText(s, font, width, ascent, descent);
|
lyxfont::rectText(s, font, width, ascent, descent);
|
||||||
@ -96,7 +96,7 @@ void InsetButton::draw(BufferView * bv, LyXFont const &,
|
|||||||
int baseline, float & x, bool) const
|
int baseline, float & x, bool) const
|
||||||
{
|
{
|
||||||
lyx::Assert(bv);
|
lyx::Assert(bv);
|
||||||
|
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
// Draw it as a box with the LaTeX text
|
// Draw it as a box with the LaTeX text
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 2000-2001 The LyX Team.
|
* Copyright 2000-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2000-2001 The LyX Team.
|
* Copyright 2000-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
@ -59,7 +59,7 @@ void InsetCaption::read(Buffer const * buf, LyXLex & lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetCaption::editMessage() const
|
string const InsetCaption::editMessage() const
|
||||||
{
|
{
|
||||||
return _("Opened Caption Inset");
|
return _("Opened Caption Inset");
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ void InsetCaption::draw(BufferView * bv, LyXFont const & f,
|
|||||||
|
|
||||||
// Generate the label
|
// Generate the label
|
||||||
string const label = _(fl) + " " + num + ":";
|
string const label = _(fl) + " " + num + ":";
|
||||||
|
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
int const w = lyxfont::width(label, f);
|
int const w = lyxfont::width(label, f);
|
||||||
pain.text(int(x), baseline, label, f);
|
pain.text(int(x), baseline, label, f);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2000-2001 The LyX Team.
|
* Copyright 2000-2001 The LyX Team.
|
||||||
@ -68,14 +68,14 @@ bool InsetCaption::display() const
|
|||||||
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
bool InsetCaption::needFullRow() const
|
bool InsetCaption::needFullRow() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
Inset::Code InsetCaption::lyxCode() const
|
Inset::Code InsetCaption::lyxCode() const
|
||||||
{
|
{
|
||||||
return CAPTION_CODE;
|
return CAPTION_CODE;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2000-2001 The LyX Team.
|
* Copyright 2000-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -76,8 +76,8 @@ void InsetCitation::edit(BufferView * bv, bool)
|
|||||||
|
|
||||||
int InsetCitation::ascii(Buffer const *, ostream & os, int) const
|
int InsetCitation::ascii(Buffer const *, ostream & os, int) const
|
||||||
{
|
{
|
||||||
os << "[" << getContents() << "]";
|
os << "[" << getContents() << "]";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Have to overwrite the default InsetCommand method in order to check that
|
// Have to overwrite the default InsetCommand method in order to check that
|
||||||
@ -102,7 +102,7 @@ int InsetCitation::latex(Buffer const * buffer, ostream & os,
|
|||||||
it != getContents().end(); ++it) {
|
it != getContents().end(); ++it) {
|
||||||
if (*it != ' ') content += *it;
|
if (*it != ' ') content += *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "{" << content << "}";
|
os << "{" << content << "}";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2000-2001 The LyX Team.
|
* Copyright 2000-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef INSET_CITE_H
|
#ifndef INSET_CITE_H
|
||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "insetcommand.h"
|
#include "insetcommand.h"
|
||||||
|
|
||||||
/** Used to insert citations
|
/** Used to insert citations
|
||||||
*/
|
*/
|
||||||
class InsetCitation : public InsetCommand {
|
class InsetCitation : public InsetCommand {
|
||||||
public:
|
public:
|
||||||
@ -39,7 +39,7 @@ public:
|
|||||||
void edit(BufferView * bv, bool front = true);
|
void edit(BufferView * bv, bool front = true);
|
||||||
///
|
///
|
||||||
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &, bool, bool) const;
|
int latex(Buffer const *, std::ostream &, bool, bool) const;
|
||||||
///
|
///
|
||||||
void validate(LaTeXFeatures &) const;
|
void validate(LaTeXFeatures &) const;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998-2001 The LyX Team.
|
* Copyright 1998-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
@ -147,7 +147,7 @@ int InsetCollapsable::ascent(BufferView * /*bv*/, LyXFont const &) const
|
|||||||
|
|
||||||
int InsetCollapsable::descent(BufferView * bv, LyXFont const & font) const
|
int InsetCollapsable::descent(BufferView * bv, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
if (collapsed_)
|
if (collapsed_)
|
||||||
return descent_collapsed();
|
return descent_collapsed();
|
||||||
|
|
||||||
return descent_collapsed()
|
return descent_collapsed()
|
||||||
@ -159,7 +159,7 @@ int InsetCollapsable::descent(BufferView * bv, LyXFont const & font) const
|
|||||||
|
|
||||||
int InsetCollapsable::width(BufferView * bv, LyXFont const & font) const
|
int InsetCollapsable::width(BufferView * bv, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
if (collapsed_)
|
if (collapsed_)
|
||||||
return width_collapsed();
|
return width_collapsed();
|
||||||
|
|
||||||
int widthCollapsed = width_collapsed();
|
int widthCollapsed = width_collapsed();
|
||||||
@ -178,8 +178,8 @@ void InsetCollapsable::draw_collapsed(Painter & pain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
||||||
int baseline, float & x, bool cleared) const
|
int baseline, float & x, bool cleared) const
|
||||||
{
|
{
|
||||||
if (need_update != NONE) {
|
if (need_update != NONE) {
|
||||||
const_cast<InsetText *>(&inset)->update(bv, f, true);
|
const_cast<InsetText *>(&inset)->update(bv, f, true);
|
||||||
@ -208,9 +208,9 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
|||||||
x += static_cast<float>(scroll());
|
x += static_cast<float>(scroll());
|
||||||
|
|
||||||
if (!cleared && (inset.need_update == InsetText::FULL ||
|
if (!cleared && (inset.need_update == InsetText::FULL ||
|
||||||
inset.need_update == InsetText::INIT ||
|
inset.need_update == InsetText::INIT ||
|
||||||
top_x != int(x) ||
|
top_x != int(x) ||
|
||||||
top_baseline != baseline))
|
top_baseline != baseline))
|
||||||
{
|
{
|
||||||
// we don't need anymore to clear here we just have to tell
|
// we don't need anymore to clear here we just have to tell
|
||||||
// the underlying LyXText that it should do the RowClear!
|
// the underlying LyXText that it should do the RowClear!
|
||||||
@ -224,9 +224,9 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
|||||||
top_baseline = baseline;
|
top_baseline = baseline;
|
||||||
|
|
||||||
int const bl = baseline - ascent(bv, f) + ascent_collapsed();
|
int const bl = baseline - ascent(bv, f) + ascent_collapsed();
|
||||||
|
|
||||||
draw_collapsed(pain, bl, old_x);
|
draw_collapsed(pain, bl, old_x);
|
||||||
inset.draw(bv, f,
|
inset.draw(bv, f,
|
||||||
bl + descent_collapsed() + inset.ascent(bv, f),
|
bl + descent_collapsed() + inset.ascent(bv, f),
|
||||||
x, cleared);
|
x, cleared);
|
||||||
if (x < (top_x + button_length + TEXT_TO_INSET_OFFSET))
|
if (x < (top_x + button_length + TEXT_TO_INSET_OFFSET))
|
||||||
@ -235,7 +235,7 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
|
|||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
|
void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
|
||||||
unsigned int button)
|
unsigned int button)
|
||||||
{
|
{
|
||||||
UpdatableInset::edit(bv, xp, yp, button);
|
UpdatableInset::edit(bv, xp, yp, button);
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ void InsetCollapsable::insetUnlock(BufferView * bv)
|
|||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::insetButtonPress(BufferView * bv,
|
void InsetCollapsable::insetButtonPress(BufferView * bv,
|
||||||
int x, int y, int button)
|
int x, int y, int button)
|
||||||
{
|
{
|
||||||
if (!collapsed_ && (y > button_bottom_y)) {
|
if (!collapsed_ && (y > button_bottom_y)) {
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
@ -327,7 +327,7 @@ void InsetCollapsable::insetButtonPress(BufferView * bv,
|
|||||||
|
|
||||||
|
|
||||||
bool InsetCollapsable::insetButtonRelease(BufferView * bv,
|
bool InsetCollapsable::insetButtonRelease(BufferView * bv,
|
||||||
int x, int y, int button)
|
int x, int y, int button)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if ((button != 3) && (x >= 0) && (x < button_length) &&
|
if ((button != 3) && (x >= 0) && (x < button_length) &&
|
||||||
@ -360,7 +360,7 @@ bool InsetCollapsable::insetButtonRelease(BufferView * bv,
|
|||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::insetMotionNotify(BufferView * bv,
|
void InsetCollapsable::insetMotionNotify(BufferView * bv,
|
||||||
int x, int y, int state)
|
int x, int y, int state)
|
||||||
{
|
{
|
||||||
if (y > button_bottom_y) {
|
if (y > button_bottom_y) {
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
@ -380,7 +380,7 @@ void InsetCollapsable::insetKeyPress(XKeyEvent * xke)
|
|||||||
|
|
||||||
|
|
||||||
int InsetCollapsable::latex(Buffer const * buf, ostream & os,
|
int InsetCollapsable::latex(Buffer const * buf, ostream & os,
|
||||||
bool fragile, bool free_spc) const
|
bool fragile, bool free_spc) const
|
||||||
{
|
{
|
||||||
return inset.latex(buf, os, fragile, free_spc);
|
return inset.latex(buf, os, fragile, free_spc);
|
||||||
}
|
}
|
||||||
@ -405,7 +405,7 @@ int InsetCollapsable::docbook(Buffer const * buf, ostream & os) const
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
int InsetCollapsable::getMaxWidth(BufferView * bv,
|
int InsetCollapsable::getMaxWidth(BufferView * bv,
|
||||||
UpdatableInset const * in) const
|
UpdatableInset const * in) const
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
int const w = UpdatableInset::getMaxWidth(bv, in);
|
int const w = UpdatableInset::getMaxWidth(bv, in);
|
||||||
@ -425,7 +425,7 @@ int InsetCollapsable::getMaxWidth(BufferView * bv,
|
|||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
||||||
bool reinit)
|
bool reinit)
|
||||||
{
|
{
|
||||||
if (in_update) {
|
if (in_update) {
|
||||||
if (reinit && owner()) {
|
if (reinit && owner()) {
|
||||||
@ -444,7 +444,7 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
|
|||||||
|
|
||||||
UpdatableInset::RESULT
|
UpdatableInset::RESULT
|
||||||
InsetCollapsable::localDispatch(BufferView * bv, kb_action action,
|
InsetCollapsable::localDispatch(BufferView * bv, kb_action action,
|
||||||
string const & arg)
|
string const & arg)
|
||||||
{
|
{
|
||||||
UpdatableInset::RESULT result = inset.localDispatch(bv, action, arg);
|
UpdatableInset::RESULT result = inset.localDispatch(bv, action, arg);
|
||||||
if (result >= FINISHED)
|
if (result >= FINISHED)
|
||||||
@ -463,7 +463,7 @@ bool InsetCollapsable::lockInsetInInset(BufferView * bv, UpdatableInset * in)
|
|||||||
|
|
||||||
|
|
||||||
bool InsetCollapsable::unlockInsetInInset(BufferView * bv, UpdatableInset * in,
|
bool InsetCollapsable::unlockInsetInInset(BufferView * bv, UpdatableInset * in,
|
||||||
bool lr)
|
bool lr)
|
||||||
{
|
{
|
||||||
if (&inset == in) {
|
if (&inset == in) {
|
||||||
bv->unlockInset(this);
|
bv->unlockInset(this);
|
||||||
@ -535,7 +535,7 @@ UpdatableInset * InsetCollapsable::getFirstLockingInsetOfType(Inset::Code c)
|
|||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::setFont(BufferView * bv, LyXFont const & font,
|
void InsetCollapsable::setFont(BufferView * bv, LyXFont const & font,
|
||||||
bool toggleall, bool selectall)
|
bool toggleall, bool selectall)
|
||||||
{
|
{
|
||||||
inset.setFont(bv, font, toggleall, selectall);
|
inset.setFont(bv, font, toggleall, selectall);
|
||||||
}
|
}
|
||||||
@ -579,7 +579,7 @@ bool InsetCollapsable::nodraw() const
|
|||||||
return inset.nodraw();
|
return inset.nodraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetCollapsable::scroll(bool recursive) const
|
int InsetCollapsable::scroll(bool recursive) const
|
||||||
{
|
{
|
||||||
int sx = UpdatableInset::scroll(false);
|
int sx = UpdatableInset::scroll(false);
|
||||||
@ -627,7 +627,7 @@ Inset * InsetCollapsable::getInsetFromID(int id_arg) const
|
|||||||
void InsetCollapsable::open(BufferView * bv)
|
void InsetCollapsable::open(BufferView * bv)
|
||||||
{
|
{
|
||||||
if (!collapsed_) return;
|
if (!collapsed_) return;
|
||||||
|
|
||||||
collapsed_ = false;
|
collapsed_ = false;
|
||||||
bv->updateInset(this, false);
|
bv->updateInset(this, false);
|
||||||
}
|
}
|
||||||
@ -637,7 +637,7 @@ void InsetCollapsable::close(BufferView * bv) const
|
|||||||
{
|
{
|
||||||
if (collapsed_)
|
if (collapsed_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
collapsed_ = true;
|
collapsed_ = true;
|
||||||
bv->updateInset(const_cast<InsetCollapsable *>(this), false);
|
bv->updateInset(const_cast<InsetCollapsable *>(this), false);
|
||||||
}
|
}
|
||||||
@ -650,7 +650,7 @@ void InsetCollapsable::setLabel(string const & l) const
|
|||||||
|
|
||||||
|
|
||||||
bool InsetCollapsable::searchForward(BufferView * bv, string const & str,
|
bool InsetCollapsable::searchForward(BufferView * bv, string const & str,
|
||||||
bool cs, bool mw)
|
bool cs, bool mw)
|
||||||
{
|
{
|
||||||
bool found = inset.searchForward(bv, str, cs, mw);
|
bool found = inset.searchForward(bv, str, cs, mw);
|
||||||
if (first_after_edit && !found)
|
if (first_after_edit && !found)
|
||||||
@ -661,7 +661,7 @@ bool InsetCollapsable::searchForward(BufferView * bv, string const & str,
|
|||||||
|
|
||||||
|
|
||||||
bool InsetCollapsable::searchBackward(BufferView * bv, string const & str,
|
bool InsetCollapsable::searchBackward(BufferView * bv, string const & str,
|
||||||
bool cs, bool mw)
|
bool cs, bool mw)
|
||||||
{
|
{
|
||||||
bool found = inset.searchBackward(bv, str, cs, mw);
|
bool found = inset.searchBackward(bv, str, cs, mw);
|
||||||
if (first_after_edit && !found)
|
if (first_after_edit && !found)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2000-2001 The LyX Team.
|
* Copyright 2000-2001 The LyX Team.
|
||||||
@ -28,7 +28,7 @@ class Paragraph;
|
|||||||
class LyXCursor;
|
class LyXCursor;
|
||||||
|
|
||||||
/** A collapsable text inset
|
/** A collapsable text inset
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class InsetCollapsable : public UpdatableInset {
|
class InsetCollapsable : public UpdatableInset {
|
||||||
public:
|
public:
|
||||||
@ -58,7 +58,7 @@ public:
|
|||||||
///
|
///
|
||||||
void draw(BufferView *, const LyXFont &, int , float &, bool) const;
|
void draw(BufferView *, const LyXFont &, int , float &, bool) const;
|
||||||
///
|
///
|
||||||
void update(BufferView *, LyXFont const &, bool =false);
|
void update(BufferView *, LyXFont const &, bool =false);
|
||||||
///
|
///
|
||||||
void edit(BufferView *, int, int, unsigned int);
|
void edit(BufferView *, int, int, unsigned int);
|
||||||
///
|
///
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
bool lockInsetInInset(BufferView *, UpdatableInset *);
|
bool lockInsetInInset(BufferView *, UpdatableInset *);
|
||||||
///
|
///
|
||||||
bool unlockInsetInInset(BufferView *, UpdatableInset *,
|
bool unlockInsetInInset(BufferView *, UpdatableInset *,
|
||||||
bool lr = false);
|
bool lr = false);
|
||||||
///
|
///
|
||||||
bool updateInsetInInset(BufferView *, Inset *);
|
bool updateInsetInInset(BufferView *, Inset *);
|
||||||
///
|
///
|
||||||
@ -98,7 +98,7 @@ public:
|
|||||||
void insetKeyPress(XKeyEvent *);
|
void insetKeyPress(XKeyEvent *);
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
|
UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
|
||||||
string const &);
|
string const &);
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &,
|
int latex(Buffer const *, std::ostream &,
|
||||||
bool fragile, bool free_spc) const;
|
bool fragile, bool free_spc) const;
|
||||||
@ -127,7 +127,7 @@ public:
|
|||||||
UpdatableInset * getFirstLockingInsetOfType(Inset::Code);
|
UpdatableInset * getFirstLockingInsetOfType(Inset::Code);
|
||||||
///
|
///
|
||||||
void setFont(BufferView *, LyXFont const &, bool toggleall = false,
|
void setFont(BufferView *, LyXFont const &, bool toggleall = false,
|
||||||
bool selectall = false);
|
bool selectall = false);
|
||||||
///
|
///
|
||||||
void setLabel(string const & l) const;
|
void setLabel(string const & l) const;
|
||||||
///
|
///
|
||||||
@ -188,9 +188,9 @@ public:
|
|||||||
}
|
}
|
||||||
///
|
///
|
||||||
bool searchForward(BufferView * bv, string const & str,
|
bool searchForward(BufferView * bv, string const & str,
|
||||||
bool = true, bool = false);
|
bool = true, bool = false);
|
||||||
bool searchBackward(BufferView * bv, string const & str,
|
bool searchBackward(BufferView * bv, string const & str,
|
||||||
bool = true, bool = false);
|
bool = true, bool = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
@ -203,7 +203,7 @@ protected:
|
|||||||
void draw_collapsed(Painter & pain, int , float &) const;
|
void draw_collapsed(Painter & pain, int , float &) const;
|
||||||
///
|
///
|
||||||
int getMaxTextWidth(Painter & pain, UpdatableInset const *) const;
|
int getMaxTextWidth(Painter & pain, UpdatableInset const *) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
mutable bool collapsed_;
|
mutable bool collapsed_;
|
||||||
///
|
///
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -84,7 +84,7 @@ void InsetCommandParams::scanCommand(string const & cmd)
|
|||||||
if (cmd.empty()) return;
|
if (cmd.empty()) return;
|
||||||
|
|
||||||
enum { WS, CMDNAME, OPTION, CONTENT } state = WS;
|
enum { WS, CMDNAME, OPTION, CONTENT } state = WS;
|
||||||
|
|
||||||
// Used to handle things like \command[foo[bar]]{foo{bar}}
|
// Used to handle things like \command[foo[bar]]{foo{bar}}
|
||||||
int nestdepth = 0;
|
int nestdepth = 0;
|
||||||
|
|
||||||
@ -105,11 +105,11 @@ void InsetCommandParams::scanCommand(string const & cmd)
|
|||||||
}
|
}
|
||||||
if ((state == OPTION && c == '[') ||
|
if ((state == OPTION && c == '[') ||
|
||||||
(state == CONTENT && c == '{')) {
|
(state == CONTENT && c == '{')) {
|
||||||
++nestdepth;
|
++nestdepth;
|
||||||
}
|
}
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case CMDNAME: tcmdname += c; break;
|
case CMDNAME: tcmdname += c; break;
|
||||||
case OPTION: toptions += c; break;
|
case OPTION: toptions += c; break;
|
||||||
case CONTENT: tcontents += c; break;
|
case CONTENT: tcontents += c; break;
|
||||||
case WS:
|
case WS:
|
||||||
if (c == '\\') {
|
if (c == '\\') {
|
||||||
@ -128,7 +128,7 @@ void InsetCommandParams::scanCommand(string const & cmd)
|
|||||||
// Don't mess with this.
|
// Don't mess with this.
|
||||||
if (!tcmdname.empty()) setCmdName(tcmdname);
|
if (!tcmdname.empty()) setCmdName(tcmdname);
|
||||||
if (!toptions.empty()) setOptions(toptions);
|
if (!toptions.empty()) setOptions(toptions);
|
||||||
if (!tcontents.empty()) setContents(tcontents);
|
if (!tcontents.empty()) setContents(tcontents);
|
||||||
|
|
||||||
if (lyxerr.debugging(Debug::PARSER))
|
if (lyxerr.debugging(Debug::PARSER))
|
||||||
lyxerr << "Command <" << cmd
|
lyxerr << "Command <" << cmd
|
||||||
@ -141,7 +141,7 @@ void InsetCommandParams::scanCommand(string const & cmd)
|
|||||||
|
|
||||||
// This function will not be necessary when lyx3
|
// This function will not be necessary when lyx3
|
||||||
void InsetCommandParams::read(LyXLex & lex)
|
void InsetCommandParams::read(LyXLex & lex)
|
||||||
{
|
{
|
||||||
string token;
|
string token;
|
||||||
|
|
||||||
if (lex.eatLine()) {
|
if (lex.eatLine()) {
|
||||||
@ -150,7 +150,7 @@ void InsetCommandParams::read(LyXLex & lex)
|
|||||||
} else {
|
} else {
|
||||||
lex.printError("InsetCommand: Parse error: `$$Token'");
|
lex.printError("InsetCommand: Parse error: `$$Token'");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (lex.isOK()) {
|
while (lex.isOK()) {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
token = lex.getString();
|
token = lex.getString();
|
||||||
@ -171,7 +171,7 @@ void InsetCommandParams::write(ostream & os) const
|
|||||||
|
|
||||||
|
|
||||||
string const InsetCommandParams::getCommand() const
|
string const InsetCommandParams::getCommand() const
|
||||||
{
|
{
|
||||||
string s;
|
string s;
|
||||||
if (!getCmdName().empty()) s += "\\"+getCmdName();
|
if (!getCmdName().empty()) s += "\\"+getCmdName();
|
||||||
if (!getOptions().empty()) s += "["+getOptions()+']';
|
if (!getOptions().empty()) s += "["+getOptions()+']';
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -24,7 +24,7 @@
|
|||||||
/** Used to insert a LaTeX command automatically
|
/** Used to insert a LaTeX command automatically
|
||||||
*
|
*
|
||||||
* Similar to InsetLaTeX but having control of the basic structure of a
|
* Similar to InsetLaTeX but having control of the basic structure of a
|
||||||
* LaTeX command: \name[options]{contents}.
|
* LaTeX command: \name[options]{contents}.
|
||||||
*/
|
*/
|
||||||
class InsetCommandParams {
|
class InsetCommandParams {
|
||||||
public:
|
public:
|
||||||
@ -64,11 +64,11 @@ public:
|
|||||||
///
|
///
|
||||||
void setFromString(string const &);
|
void setFromString(string const &);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
string cmdname;
|
string cmdname;
|
||||||
///
|
///
|
||||||
string contents;
|
string contents;
|
||||||
///
|
///
|
||||||
string options;
|
string options;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ public:
|
|||||||
{ p_.read(lex); }
|
{ p_.read(lex); }
|
||||||
/// Can remove one InsetBibKey is modified
|
/// Can remove one InsetBibKey is modified
|
||||||
void scanCommand(string const & c) { p_.scanCommand(c); };
|
void scanCommand(string const & c) { p_.scanCommand(c); };
|
||||||
///
|
///
|
||||||
virtual int latex(Buffer const *, std::ostream &,
|
virtual int latex(Buffer const *, std::ostream &,
|
||||||
bool fragile, bool free_spc) const;
|
bool fragile, bool free_spc) const;
|
||||||
///
|
///
|
||||||
@ -100,7 +100,7 @@ public:
|
|||||||
virtual int docbook(Buffer const *, std::ostream &) const;
|
virtual int docbook(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
Inset::Code lyxCode() const { return Inset::NO_CODE; }
|
Inset::Code lyxCode() const { return Inset::NO_CODE; }
|
||||||
|
|
||||||
///
|
///
|
||||||
string const getCommand() const { return p_.getCommand(); }
|
string const getCommand() const { return p_.getCommand(); }
|
||||||
///
|
///
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -63,7 +63,7 @@ void InsetError::draw(BufferView * bv, LyXFont const & font,
|
|||||||
LyXFont efont;
|
LyXFont efont;
|
||||||
efont.setSize(font.size()).decSize();
|
efont.setSize(font.size()).decSize();
|
||||||
efont.setColor(LColor::error);
|
efont.setColor(LColor::error);
|
||||||
|
|
||||||
// Draw as "Error" in a framed box
|
// Draw as "Error" in a framed box
|
||||||
x += 1;
|
x += 1;
|
||||||
pain.fillRectangle(int(x), baseline - ascent(bv, font) + 1,
|
pain.fillRectangle(int(x), baseline - ascent(bv, font) + 1,
|
||||||
@ -80,7 +80,7 @@ void InsetError::draw(BufferView * bv, LyXFont const & font,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetError::editMessage() const
|
string const InsetError::editMessage() const
|
||||||
{
|
{
|
||||||
return _("Opened error");
|
return _("Opened error");
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
@ -21,9 +21,9 @@
|
|||||||
#include <sigc++/signal_system.h>
|
#include <sigc++/signal_system.h>
|
||||||
|
|
||||||
/** Used for error messages from LaTeX runs.
|
/** Used for error messages from LaTeX runs.
|
||||||
|
|
||||||
The edit-operation opens a
|
The edit-operation opens a
|
||||||
dialog with the text of the error-message. The inset is displayed as
|
dialog with the text of the error-message. The inset is displayed as
|
||||||
"Error" in a box, and automatically deleted. */
|
"Error" in a box, and automatically deleted. */
|
||||||
class InsetError : public Inset {
|
class InsetError : public Inset {
|
||||||
public:
|
public:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
*======================================================*/
|
||||||
@ -89,7 +89,7 @@ InsetERT::InsetERT(BufferParams const & bp,
|
|||||||
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
|
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
|
||||||
font.setColor(LColor::latex);
|
font.setColor(LColor::latex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
string::const_iterator cit = contents.begin();
|
string::const_iterator cit = contents.begin();
|
||||||
string::const_iterator end = contents.end();
|
string::const_iterator end = contents.end();
|
||||||
pos_type pos = 0;
|
pos_type pos = 0;
|
||||||
@ -117,7 +117,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
|
|||||||
if (token == "status") {
|
if (token == "status") {
|
||||||
lex.next();
|
lex.next();
|
||||||
string const tmp_token = lex.getString();
|
string const tmp_token = lex.getString();
|
||||||
|
|
||||||
if (tmp_token == "Inlined") {
|
if (tmp_token == "Inlined") {
|
||||||
status(0, Inlined);
|
status(0, Inlined);
|
||||||
} else if (tmp_token == "Collapsed") {
|
} else if (tmp_token == "Collapsed") {
|
||||||
@ -126,7 +126,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
|
|||||||
// leave this as default!
|
// leave this as default!
|
||||||
status(0, Open);
|
status(0, Open);
|
||||||
}
|
}
|
||||||
|
|
||||||
token_found = true;
|
token_found = true;
|
||||||
} else {
|
} else {
|
||||||
lyxerr << "InsetERT::Read: Missing 'status'-tag!"
|
lyxerr << "InsetERT::Read: Missing 'status'-tag!"
|
||||||
@ -155,7 +155,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
|
|||||||
#ifdef SET_HARD_FONT
|
#ifdef SET_HARD_FONT
|
||||||
#ifndef INHERIT_LANG
|
#ifndef INHERIT_LANG
|
||||||
LyXFont font(LyXFont::ALL_INHERIT, latex_language);
|
LyXFont font(LyXFont::ALL_INHERIT, latex_language);
|
||||||
#else
|
#else
|
||||||
LyXFont font(LyXFont::ALL_INHERIT);
|
LyXFont font(LyXFont::ALL_INHERIT);
|
||||||
#endif
|
#endif
|
||||||
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
|
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
|
||||||
@ -169,7 +169,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
|
|||||||
par = par->next();
|
par = par->next();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!token_found) {
|
if (!token_found) {
|
||||||
if (collapsed_) {
|
if (collapsed_) {
|
||||||
status(0, Collapsed);
|
status(0, Collapsed);
|
||||||
@ -181,12 +181,12 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::write(Buffer const * buf, ostream & os) const
|
void InsetERT::write(Buffer const * buf, ostream & os) const
|
||||||
{
|
{
|
||||||
string st;
|
string st;
|
||||||
|
|
||||||
switch (status_) {
|
switch (status_) {
|
||||||
case Open:
|
case Open:
|
||||||
st = "Open";
|
st = "Open";
|
||||||
break;
|
break;
|
||||||
case Collapsed:
|
case Collapsed:
|
||||||
@ -229,7 +229,7 @@ void InsetERT::write(Buffer const * buf, ostream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetERT::editMessage() const
|
string const InsetERT::editMessage() const
|
||||||
{
|
{
|
||||||
return _("Opened ERT Inset");
|
return _("Opened ERT Inset");
|
||||||
}
|
}
|
||||||
@ -247,8 +247,8 @@ void InsetERT::setFont(BufferView *, LyXFont const &, bool, bool selectall)
|
|||||||
// fontchange and this messages is not needed
|
// fontchange and this messages is not needed
|
||||||
if (!selectall)
|
if (!selectall)
|
||||||
Alert::alert(_("Impossible Operation!"),
|
Alert::alert(_("Impossible Operation!"),
|
||||||
_("Not permitted to change font-types inside ERT-insets!"),
|
_("Not permitted to change font-types inside ERT-insets!"),
|
||||||
_("Sorry."));
|
_("Sorry."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ void InsetERT::updateStatus(BufferView * bv, bool swap) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::edit(BufferView * bv, int x, int y, unsigned int button)
|
void InsetERT::edit(BufferView * bv, int x, int y, unsigned int button)
|
||||||
{
|
{
|
||||||
if (button == 3)
|
if (button == 3)
|
||||||
@ -300,7 +300,7 @@ void InsetERT::edit(BufferView * bv, bool front)
|
|||||||
|
|
||||||
|
|
||||||
void InsetERT::insetButtonPress(BufferView * bv,
|
void InsetERT::insetButtonPress(BufferView * bv,
|
||||||
int x, int y, int button)
|
int x, int y, int button)
|
||||||
{
|
{
|
||||||
if (status_ == Inlined) {
|
if (status_ == Inlined) {
|
||||||
inset.insetButtonPress(bv, x, y, button);
|
inset.insetButtonPress(bv, x, y, button);
|
||||||
@ -316,15 +316,15 @@ bool InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
|
|||||||
showInsetDialog(bv);
|
showInsetDialog(bv);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status_ != Inlined && (x >= 0) && (x < button_length) &&
|
if (status_ != Inlined && (x >= 0) && (x < button_length) &&
|
||||||
(y >= button_top_y) && (y <= button_bottom_y)) {
|
(y >= button_top_y) && (y <= button_bottom_y)) {
|
||||||
updateStatus(bv, true);
|
updateStatus(bv, true);
|
||||||
} else {
|
} else {
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
int yy = ascent(bv, font) + y - inset.ascent(bv, font);
|
int yy = ascent(bv, font) + y - inset.ascent(bv, font);
|
||||||
|
|
||||||
// inlined is special - the text appears above
|
// inlined is special - the text appears above
|
||||||
// button_bottom_y
|
// button_bottom_y
|
||||||
if (status_ == Inlined) {
|
if (status_ == Inlined) {
|
||||||
inset.insetButtonRelease(bv, x, yy, button);
|
inset.insetButtonRelease(bv, x, yy, button);
|
||||||
@ -338,7 +338,7 @@ bool InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
|
|||||||
|
|
||||||
|
|
||||||
void InsetERT::insetMotionNotify(BufferView * bv,
|
void InsetERT::insetMotionNotify(BufferView * bv,
|
||||||
int x, int y, int state)
|
int x, int y, int state)
|
||||||
{
|
{
|
||||||
if (status_ == Inlined) {
|
if (status_ == Inlined) {
|
||||||
inset.insetMotionNotify(bv, x, y, state);
|
inset.insetMotionNotify(bv, x, y, state);
|
||||||
@ -373,13 +373,13 @@ int InsetERT::latex(Buffer const *, ostream & os, bool /*fragile*/,
|
|||||||
lines += 2;
|
lines += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetERT::ascii(Buffer const *,
|
int InsetERT::ascii(Buffer const *,
|
||||||
ostream &, int /*linelen*/) const
|
ostream &, int /*linelen*/) const
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -409,7 +409,7 @@ int InsetERT::linuxdoc(Buffer const *, ostream & os) const
|
|||||||
lines ++;
|
lines ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ int InsetERT::docbook(Buffer const *, ostream & os) const
|
|||||||
lines ++;
|
lines ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ InsetERT::localDispatch(BufferView * bv, kb_action action, string const & arg)
|
|||||||
case LFUN_CUT:
|
case LFUN_CUT:
|
||||||
set_latex_font(bv);
|
set_latex_font(bv);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -517,7 +517,7 @@ bool InsetERT::checkInsertChar(LyXFont & /* font */)
|
|||||||
#ifdef SET_HARD_FONT
|
#ifdef SET_HARD_FONT
|
||||||
#ifndef INHERIT_LANG
|
#ifndef INHERIT_LANG
|
||||||
LyXFont f(LyXFont::ALL_INHERIT, latex_language);
|
LyXFont f(LyXFont::ALL_INHERIT, latex_language);
|
||||||
#else
|
#else
|
||||||
LyXFont f(LyXFont::ALL_INHERIT);
|
LyXFont f(LyXFont::ALL_INHERIT);
|
||||||
#endif
|
#endif
|
||||||
font = f;
|
font = f;
|
||||||
@ -555,8 +555,8 @@ int InsetERT::width(BufferView * bv, LyXFont const & font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::draw(BufferView * bv, LyXFont const & f,
|
void InsetERT::draw(BufferView * bv, LyXFont const & f,
|
||||||
int baseline, float & x, bool cleared) const
|
int baseline, float & x, bool cleared) const
|
||||||
{
|
{
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
|
|
||||||
@ -577,9 +577,9 @@ void InsetERT::draw(BufferView * bv, LyXFont const & f,
|
|||||||
x += static_cast<float>(scroll());
|
x += static_cast<float>(scroll());
|
||||||
|
|
||||||
if (!cleared && (inset.need_update == InsetText::FULL ||
|
if (!cleared && (inset.need_update == InsetText::FULL ||
|
||||||
inset.need_update == InsetText::INIT ||
|
inset.need_update == InsetText::INIT ||
|
||||||
top_x != int(x) ||
|
top_x != int(x) ||
|
||||||
top_baseline != baseline))
|
top_baseline != baseline))
|
||||||
{
|
{
|
||||||
// we don't need anymore to clear here we just have to tell
|
// we don't need anymore to clear here we just have to tell
|
||||||
// the underlying LyXText that it should do the RowClear!
|
// the underlying LyXText that it should do the RowClear!
|
||||||
@ -598,7 +598,7 @@ void InsetERT::draw(BufferView * bv, LyXFont const & f,
|
|||||||
inset.draw(bv, f, baseline, x, cleared);
|
inset.draw(bv, f, baseline, x, cleared);
|
||||||
} else {
|
} else {
|
||||||
draw_collapsed(pain, bl, old_x);
|
draw_collapsed(pain, bl, old_x);
|
||||||
inset.draw(bv, f,
|
inset.draw(bv, f,
|
||||||
bl + descent_collapsed() + inset.ascent(bv, f),
|
bl + descent_collapsed() + inset.ascent(bv, f),
|
||||||
x, cleared);
|
x, cleared);
|
||||||
}
|
}
|
||||||
@ -611,7 +611,7 @@ void InsetERT::set_latex_font(BufferView * /* bv */)
|
|||||||
#ifdef SET_HARD_FONT
|
#ifdef SET_HARD_FONT
|
||||||
#ifndef INHERIT_LANG
|
#ifndef INHERIT_LANG
|
||||||
LyXFont font(LyXFont::ALL_INHERIT, latex_language);
|
LyXFont font(LyXFont::ALL_INHERIT, latex_language);
|
||||||
#else
|
#else
|
||||||
LyXFont font(LyXFont::ALL_INHERIT);
|
LyXFont font(LyXFont::ALL_INHERIT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -675,7 +675,7 @@ void InsetERT::close(BufferView * bv) const
|
|||||||
|
|
||||||
|
|
||||||
string const InsetERT::selectNextWordToSpellcheck(BufferView * bv,
|
string const InsetERT::selectNextWordToSpellcheck(BufferView * bv,
|
||||||
float &) const
|
float &) const
|
||||||
{
|
{
|
||||||
bv->unlockInset(const_cast<InsetERT *>(this));
|
bv->unlockInset(const_cast<InsetERT *>(this));
|
||||||
return string();
|
return string();
|
||||||
@ -686,7 +686,7 @@ void InsetERT::getDrawFont(LyXFont & font) const
|
|||||||
{
|
{
|
||||||
#ifndef INHERIT_LANG
|
#ifndef INHERIT_LANG
|
||||||
LyXFont f(LyXFont::ALL_INHERIT, latex_language);
|
LyXFont f(LyXFont::ALL_INHERIT, latex_language);
|
||||||
#else
|
#else
|
||||||
LyXFont f(LyXFont::ALL_INHERIT);
|
LyXFont f(LyXFont::ALL_INHERIT);
|
||||||
#endif
|
#endif
|
||||||
font = f;
|
font = f;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
@ -22,12 +22,12 @@
|
|||||||
#include <sigc++/signal_system.h>
|
#include <sigc++/signal_system.h>
|
||||||
|
|
||||||
/** A collapsable text inset for LaTeX insertions.
|
/** A collapsable text inset for LaTeX insertions.
|
||||||
|
|
||||||
To write full ert (including styles and other insets) in a given
|
To write full ert (including styles and other insets) in a given
|
||||||
space.
|
space.
|
||||||
|
|
||||||
Note that collapsed_ encompasses both the inline and collapsed button
|
Note that collapsed_ encompasses both the inline and collapsed button
|
||||||
versions of this inset.
|
versions of this inset.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Language;
|
class Language;
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
bool insetAllowed(Inset::Code) const { return false; }
|
bool insetAllowed(Inset::Code) const { return false; }
|
||||||
///
|
///
|
||||||
void setFont(BufferView *, LyXFont const &,
|
void setFont(BufferView *, LyXFont const &,
|
||||||
bool toggleall = false, bool selectall = false);
|
bool toggleall = false, bool selectall = false);
|
||||||
///
|
///
|
||||||
void edit(BufferView *, int, int, unsigned int);
|
void edit(BufferView *, int, int, unsigned int);
|
||||||
///
|
///
|
||||||
@ -85,7 +85,7 @@ public:
|
|||||||
bool free_spc) const;
|
bool free_spc) const;
|
||||||
///
|
///
|
||||||
int ascii(Buffer const *,
|
int ascii(Buffer const *,
|
||||||
std::ostream &, int linelen = 0) const;
|
std::ostream &, int linelen = 0) const;
|
||||||
///
|
///
|
||||||
int linuxdoc(Buffer const *, std::ostream &) const;
|
int linuxdoc(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
void validate(LaTeXFeatures &) const {}
|
void validate(LaTeXFeatures &) const {}
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
|
UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
|
||||||
string const &);
|
string const &);
|
||||||
///
|
///
|
||||||
bool checkInsertChar(LyXFont &);
|
bool checkInsertChar(LyXFont &);
|
||||||
///
|
///
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -40,7 +40,7 @@ using std::ostream;
|
|||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
|
|
||||||
InsetExternal::InsetExternal()
|
InsetExternal::InsetExternal()
|
||||||
: view_(0)
|
: view_(0)
|
||||||
{
|
{
|
||||||
tempname_ = lyx::tempName(string(), "lyxext");
|
tempname_ = lyx::tempName(string(), "lyxext");
|
||||||
@ -60,14 +60,14 @@ InsetExternal::Params InsetExternal::params() const
|
|||||||
{
|
{
|
||||||
return params_;
|
return params_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetExternal::setFromParams(Params const & p)
|
void InsetExternal::setFromParams(Params const & p)
|
||||||
{
|
{
|
||||||
params_.filename = p.filename;
|
params_.filename = p.filename;
|
||||||
params_.parameters = p.parameters;
|
params_.parameters = p.parameters;
|
||||||
params_.templ = p.templ;
|
params_.templ = p.templ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetExternal::editMessage() const
|
string const InsetExternal::editMessage() const
|
||||||
@ -108,7 +108,7 @@ void InsetExternal::read(Buffer const *, LyXLex & lex)
|
|||||||
} else {
|
} else {
|
||||||
lex.printError("InsetExternal: Parse error: `$$Token'");
|
lex.printError("InsetExternal: Parse error: `$$Token'");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (lex.isOK()) {
|
while (lex.isOK()) {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
token = lex.getString();
|
token = lex.getString();
|
||||||
@ -145,7 +145,7 @@ int InsetExternal::write(string const & format,
|
|||||||
<< params_.templ.lyxName << endl;
|
<< params_.templ.lyxName << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateExternal(format, buf);
|
updateExternal(format, buf);
|
||||||
os << doSubstitution(buf, cit->second.product);
|
os << doSubstitution(buf, cit->second.product);
|
||||||
return 0; // CHECK (FIXME check what ? - jbl)
|
return 0; // CHECK (FIXME check what ? - jbl)
|
||||||
@ -185,7 +185,7 @@ void InsetExternal::validate(LaTeXFeatures & features) const
|
|||||||
|
|
||||||
if (cit == et.formats.end())
|
if (cit == et.formats.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!cit->second.requirement.empty()) {
|
if (!cit->second.requirement.empty()) {
|
||||||
features.require(cit->second.requirement);
|
features.require(cit->second.requirement);
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ string const InsetExternal::doSubstitution(Buffer const * buffer,
|
|||||||
result = ReplaceEnvironmentPath(result);
|
result = ReplaceEnvironmentPath(result);
|
||||||
result = subst(result, "$$Tempname", tempname_);
|
result = subst(result, "$$Tempname", tempname_);
|
||||||
result = subst(result, "$$Sysdir", system_lyxdir);
|
result = subst(result, "$$Sysdir", system_lyxdir);
|
||||||
|
|
||||||
// Handle the $$Contents(filename) syntax
|
// Handle the $$Contents(filename) syntax
|
||||||
if (contains(result, "$$Contents(\"")) {
|
if (contains(result, "$$Contents(\"")) {
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ string const InsetExternal::doSubstitution(Buffer const * buffer,
|
|||||||
|
|
||||||
void InsetExternal::updateExternal() const
|
void InsetExternal::updateExternal() const
|
||||||
{
|
{
|
||||||
updateExternal("LaTeX", view_->buffer());
|
updateExternal("LaTeX", view_->buffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsetExternal::updateExternal(string const & format,
|
void InsetExternal::updateExternal(string const & format,
|
||||||
@ -285,7 +285,7 @@ void InsetExternal::updateExternal(string const & format,
|
|||||||
cit->second.updateCommand.empty() ||
|
cit->second.updateCommand.empty() ||
|
||||||
!et.automaticProduction)
|
!et.automaticProduction)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!cit->second.updateResult.empty()) {
|
if (!cit->second.updateResult.empty()) {
|
||||||
string const resultfile = doSubstitution(buf,
|
string const resultfile = doSubstitution(buf,
|
||||||
cit->second.updateResult);
|
cit->second.updateResult);
|
||||||
@ -294,7 +294,7 @@ void InsetExternal::updateExternal(string const & format,
|
|||||||
if (fi2.exist() && fi.exist() &&
|
if (fi2.exist() && fi.exist() &&
|
||||||
::difftime(fi2.getModificationTime(),
|
::difftime(fi2.getModificationTime(),
|
||||||
fi.getModificationTime()) >= 0) {
|
fi.getModificationTime()) >= 0) {
|
||||||
lyxerr[Debug::FILES] << resultfile
|
lyxerr[Debug::FILES] << resultfile
|
||||||
<< " is up to date" << endl;
|
<< " is up to date" << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -342,6 +342,5 @@ bool operator==(InsetExternal::Params const & left,
|
|||||||
bool operator!=(InsetExternal::Params const & left,
|
bool operator!=(InsetExternal::Params const & left,
|
||||||
InsetExternal::Params const & right)
|
InsetExternal::Params const & right)
|
||||||
{
|
{
|
||||||
return !(left == right);
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -26,8 +26,8 @@ class InsetExternal : public InsetButton {
|
|||||||
public:
|
public:
|
||||||
/// hold parameters settable from the GUI
|
/// hold parameters settable from the GUI
|
||||||
struct Params {
|
struct Params {
|
||||||
Params(string const & f = string(),
|
Params(string const & f = string(),
|
||||||
string const & p = string(),
|
string const & p = string(),
|
||||||
ExternalTemplate const & t = ExternalTemplate())
|
ExternalTemplate const & t = ExternalTemplate())
|
||||||
: filename(f), parameters(p), templ(t) {}
|
: filename(f), parameters(p), templ(t) {}
|
||||||
/// the filename
|
/// the filename
|
||||||
@ -61,7 +61,7 @@ public:
|
|||||||
is in a free-spacing paragraph.
|
is in a free-spacing paragraph.
|
||||||
*/
|
*/
|
||||||
virtual int latex(Buffer const *, std::ostream &, bool fragile,
|
virtual int latex(Buffer const *, std::ostream &, bool fragile,
|
||||||
bool free_spc) const;
|
bool free_spc) const;
|
||||||
/// write ASCII output to the ostream
|
/// write ASCII output to the ostream
|
||||||
virtual int ascii(Buffer const *, std::ostream &, int linelen) const;
|
virtual int ascii(Buffer const *, std::ostream &, int linelen) const;
|
||||||
/// write LinuxDoc output to the ostream
|
/// write LinuxDoc output to the ostream
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
/// returns LyX code associated with the inset. Used for TOC, ...)
|
/// returns LyX code associated with the inset. Used for TOC, ...)
|
||||||
virtual Inset::Code lyxCode() const { return EXTERNAL_CODE; }
|
virtual Inset::Code lyxCode() const { return EXTERNAL_CODE; }
|
||||||
|
|
||||||
///
|
///
|
||||||
virtual Inset * clone(Buffer const &, bool same_id = false) const;
|
virtual Inset * clone(Buffer const &, bool same_id = false) const;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998-2001 The LyX Team.
|
* Copyright 1998-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
@ -61,7 +61,7 @@ using std::endl;
|
|||||||
// within - This (optional) argument determines whether floats of this
|
// within - This (optional) argument determines whether floats of this
|
||||||
// class will be numbered within some sectional unit of the
|
// class will be numbered within some sectional unit of the
|
||||||
// document. For example, if within is equal to chapter, the
|
// document. For example, if within is equal to chapter, the
|
||||||
// floats will be numbered within chapters.
|
// floats will be numbered within chapters.
|
||||||
// \floatstyle{style}
|
// \floatstyle{style}
|
||||||
// style - plain, boxed, ruled
|
// style - plain, boxed, ruled
|
||||||
// \floatname{float}{floatname}
|
// \floatname{float}{floatname}
|
||||||
@ -143,7 +143,7 @@ void InsetFloat::write(Buffer const * buf, ostream & os) const
|
|||||||
} else {
|
} else {
|
||||||
os << "wide false\n";
|
os << "wide false\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
InsetCollapsable::write(buf, os);
|
InsetCollapsable::write(buf, os);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ void InsetFloat::validate(LaTeXFeatures & features) const
|
|||||||
if (contains(placement(), "H")) {
|
if (contains(placement(), "H")) {
|
||||||
features.require("float");
|
features.require("float");
|
||||||
}
|
}
|
||||||
|
|
||||||
features.useFloat(floatType_);
|
features.useFloat(floatType_);
|
||||||
InsetCollapsable::validate(features);
|
InsetCollapsable::validate(features);
|
||||||
}
|
}
|
||||||
@ -224,18 +224,18 @@ int InsetFloat::latex(Buffer const * buf,
|
|||||||
&& buf_placement != def_placement) {
|
&& buf_placement != def_placement) {
|
||||||
placement = buf_placement;
|
placement = buf_placement;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "\\begin{" << tmptype << "}";
|
os << "\\begin{" << tmptype << "}";
|
||||||
// We only output placement if different from the def_placement.
|
// We only output placement if different from the def_placement.
|
||||||
if (!placement.empty()) {
|
if (!placement.empty()) {
|
||||||
os << "[" << placement << "]";
|
os << "[" << placement << "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "%\n";
|
os << "%\n";
|
||||||
|
|
||||||
int const i = inset.latex(buf, os, fragile, fp);
|
int const i = inset.latex(buf, os, fragile, fp);
|
||||||
os << "\\end{" << tmptype << "}%\n";
|
os << "\\end{" << tmptype << "}%\n";
|
||||||
|
|
||||||
return i + 2;
|
return i + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,13 +265,13 @@ bool InsetFloat::insetAllowed(Inset::Code code) const
|
|||||||
bool InsetFloat::showInsetDialog(BufferView * bv) const
|
bool InsetFloat::showInsetDialog(BufferView * bv) const
|
||||||
{
|
{
|
||||||
if (!inset.showInsetDialog(bv)) {
|
if (!inset.showInsetDialog(bv)) {
|
||||||
bv->owner()->getDialogs()->showFloat(const_cast<InsetFloat *>(this));
|
bv->owner()->getDialogs()->showFloat(const_cast<InsetFloat *>(this));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const & InsetFloat::type() const
|
string const & InsetFloat::type() const
|
||||||
{
|
{
|
||||||
return floatType_;
|
return floatType_;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
@ -22,7 +22,7 @@
|
|||||||
class Painter;
|
class Painter;
|
||||||
|
|
||||||
/** The float inset
|
/** The float inset
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class InsetFloat : public InsetCollapsable {
|
class InsetFloat : public InsetCollapsable {
|
||||||
public:
|
public:
|
||||||
|
@ -23,7 +23,7 @@ InsetFloatList::InsetFloatList()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetFloatList::InsetFloatList(string const & type)
|
InsetFloatList::InsetFloatList(string const & type)
|
||||||
: InsetCommand(InsetCommandParams())
|
: InsetCommand(InsetCommandParams())
|
||||||
{
|
{
|
||||||
@ -31,7 +31,7 @@ InsetFloatList::InsetFloatList(string const & type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetFloatList::getScreenLabel(Buffer const *) const
|
string const InsetFloatList::getScreenLabel(Buffer const *) const
|
||||||
{
|
{
|
||||||
string const guiName = floatList[getCmdName()]->second.name();
|
string const guiName = floatList[getCmdName()]->second.name();
|
||||||
if (!guiName.empty()) {
|
if (!guiName.empty()) {
|
||||||
@ -54,7 +54,7 @@ void InsetFloatList::write(Buffer const *, ostream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetFloatList::read(Buffer const *, LyXLex & lex)
|
void InsetFloatList::read(Buffer const *, LyXLex & lex)
|
||||||
{
|
{
|
||||||
string token;
|
string token;
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Word Processor
|
* LyX, The Document Word Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1996-2001 The LyX Team.
|
* Copyright 1996-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef INSET_FLOATLIST_H
|
#ifndef INSET_FLOATLIST_H
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
*
|
*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
@ -59,9 +59,9 @@ int InsetFoot::latex(Buffer const * buf,
|
|||||||
ostream & os, bool fragile, bool fp) const
|
ostream & os, bool fragile, bool fp) const
|
||||||
{
|
{
|
||||||
os << "%\n\\footnote{";
|
os << "%\n\\footnote{";
|
||||||
|
|
||||||
int const i = inset.latex(buf, os, fragile, fp);
|
int const i = inset.latex(buf, os, fragile, fp);
|
||||||
os << "%\n}";
|
os << "%\n}";
|
||||||
|
|
||||||
return i + 2;
|
return i + 2;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
@ -22,7 +22,7 @@
|
|||||||
#include "insetfootlike.h"
|
#include "insetfootlike.h"
|
||||||
|
|
||||||
/** The footnote inset
|
/** The footnote inset
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class InsetFoot : public InsetFootlike {
|
class InsetFoot : public InsetFootlike {
|
||||||
public:
|
public:
|
||||||
@ -41,6 +41,3 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2000-2001 The LyX Team.
|
* Copyright 2000-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
@ -46,7 +46,7 @@ InsetFootlike::InsetFootlike(InsetFootlike const & in, bool same_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetFootlike::write(Buffer const * buf, ostream & os) const
|
void InsetFootlike::write(Buffer const * buf, ostream & os) const
|
||||||
{
|
{
|
||||||
os << getInsetName() << "\n";
|
os << getInsetName() << "\n";
|
||||||
InsetCollapsable::write(buf, os);
|
InsetCollapsable::write(buf, os);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
@ -23,7 +23,7 @@
|
|||||||
// To have this class is probably a bit overkill... (Lgb)
|
// To have this class is probably a bit overkill... (Lgb)
|
||||||
|
|
||||||
/** The footnote inset
|
/** The footnote inset
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class InsetFootlike : public InsetCollapsable {
|
class InsetFootlike : public InsetCollapsable {
|
||||||
public:
|
public:
|
||||||
@ -38,8 +38,3 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995-2002 the LyX Team.
|
* Copyright 1995-2002 the LyX Team.
|
||||||
*
|
*
|
||||||
* \author Baruch Even
|
* \author Baruch Even
|
||||||
* \author Herbert Voss <voss@lyx.org>
|
* \author Herbert Voss <voss@lyx.org>
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Known BUGS:
|
Known BUGS:
|
||||||
|
|
||||||
* If the image is from the clipart, and the document is moved to another
|
* If the image is from the clipart, and the document is moved to another
|
||||||
directory, the user is screwed. Need a way to handle it.
|
directory, the user is screwed. Need a way to handle it.
|
||||||
This amounts to a problem of when to use relative or absolute file paths
|
This amounts to a problem of when to use relative or absolute file paths
|
||||||
We should probably use what the user asks to use... but when he chooses
|
We should probably use what the user asks to use... but when he chooses
|
||||||
by the file dialog we normally get an absolute path and this may not be
|
by the file dialog we normally get an absolute path and this may not be
|
||||||
what the user meant.
|
what the user meant.
|
||||||
|
|
||||||
Note that browseRelFile in helper_funcs.* provides a file name
|
Note that browseRelFile in helper_funcs.* provides a file name
|
||||||
which is relative if it is at reference path (here puffer path)
|
which is relative if it is at reference path (here puffer path)
|
||||||
level or below, and an absolute path if the file name is not a
|
level or below, and an absolute path if the file name is not a
|
||||||
`natural' relative file name. In any case,
|
`natural' relative file name. In any case,
|
||||||
MakeAbsPath(filename, buf->filePath())
|
MakeAbsPath(filename, buf->filePath())
|
||||||
is guaranteed to provide the correct absolute path. This is what is
|
is guaranteed to provide the correct absolute path. This is what is
|
||||||
done know for include insets. Feel free to ask me -- JMarc
|
done know for include insets. Feel free to ask me -- JMarc
|
||||||
14/01/2002
|
14/01/2002
|
||||||
|
|
||||||
TODO Before initial production release:
|
TODO Before initial production release:
|
||||||
|
|
||||||
* What advanced features the users want to do?
|
* What advanced features the users want to do?
|
||||||
Implement them in a non latex dependent way, but a logical way.
|
Implement them in a non latex dependent way, but a logical way.
|
||||||
LyX should translate it to latex or any other fitting format.
|
LyX should translate it to latex or any other fitting format.
|
||||||
@ -53,27 +53,27 @@ TODO Before initial production release:
|
|||||||
* and when reading one should change the version check and the error message.
|
* and when reading one should change the version check and the error message.
|
||||||
* The filename is kept in the lyx file in a relative way, so as to allow
|
* The filename is kept in the lyx file in a relative way, so as to allow
|
||||||
* moving the document file and its images with no problem.
|
* moving the document file and its images with no problem.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Conversions:
|
* Conversions:
|
||||||
* Postscript output means EPS figures.
|
* Postscript output means EPS figures.
|
||||||
*
|
*
|
||||||
* PDF output is best done with PDF figures if it's a direct conversion
|
* PDF output is best done with PDF figures if it's a direct conversion
|
||||||
* or PNG figures otherwise.
|
* or PNG figures otherwise.
|
||||||
* Image format
|
* Image format
|
||||||
* from to
|
* from to
|
||||||
* EPS epstopdf
|
* EPS epstopdf
|
||||||
* PS ps2pdf
|
* PS ps2pdf
|
||||||
* JPG/PNG direct
|
* JPG/PNG direct
|
||||||
* PDF direct
|
* PDF direct
|
||||||
* others PNG
|
* others PNG
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "insets/insetgraphics.h"
|
#include "insets/insetgraphics.h"
|
||||||
#include "insets/insetgraphicsParams.h"
|
#include "insets/insetgraphicsParams.h"
|
||||||
@ -120,7 +120,7 @@ string const RemoveExtension(string const & filename)
|
|||||||
{
|
{
|
||||||
return ChangeExtension(filename, string());
|
return ChangeExtension(filename, string());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ string const unique_id()
|
|||||||
InsetGraphics::InsetGraphics()
|
InsetGraphics::InsetGraphics()
|
||||||
: graphic_label(unique_id()),
|
: graphic_label(unique_id()),
|
||||||
cached_status_(grfx::ErrorUnknown), cache_filled_(false), old_asc(0)
|
cached_status_(grfx::ErrorUnknown), cache_filled_(false), old_asc(0)
|
||||||
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ bool InsetGraphics::drawImage() const
|
|||||||
return pixmap != 0;
|
return pixmap != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetGraphics::ascent(BufferView *, LyXFont const &) const
|
int InsetGraphics::ascent(BufferView *, LyXFont const &) const
|
||||||
{
|
{
|
||||||
old_asc = 50;
|
old_asc = 50;
|
||||||
@ -268,18 +268,18 @@ int InsetGraphics::width(BufferView *, LyXFont const & font) const
|
|||||||
int const msg_width = lyxfont::width(msg, msgFont);
|
int const msg_width = lyxfont::width(msg, msgFont);
|
||||||
font_width = std::max(font_width, msg_width);
|
font_width = std::max(font_width, msg_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::max(50, font_width + 15);
|
return std::max(50, font_width + 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
||||||
int baseline, float & x, bool) const
|
int baseline, float & x, bool) const
|
||||||
{
|
{
|
||||||
int oasc = old_asc;
|
int oasc = old_asc;
|
||||||
grfx::ImageStatus old_status_ = cached_status_;
|
grfx::ImageStatus old_status_ = cached_status_;
|
||||||
|
|
||||||
int ldescent = descent(bv, font);
|
int ldescent = descent(bv, font);
|
||||||
int lascent = ascent(bv, font);
|
int lascent = ascent(bv, font);
|
||||||
int lwidth = width(bv, font);
|
int lwidth = width(bv, font);
|
||||||
@ -307,18 +307,18 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
|||||||
// This will draw the graphics. If the graphics has not been loaded yet,
|
// This will draw the graphics. If the graphics has not been loaded yet,
|
||||||
// we draw just a rectangle.
|
// we draw just a rectangle.
|
||||||
Painter & paint = bv->painter();
|
Painter & paint = bv->painter();
|
||||||
|
|
||||||
if (drawImage()) {
|
if (drawImage()) {
|
||||||
// lyxerr << "IG(" << this << "): " << old_x << endl;
|
// lyxerr << "IG(" << this << "): " << old_x << endl;
|
||||||
paint.image(old_x + 2, baseline - lascent,
|
paint.image(old_x + 2, baseline - lascent,
|
||||||
lwidth - 4, lascent + ldescent,
|
lwidth - 4, lascent + ldescent,
|
||||||
*cached_image_.get());
|
*cached_image_.get());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
paint.rectangle(old_x + 2, baseline - lascent,
|
paint.rectangle(old_x + 2, baseline - lascent,
|
||||||
lwidth - 4,
|
lwidth - 4,
|
||||||
lascent + ldescent);
|
lascent + ldescent);
|
||||||
|
|
||||||
// Print the file name.
|
// Print the file name.
|
||||||
LyXFont msgFont(font);
|
LyXFont msgFont(font);
|
||||||
@ -326,7 +326,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
|||||||
string const justname = OnlyFilename (params().filename);
|
string const justname = OnlyFilename (params().filename);
|
||||||
if (!justname.empty()) {
|
if (!justname.empty()) {
|
||||||
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
|
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
|
||||||
paint.text(old_x + 8,
|
paint.text(old_x + 8,
|
||||||
baseline - lyxfont::maxAscent(msgFont) - 4,
|
baseline - lyxfont::maxAscent(msgFont) - 4,
|
||||||
justname, msgFont);
|
justname, msgFont);
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
|||||||
if (old_status_ != grfx::ErrorUnknown && old_status_ != cached_status_) {
|
if (old_status_ != grfx::ErrorUnknown && old_status_ != cached_status_) {
|
||||||
bv->getLyXText()->status(bv, LyXText::CHANGED_IN_DRAW);
|
bv->getLyXText()->status(bv, LyXText::CHANGED_IN_DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the cache, ready for the next draw request
|
// Reset the cache, ready for the next draw request
|
||||||
cached_status_ = grfx::ErrorUnknown;
|
cached_status_ = grfx::ErrorUnknown;
|
||||||
cached_image_.reset(0);
|
cached_image_.reset(0);
|
||||||
@ -409,7 +409,7 @@ void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex)
|
|||||||
lex.next();
|
lex.next();
|
||||||
|
|
||||||
string const token = lex.getString();
|
string const token = lex.getString();
|
||||||
lyxerr[Debug::GRAPHICS] << "Token: '" << token << '\''
|
lyxerr[Debug::GRAPHICS] << "Token: '" << token << '\''
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
if (token.empty()) {
|
if (token.empty()) {
|
||||||
@ -429,7 +429,7 @@ void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (! params_.Read(buf, lex, token))
|
if (! params_.Read(buf, lex, token))
|
||||||
lyxerr << "Unknown token, " << token << ", skipping."
|
lyxerr << "Unknown token, " << token << ", skipping."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,12 +441,12 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
|
|||||||
std::vector<string> const oldUnits =
|
std::vector<string> const oldUnits =
|
||||||
getVectorFromString("pt,cm,in,p%,c%");
|
getVectorFromString("pt,cm,in,p%,c%");
|
||||||
bool finished = false;
|
bool finished = false;
|
||||||
// set the display default
|
// set the display default
|
||||||
if (lyxrc.display_graphics == "mono")
|
if (lyxrc.display_graphics == "mono")
|
||||||
params_.display = InsetGraphicsParams::MONOCHROME;
|
params_.display = InsetGraphicsParams::MONOCHROME;
|
||||||
else if (lyxrc.display_graphics == "gray")
|
else if (lyxrc.display_graphics == "gray")
|
||||||
params_.display = InsetGraphicsParams::GRAYSCALE;
|
params_.display = InsetGraphicsParams::GRAYSCALE;
|
||||||
else if (lyxrc.display_graphics == "color")
|
else if (lyxrc.display_graphics == "color")
|
||||||
params_.display = InsetGraphicsParams::COLOR;
|
params_.display = InsetGraphicsParams::COLOR;
|
||||||
else
|
else
|
||||||
params_.display = InsetGraphicsParams::NONE;
|
params_.display = InsetGraphicsParams::NONE;
|
||||||
@ -455,7 +455,7 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
|
|||||||
|
|
||||||
string const token = lex.getString();
|
string const token = lex.getString();
|
||||||
lyxerr[Debug::GRAPHICS] << "Token: " << token << endl;
|
lyxerr[Debug::GRAPHICS] << "Token: " << token << endl;
|
||||||
|
|
||||||
if (token.empty())
|
if (token.empty())
|
||||||
continue;
|
continue;
|
||||||
else if (token == "\\end_inset") {
|
else if (token == "\\end_inset") {
|
||||||
@ -488,11 +488,11 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
|
|||||||
} else if (token == "flags") {
|
} else if (token == "flags") {
|
||||||
if (lex.next())
|
if (lex.next())
|
||||||
switch (lex.getInteger()) {
|
switch (lex.getInteger()) {
|
||||||
case 1: params_.display = InsetGraphicsParams::MONOCHROME;
|
case 1: params_.display = InsetGraphicsParams::MONOCHROME;
|
||||||
break;
|
break;
|
||||||
case 2: params_.display = InsetGraphicsParams::GRAYSCALE;
|
case 2: params_.display = InsetGraphicsParams::GRAYSCALE;
|
||||||
break;
|
break;
|
||||||
case 3: params_.display = InsetGraphicsParams::COLOR;
|
case 3: params_.display = InsetGraphicsParams::COLOR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (token == "subfigure") {
|
} else if (token == "subfigure") {
|
||||||
@ -571,7 +571,7 @@ string findTargetFormat(string const & suffix)
|
|||||||
{
|
{
|
||||||
// lyxrc.pdf_mode means:
|
// lyxrc.pdf_mode means:
|
||||||
// Are we creating a PDF or a PS file?
|
// Are we creating a PDF or a PS file?
|
||||||
// (Should actually mean, are we using latex or pdflatex).
|
// (Should actually mean, are we using latex or pdflatex).
|
||||||
lyxerr[Debug::GRAPHICS] << "decideOutput: lyxrc.pdf_mode = "
|
lyxerr[Debug::GRAPHICS] << "decideOutput: lyxrc.pdf_mode = "
|
||||||
<< lyxrc.pdf_mode << std::endl;
|
<< lyxrc.pdf_mode << std::endl;
|
||||||
if (lyxrc.pdf_mode) {
|
if (lyxrc.pdf_mode) {
|
||||||
@ -612,7 +612,7 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
|
|||||||
bool const zipped = zippedFile(filename_);
|
bool const zipped = zippedFile(filename_);
|
||||||
|
|
||||||
if ((zipped && params().noUnzip) || buf->niceFile) {
|
if ((zipped && params().noUnzip) || buf->niceFile) {
|
||||||
lyxerr[Debug::GRAPHICS] << "don't unzip file or export latex"
|
lyxerr[Debug::GRAPHICS] << "don't unzip file or export latex"
|
||||||
<< filename_ << endl;
|
<< filename_ << endl;
|
||||||
return filename_;
|
return filename_;
|
||||||
}
|
}
|
||||||
@ -676,9 +676,9 @@ int InsetGraphics::latex(Buffer const *buf, ostream & os,
|
|||||||
// Return how many newlines we issued.
|
// Return how many newlines we issued.
|
||||||
int const newlines =
|
int const newlines =
|
||||||
int(lyx::count(latex_str.begin(), latex_str.end(),'\n') + 1);
|
int(lyx::count(latex_str.begin(), latex_str.end(),'\n') + 1);
|
||||||
|
|
||||||
// lyxerr << "includegraphics: " << newlines << " lines of text"
|
// lyxerr << "includegraphics: " << newlines << " lines of text"
|
||||||
// << endl;
|
// << endl;
|
||||||
return newlines;
|
return newlines;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,8 +707,8 @@ int InsetGraphics::linuxdoc(Buffer const *, ostream &) const
|
|||||||
// See also the docbook guide at http://www.docbook.org/
|
// See also the docbook guide at http://www.docbook.org/
|
||||||
int InsetGraphics::docbook(Buffer const *, ostream & os) const
|
int InsetGraphics::docbook(Buffer const *, ostream & os) const
|
||||||
{
|
{
|
||||||
// In DocBook v5.0, the graphic tag will be eliminated from DocBook, will
|
// In DocBook v5.0, the graphic tag will be eliminated from DocBook, will
|
||||||
// need to switch to MediaObject. However, for now this is sufficient and
|
// need to switch to MediaObject. However, for now this is sufficient and
|
||||||
// easier to use.
|
// easier to use.
|
||||||
os << "<graphic fileref=\"&" << graphic_label << ";\">";
|
os << "<graphic fileref=\"&" << graphic_label << ";\">";
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 the LyX Team.
|
* Copyright 1995-2001 the LyX Team.
|
||||||
*
|
*
|
||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "graphics/GraphicsTypes.h"
|
#include "graphics/GraphicsTypes.h"
|
||||||
#include "insets/inset.h"
|
#include "insets/inset.h"
|
||||||
@ -61,7 +61,7 @@ public:
|
|||||||
fragile commands by adding a #\protect# before.
|
fragile commands by adding a #\protect# before.
|
||||||
*/
|
*/
|
||||||
int latex(Buffer const *, std::ostream &,
|
int latex(Buffer const *, std::ostream &,
|
||||||
bool fragile, bool free_spc) const;
|
bool fragile, bool free_spc) const;
|
||||||
///
|
///
|
||||||
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
||||||
///
|
///
|
||||||
@ -103,7 +103,7 @@ private:
|
|||||||
void readInsetGraphics(Buffer const * buf, LyXLex & lex);
|
void readInsetGraphics(Buffer const * buf, LyXLex & lex);
|
||||||
/// Read the FigInset file format
|
/// Read the FigInset file format
|
||||||
void readFigInset(Buffer const * buf, LyXLex & lex);
|
void readFigInset(Buffer const * buf, LyXLex & lex);
|
||||||
|
|
||||||
/// Update the inset after parameter change.
|
/// Update the inset after parameter change.
|
||||||
void updateInset() const;
|
void updateInset() const;
|
||||||
/// Get the status message, depends on the image loading status.
|
/// Get the status message, depends on the image loading status.
|
||||||
@ -129,4 +129,4 @@ private:
|
|||||||
mutable int old_asc;
|
mutable int old_asc;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* =================================================
|
* =================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
* Copyright 1995 Matthias Ettrich.
|
* Copyright 1995 Matthias Ettrich.
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
@ -10,11 +10,11 @@
|
|||||||
*
|
*
|
||||||
* ================================================= */
|
* ================================================= */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "insetgraphicsParams.h"
|
#include "insetgraphicsParams.h"
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ displayTranslator(InsetGraphicsParams::DEFAULT, "default");
|
|||||||
// it is obselete until 1.3
|
// it is obselete until 1.3
|
||||||
LyXLength convertResizeValue(string const token, LyXLex & lex) {
|
LyXLength convertResizeValue(string const token, LyXLex & lex) {
|
||||||
lex.next();
|
lex.next();
|
||||||
string value = lex.getString(); // "width" or "height"
|
string value = lex.getString(); // "width" or "height"
|
||||||
lex.next(); // anyway not interesting
|
lex.next(); // anyway not interesting
|
||||||
value = lex.getString();
|
value = lex.getString();
|
||||||
if (token == "default")
|
if (token == "default")
|
||||||
@ -114,7 +114,7 @@ void InsetGraphicsParams::init()
|
|||||||
size_type = DEFAULT_SIZE; // do nothing
|
size_type = DEFAULT_SIZE; // do nothing
|
||||||
lyxsize_type = DEFAULT_SIZE; // do nothing
|
lyxsize_type = DEFAULT_SIZE; // do nothing
|
||||||
keepAspectRatio = false; // only for latex
|
keepAspectRatio = false; // only for latex
|
||||||
rotate = false; // Rotating
|
rotate = false; // Rotating
|
||||||
rotateOrigin = "center"; // Origin
|
rotateOrigin = "center"; // Origin
|
||||||
rotateAngle = 0.0; // in degrees
|
rotateAngle = 0.0; // in degrees
|
||||||
special = string(); // userdefined stuff
|
special = string(); // userdefined stuff
|
||||||
@ -146,29 +146,29 @@ void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(InsetGraphicsParams const & left,
|
bool operator==(InsetGraphicsParams const & left,
|
||||||
InsetGraphicsParams const & right)
|
InsetGraphicsParams const & right)
|
||||||
{
|
{
|
||||||
if (left.filename == right.filename &&
|
if (left.filename == right.filename &&
|
||||||
left.bb == right.bb &&
|
left.bb == right.bb &&
|
||||||
left.draft == right.draft &&
|
left.draft == right.draft &&
|
||||||
left.clip == right.clip &&
|
left.clip == right.clip &&
|
||||||
left.display == right.display &&
|
left.display == right.display &&
|
||||||
left.subcaption == right.subcaption &&
|
left.subcaption == right.subcaption &&
|
||||||
left.noUnzip == right.noUnzip &&
|
left.noUnzip == right.noUnzip &&
|
||||||
left.subcaptionText == right.subcaptionText &&
|
left.subcaptionText == right.subcaptionText &&
|
||||||
left.keepAspectRatio == right.keepAspectRatio &&
|
left.keepAspectRatio == right.keepAspectRatio &&
|
||||||
left.width == right.width &&
|
left.width == right.width &&
|
||||||
left.height == right.height &&
|
left.height == right.height &&
|
||||||
left.scale == right.scale &&
|
left.scale == right.scale &&
|
||||||
left.size_type == right.size_type &&
|
left.size_type == right.size_type &&
|
||||||
left.lyxsize_type == right.lyxsize_type &&
|
left.lyxsize_type == right.lyxsize_type &&
|
||||||
left.lyxwidth == right.lyxwidth &&
|
left.lyxwidth == right.lyxwidth &&
|
||||||
left.lyxheight == right.lyxheight &&
|
left.lyxheight == right.lyxheight &&
|
||||||
left.lyxscale == right.lyxscale &&
|
left.lyxscale == right.lyxscale &&
|
||||||
left.rotate == right.rotate &&
|
left.rotate == right.rotate &&
|
||||||
left.rotateOrigin == right.rotateOrigin &&
|
left.rotateOrigin == right.rotateOrigin &&
|
||||||
lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
|
lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
|
||||||
left.special == right.special)
|
left.special == right.special)
|
||||||
)
|
)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -176,9 +176,9 @@ bool operator==(InsetGraphicsParams const & left,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(InsetGraphicsParams const & left,
|
bool operator!=(InsetGraphicsParams const & left,
|
||||||
InsetGraphicsParams const & right)
|
InsetGraphicsParams const & right)
|
||||||
{
|
{
|
||||||
return !(left == right);
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const
|
|||||||
|
|
||||||
|
|
||||||
bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
|
bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
|
||||||
string const& token)
|
string const& token)
|
||||||
{
|
{
|
||||||
if (token == "filename") {
|
if (token == "filename") {
|
||||||
lex.next();
|
lex.next();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* =================================================
|
* =================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
* Copyright 1995 Matthias Ettrich.
|
* Copyright 1995 Matthias Ettrich.
|
||||||
* Copyright 1995-2002 The LyX Team.
|
* Copyright 1995-2002 The LyX Team.
|
||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ struct InsetGraphicsParams
|
|||||||
string rotateOrigin;
|
string rotateOrigin;
|
||||||
/// Rotation angle.
|
/// Rotation angle.
|
||||||
float rotateAngle;
|
float rotateAngle;
|
||||||
/// clip image
|
/// clip image
|
||||||
bool clip;
|
bool clip;
|
||||||
/// draft mode
|
/// draft mode
|
||||||
bool draft;
|
bool draft;
|
||||||
@ -59,7 +59,7 @@ struct InsetGraphicsParams
|
|||||||
bool noUnzip;
|
bool noUnzip;
|
||||||
/// The bounding box with "xLB yLB yRT yRT ", divided by a space!
|
/// The bounding box with "xLB yLB yRT yRT ", divided by a space!
|
||||||
string bb;
|
string bb;
|
||||||
/// Type of rescaling
|
/// Type of rescaling
|
||||||
sizeType size_type;
|
sizeType size_type;
|
||||||
/// three possible values for rescaling (latex)
|
/// three possible values for rescaling (latex)
|
||||||
LyXLength width;
|
LyXLength width;
|
||||||
@ -104,4 +104,4 @@ bool operator==(InsetGraphicsParams const &, InsetGraphicsParams const &);
|
|||||||
///
|
///
|
||||||
bool operator!=(InsetGraphicsParams const &, InsetGraphicsParams const &);
|
bool operator!=(InsetGraphicsParams const &, InsetGraphicsParams const &);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,7 +77,7 @@ bool InsetInclude::Params::operator==(Params const & o) const
|
|||||||
if (cparams == o.cparams && flag == o.flag &&
|
if (cparams == o.cparams && flag == o.flag &&
|
||||||
noload == o.noload && masterFilename_ == o.masterFilename_)
|
noload == o.noload && masterFilename_ == o.masterFilename_)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,22 +94,22 @@ void InsetInclude::set(Params const & p)
|
|||||||
|
|
||||||
// Just to be safe...
|
// Just to be safe...
|
||||||
string command;
|
string command;
|
||||||
|
|
||||||
switch (params_.flag) {
|
switch (params_.flag) {
|
||||||
case INCLUDE:
|
case INCLUDE:
|
||||||
command="include";
|
command="include";
|
||||||
break;
|
break;
|
||||||
case VERB:
|
case VERB:
|
||||||
command="verbatiminput";
|
command="verbatiminput";
|
||||||
break;
|
break;
|
||||||
case INPUT:
|
case INPUT:
|
||||||
command="input";
|
command="input";
|
||||||
break;
|
break;
|
||||||
case VERBAST:
|
case VERBAST:
|
||||||
command="verbatiminput*";
|
command="verbatiminput*";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
params_.cparams.setCmdName(command);
|
params_.cparams.setCmdName(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ void InsetInclude::write(Buffer const *, ostream & os) const
|
|||||||
void InsetInclude::read(Buffer const *, LyXLex & lex)
|
void InsetInclude::read(Buffer const *, LyXLex & lex)
|
||||||
{
|
{
|
||||||
params_.cparams.read(lex);
|
params_.cparams.read(lex);
|
||||||
|
|
||||||
if (params_.cparams.getCmdName() == "include")
|
if (params_.cparams.getCmdName() == "include")
|
||||||
params_.flag = INCLUDE;
|
params_.flag = INCLUDE;
|
||||||
else if (params_.cparams.getCmdName() == "input")
|
else if (params_.cparams.getCmdName() == "input")
|
||||||
@ -176,7 +176,7 @@ string const InsetInclude::getScreenLabel(Buffer const *) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
temp += ": ";
|
temp += ": ";
|
||||||
|
|
||||||
if (params_.cparams.getContents().empty())
|
if (params_.cparams.getContents().empty())
|
||||||
temp += "???";
|
temp += "???";
|
||||||
else
|
else
|
||||||
@ -191,7 +191,7 @@ string const InsetInclude::getRelFileBaseName() const
|
|||||||
return OnlyFilename(ChangeExtension(params_.cparams.getContents(), string()));
|
return OnlyFilename(ChangeExtension(params_.cparams.getContents(), string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetInclude::getFileName() const
|
string const InsetInclude::getFileName() const
|
||||||
{
|
{
|
||||||
return MakeAbsPath(params_.cparams.getContents(),
|
return MakeAbsPath(params_.cparams.getContents(),
|
||||||
@ -212,15 +212,15 @@ bool InsetInclude::loadIfNeeded() const
|
|||||||
|
|
||||||
if (!IsLyXFilename(getFileName()))
|
if (!IsLyXFilename(getFileName()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (bufferlist.exists(getFileName()))
|
if (bufferlist.exists(getFileName()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// the readonly flag can/will be wrong, not anymore I think.
|
// the readonly flag can/will be wrong, not anymore I think.
|
||||||
FileInfo finfo(getFileName());
|
FileInfo finfo(getFileName());
|
||||||
if (!finfo.isOK())
|
if (!finfo.isOK())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return bufferlist.readFile(getFileName(), !finfo.writable()) != 0;
|
return bufferlist.readFile(getFileName(), !finfo.writable()) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,11 +229,11 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os,
|
|||||||
bool /*fragile*/, bool /*fs*/) const
|
bool /*fragile*/, bool /*fs*/) const
|
||||||
{
|
{
|
||||||
string incfile(params_.cparams.getContents());
|
string incfile(params_.cparams.getContents());
|
||||||
|
|
||||||
// Do nothing if no file name has been specified
|
// Do nothing if no file name has been specified
|
||||||
if (incfile.empty())
|
if (incfile.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (loadIfNeeded()) {
|
if (loadIfNeeded()) {
|
||||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os,
|
|||||||
<< "'." << endl;
|
<< "'." << endl;
|
||||||
//return 0;
|
//return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write it to a file (so far the complete file)
|
// write it to a file (so far the complete file)
|
||||||
string writefile = ChangeExtension(getFileName(), ".tex");
|
string writefile = ChangeExtension(getFileName(), ".tex");
|
||||||
|
|
||||||
@ -264,9 +264,9 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os,
|
|||||||
writefile = ChangeExtension(writefile, ".tex");
|
writefile = ChangeExtension(writefile, ".tex");
|
||||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||||
|
|
||||||
tmp->markDepClean(buffer->tmppath);
|
tmp->markDepClean(buffer->tmppath);
|
||||||
|
|
||||||
tmp->makeLaTeXFile(writefile,
|
tmp->makeLaTeXFile(writefile,
|
||||||
OnlyPath(getMasterFilename()),
|
OnlyPath(getMasterFilename()),
|
||||||
buffer->niceFile, true);
|
buffer->niceFile, true);
|
||||||
@ -306,11 +306,11 @@ int InsetInclude::ascii(Buffer const *, ostream & os, int) const
|
|||||||
int InsetInclude::linuxdoc(Buffer const * buffer, ostream & os) const
|
int InsetInclude::linuxdoc(Buffer const * buffer, ostream & os) const
|
||||||
{
|
{
|
||||||
string incfile(params_.cparams.getContents());
|
string incfile(params_.cparams.getContents());
|
||||||
|
|
||||||
// Do nothing if no file name has been specified
|
// Do nothing if no file name has been specified
|
||||||
if (incfile.empty())
|
if (incfile.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (loadIfNeeded()) {
|
if (loadIfNeeded()) {
|
||||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ int InsetInclude::linuxdoc(Buffer const * buffer, ostream & os) const
|
|||||||
|
|
||||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||||
|
|
||||||
tmp->makeLinuxDocFile(writefile, buffer->niceFile, true);
|
tmp->makeLinuxDocFile(writefile, buffer->niceFile, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ int InsetInclude::linuxdoc(Buffer const * buffer, ostream & os) const
|
|||||||
<< "]]>";
|
<< "]]>";
|
||||||
} else
|
} else
|
||||||
os << '&' << include_label << ';';
|
os << '&' << include_label << ';';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ int InsetInclude::docbook(Buffer const * buffer, ostream & os) const
|
|||||||
// Do nothing if no file name has been specified
|
// Do nothing if no file name has been specified
|
||||||
if (incfile.empty())
|
if (incfile.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (loadIfNeeded()) {
|
if (loadIfNeeded()) {
|
||||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ int InsetInclude::docbook(Buffer const * buffer, ostream & os) const
|
|||||||
|
|
||||||
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
|
||||||
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
|
||||||
|
|
||||||
tmp->makeDocBookFile(writefile, buffer->niceFile, true);
|
tmp->makeDocBookFile(writefile, buffer->niceFile, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ int InsetInclude::docbook(Buffer const * buffer, ostream & os) const
|
|||||||
<< "\" format=\"linespecific\">";
|
<< "\" format=\"linespecific\">";
|
||||||
} else
|
} else
|
||||||
os << '&' << include_label << ';';
|
os << '&' << include_label << ';';
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,13 +435,13 @@ vector<string> const InsetInclude::getLabelList() const
|
|||||||
vector<pair<string,string> > const InsetInclude::getKeys() const
|
vector<pair<string,string> > const InsetInclude::getKeys() const
|
||||||
{
|
{
|
||||||
vector<pair<string,string> > keys;
|
vector<pair<string,string> > keys;
|
||||||
|
|
||||||
if (loadIfNeeded()) {
|
if (loadIfNeeded()) {
|
||||||
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||||
tmp->setParentName("");
|
tmp->setParentName("");
|
||||||
keys = tmp->getBibkeyList();
|
keys = tmp->getBibkeyList();
|
||||||
tmp->setParentName(getMasterFilename());
|
tmp->setParentName(getMasterFilename());
|
||||||
}
|
}
|
||||||
|
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1997 LyX Team (this file was created this year)
|
* Copyright 1997 LyX Team (this file was created this year)
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
@ -26,8 +26,8 @@ struct LaTeXFeatures;
|
|||||||
*/
|
*/
|
||||||
class InsetInclude: public InsetButton, boost::noncopyable {
|
class InsetInclude: public InsetButton, boost::noncopyable {
|
||||||
public:
|
public:
|
||||||
/// the type of inclusion
|
/// the type of inclusion
|
||||||
enum Flags {
|
enum Flags {
|
||||||
///
|
///
|
||||||
INCLUDE = 0,
|
INCLUDE = 0,
|
||||||
///
|
///
|
||||||
@ -91,7 +91,7 @@ public:
|
|||||||
void read(Buffer const *, LyXLex &);
|
void read(Buffer const *, LyXLex &);
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &,
|
int latex(Buffer const *, std::ostream &,
|
||||||
bool fragile, bool free_spc) const;
|
bool fragile, bool free_spc) const;
|
||||||
///
|
///
|
||||||
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
||||||
///
|
///
|
||||||
@ -100,36 +100,36 @@ public:
|
|||||||
int docbook(Buffer const *, std::ostream &) const;
|
int docbook(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
void validate(LaTeXFeatures &) const;
|
void validate(LaTeXFeatures &) const;
|
||||||
|
|
||||||
/** Input inserts anything inside a paragraph.
|
/** Input inserts anything inside a paragraph.
|
||||||
Display can give some visual feedback
|
Display can give some visual feedback
|
||||||
*/
|
*/
|
||||||
bool display() const;
|
bool display() const;
|
||||||
|
|
||||||
/// return the filename stub of the included file
|
/// return the filename stub of the included file
|
||||||
string const getRelFileBaseName() const;
|
string const getRelFileBaseName() const;
|
||||||
|
|
||||||
/// return true if the included file is not loaded
|
/// return true if the included file is not loaded
|
||||||
bool isIncludeOnly() const;
|
bool isIncludeOnly() const;
|
||||||
|
|
||||||
/// return true if the file is or got loaded.
|
/// return true if the file is or got loaded.
|
||||||
bool loadIfNeeded() const;
|
bool loadIfNeeded() const;
|
||||||
|
|
||||||
/// hide a dialog if about
|
/// hide a dialog if about
|
||||||
SigC::Signal0<void> hideDialog;
|
SigC::Signal0<void> hideDialog;
|
||||||
private:
|
private:
|
||||||
/// get the text displayed on the button
|
/// get the text displayed on the button
|
||||||
string const getScreenLabel(Buffer const *) const;
|
string const getScreenLabel(Buffer const *) const;
|
||||||
/// is this a verbatim include ?
|
/// is this a verbatim include ?
|
||||||
bool isVerbatim() const;
|
bool isVerbatim() const;
|
||||||
/// get the filename of the master buffer
|
/// get the filename of the master buffer
|
||||||
string const getMasterFilename() const;
|
string const getMasterFilename() const;
|
||||||
/// get the included file name
|
/// get the included file name
|
||||||
string const getFileName() const;
|
string const getFileName() const;
|
||||||
|
|
||||||
/// the parameters
|
/// the parameters
|
||||||
Params params_;
|
Params params_;
|
||||||
/// holds the entity name that defines the file location (SGML)
|
/// holds the entity name that defines the file location (SGML)
|
||||||
string const include_label;
|
string const include_label;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ int InsetIndex::docbook(Buffer const *, ostream & os) const
|
|||||||
|
|
||||||
Inset::Code InsetIndex::lyxCode() const
|
Inset::Code InsetIndex::lyxCode() const
|
||||||
{
|
{
|
||||||
return Inset::INDEX_CODE;
|
return Inset::INDEX_CODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -68,5 +68,5 @@ void InsetPrintIndex::validate(LaTeXFeatures & features) const
|
|||||||
|
|
||||||
Inset::Code InsetPrintIndex::lyxCode() const
|
Inset::Code InsetPrintIndex::lyxCode() const
|
||||||
{
|
{
|
||||||
return Inset::INDEX_PRINT_CODE;
|
return Inset::INDEX_PRINT_CODE;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1996-2001 the LyX Team.
|
* Copyright 1996-2001 the LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef INSET_INDEX_H
|
#ifndef INSET_INDEX_H
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
struct LaTeXFeatures;
|
struct LaTeXFeatures;
|
||||||
|
|
||||||
/** Used to insert index labels
|
/** Used to insert index labels
|
||||||
*/
|
*/
|
||||||
class InsetIndex : public InsetCommand {
|
class InsetIndex : public InsetCommand {
|
||||||
public:
|
public:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team
|
* Copyright 1995-2001 The LyX Team
|
||||||
*
|
*
|
||||||
@ -40,7 +40,7 @@ public:
|
|||||||
std::vector<string> const getLabelList() const;
|
std::vector<string> const getLabelList() const;
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &,
|
int latex(Buffer const *, std::ostream &,
|
||||||
bool fragile, bool free_spc) const;
|
bool fragile, bool free_spc) const;
|
||||||
///
|
///
|
||||||
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
||||||
///
|
///
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -43,9 +43,9 @@ InsetLatexAccent::InsetLatexAccent(string const & str)
|
|||||||
|
|
||||||
|
|
||||||
void InsetLatexAccent::checkContents()
|
void InsetLatexAccent::checkContents()
|
||||||
// check, if we know the modifier and can display it ok on screen
|
// check, if we know the modifier and can display it ok on screen
|
||||||
{
|
{
|
||||||
candisp = false;
|
candisp = false;
|
||||||
|
|
||||||
if (contents.empty() || contents.length() < 2) {
|
if (contents.empty() || contents.length() < 2) {
|
||||||
lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl;
|
lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl;
|
||||||
@ -90,80 +90,80 @@ void InsetLatexAccent::checkContents()
|
|||||||
contents = tmp;
|
contents = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (contents[0] != '\\') { // demand that first char is a '\\'
|
if (contents[0] != '\\') { // demand that first char is a '\\'
|
||||||
lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl;
|
lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lyxerr[Debug::KEY] << "Decode: " << contents << endl;
|
lyxerr[Debug::KEY] << "Decode: " << contents << endl;
|
||||||
|
|
||||||
remdot = false; plusasc = false; plusdesc = false;
|
remdot = false; plusasc = false; plusdesc = false;
|
||||||
|
|
||||||
switch (contents[1]) { // second char should be one of these
|
switch (contents[1]) { // second char should be one of these
|
||||||
case '\'': // acute
|
case '\'': // acute
|
||||||
modtype = ACUTE; // acute
|
modtype = ACUTE; // acute
|
||||||
plusasc = true; // at the top of character
|
plusasc = true; // at the top of character
|
||||||
break;
|
break;
|
||||||
case '`': // grave
|
case '`': // grave
|
||||||
modtype = GRAVE; // grave
|
modtype = GRAVE; // grave
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case '=': // macron
|
case '=': // macron
|
||||||
modtype = MACRON; // macron
|
modtype = MACRON; // macron
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case '~': // tilde
|
case '~': // tilde
|
||||||
modtype = TILDE; // tilde
|
modtype = TILDE; // tilde
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case 'b': // underbar
|
case 'b': // underbar
|
||||||
modtype = UNDERBAR; // underbar
|
modtype = UNDERBAR; // underbar
|
||||||
plusdesc = true; // at the bottom
|
plusdesc = true; // at the bottom
|
||||||
break;
|
break;
|
||||||
case 'c': // cedilla
|
case 'c': // cedilla
|
||||||
modtype = CEDILLA; // cedilla
|
modtype = CEDILLA; // cedilla
|
||||||
plusdesc = true; // at the bottom
|
plusdesc = true; // at the bottom
|
||||||
break;
|
break;
|
||||||
case 'd': // underdot
|
case 'd': // underdot
|
||||||
modtype = UNDERDOT; // underdot
|
modtype = UNDERDOT; // underdot
|
||||||
plusdesc = true; // at the bottom
|
plusdesc = true; // at the bottom
|
||||||
break;
|
break;
|
||||||
case 'r': // circle
|
case 'r': // circle
|
||||||
modtype = CIRCLE; // circle
|
modtype = CIRCLE; // circle
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case 't': // tie
|
case 't': // tie
|
||||||
modtype = TIE; // tie
|
modtype = TIE; // tie
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case 'u': // breve
|
case 'u': // breve
|
||||||
modtype = BREVE; // breve
|
modtype = BREVE; // breve
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case 'v': // caron
|
case 'v': // caron
|
||||||
modtype = CARON; // caron
|
modtype = CARON; // caron
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case 'q': // special caron
|
case 'q': // special caron
|
||||||
modtype = SPECIAL_CARON; // special caron
|
modtype = SPECIAL_CARON; // special caron
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case 'H': // hungarian umlaut
|
case 'H': // hungarian umlaut
|
||||||
modtype = HUNGARIAN_UMLAUT; // hungarian umlaut
|
modtype = HUNGARIAN_UMLAUT; // hungarian umlaut
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case '"': // umlaut
|
case '"': // umlaut
|
||||||
modtype = UMLAUT; // umlaut
|
modtype = UMLAUT; // umlaut
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case '.': // dot
|
case '.': // dot
|
||||||
modtype = DOT; // dot
|
modtype = DOT; // dot
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case '^': // circumflex
|
case '^': // circumflex
|
||||||
modtype = CIRCUMFLEX; // circumflex
|
modtype = CIRCUMFLEX; // circumflex
|
||||||
plusasc = true; // at the top
|
plusasc = true; // at the top
|
||||||
break;
|
break;
|
||||||
case 'k': // ogonek
|
case 'k': // ogonek
|
||||||
modtype = OGONEK; // ogonek
|
modtype = OGONEK; // ogonek
|
||||||
plusdesc = true;
|
plusdesc = true;
|
||||||
@ -178,19 +178,19 @@ void InsetLatexAccent::checkContents()
|
|||||||
plusasc = true; // at the top (not really needed)
|
plusasc = true; // at the top (not really needed)
|
||||||
remdot = true;
|
remdot = true;
|
||||||
break;
|
break;
|
||||||
case 'l': // lslash
|
case 'l': // lslash
|
||||||
modtype = lSLASH;
|
modtype = lSLASH;
|
||||||
plusasc = true; // at the top (not really needed)
|
plusasc = true; // at the top (not really needed)
|
||||||
break;
|
break;
|
||||||
case 'L': // lslash
|
case 'L': // lslash
|
||||||
modtype = LSLASH;
|
modtype = LSLASH;
|
||||||
plusasc = true; // at the top (not really needed)
|
plusasc = true; // at the top (not really needed)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
lyxerr[Debug::KEY] << "Default" << endl;
|
lyxerr[Debug::KEY] << "Default" << endl;
|
||||||
// unknow accent (or something else)
|
// unknow accent (or something else)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we demand that third char is a '{' (Lgb)
|
// we demand that third char is a '{' (Lgb)
|
||||||
if (contents[2] != '{') return;
|
if (contents[2] != '{') return;
|
||||||
@ -211,17 +211,17 @@ void InsetLatexAccent::checkContents()
|
|||||||
}
|
}
|
||||||
//ic = (modtype == DOT_LESS_J ? 'j' : 'i');
|
//ic = (modtype == DOT_LESS_J ? 'j' : 'i');
|
||||||
lyxerr[Debug::KEY] << "Contents: [" << contents << "]"
|
lyxerr[Debug::KEY] << "Contents: [" << contents << "]"
|
||||||
<< ", ic: " << ic
|
<< ", ic: " << ic
|
||||||
<< ", top: " << plusasc
|
<< ", top: " << plusasc
|
||||||
<< ", bot: " << plusdesc
|
<< ", bot: " << plusdesc
|
||||||
<< ", dot: " << remdot
|
<< ", dot: " << remdot
|
||||||
<< ", mod: " << modtype << endl;
|
<< ", mod: " << modtype << endl;
|
||||||
// Special case for space
|
// Special case for space
|
||||||
} else if (contents[3] == '}') {
|
} else if (contents[3] == '}') {
|
||||||
ic = ' ';
|
ic = ' ';
|
||||||
} else {
|
} else {
|
||||||
int i = 3;
|
int i = 3;
|
||||||
|
|
||||||
// now get the char
|
// now get the char
|
||||||
ic = contents[3]; // i will always be 3 here
|
ic = contents[3]; // i will always be 3 here
|
||||||
|
|
||||||
@ -244,20 +244,20 @@ void InsetLatexAccent::checkContents()
|
|||||||
contents= temp;
|
contents= temp;
|
||||||
++i;
|
++i;
|
||||||
remdot = true;
|
remdot = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// demand a '}' at the end
|
// demand a '}' at the end
|
||||||
if (contents[++i] != '}' && contents[++i]) return;
|
if (contents[++i] != '}' && contents[++i]) return;
|
||||||
|
|
||||||
// fine, the char is properly decoded now (hopefully)
|
// fine, the char is properly decoded now (hopefully)
|
||||||
lyxerr[Debug::KEY] << "Contents: [" << contents << "]"
|
lyxerr[Debug::KEY] << "Contents: [" << contents << "]"
|
||||||
<< ", ic: " << ic
|
<< ", ic: " << ic
|
||||||
<< ", top: " << plusasc
|
<< ", top: " << plusasc
|
||||||
<< ", bot: " << plusdesc
|
<< ", bot: " << plusdesc
|
||||||
<< ", dot: " << remdot
|
<< ", dot: " << remdot
|
||||||
<< ", mod: " << modtype << endl;
|
<< ", mod: " << modtype << endl;
|
||||||
}
|
}
|
||||||
candisp = true;
|
candisp = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ int InsetLatexAccent::ascent(BufferView *, LyXFont const & font) const
|
|||||||
max = lyxfont::ascent('a', font);
|
max = lyxfont::ascent('a', font);
|
||||||
else
|
else
|
||||||
max = lyxfont::ascent(ic, font);
|
max = lyxfont::ascent(ic, font);
|
||||||
if (plusasc)
|
if (plusasc)
|
||||||
max += (lyxfont::maxAscent(font) + 3) / 3;
|
max += (lyxfont::maxAscent(font) + 3) / 3;
|
||||||
} else
|
} else
|
||||||
max = lyxfont::maxAscent(font) + 4;
|
max = lyxfont::maxAscent(font) + 4;
|
||||||
@ -285,12 +285,12 @@ int InsetLatexAccent::descent(BufferView *, LyXFont const & font) const
|
|||||||
{
|
{
|
||||||
int max;
|
int max;
|
||||||
if (candisp) {
|
if (candisp) {
|
||||||
if (ic == ' ')
|
if (ic == ' ')
|
||||||
max = lyxfont::descent('a', font);
|
max = lyxfont::descent('a', font);
|
||||||
else
|
else
|
||||||
max = lyxfont::descent(ic, font);
|
max = lyxfont::descent(ic, font);
|
||||||
if (plusdesc)
|
if (plusdesc)
|
||||||
max += 3;
|
max += 3;
|
||||||
} else
|
} else
|
||||||
max = lyxfont::maxDescent(font) + 4;
|
max = lyxfont::maxDescent(font) + 4;
|
||||||
return max;
|
return max;
|
||||||
@ -301,8 +301,8 @@ int InsetLatexAccent::width(BufferView *, LyXFont const & font) const
|
|||||||
{
|
{
|
||||||
if (candisp)
|
if (candisp)
|
||||||
return lyxfont::width(ic, font);
|
return lyxfont::width(ic, font);
|
||||||
else
|
else
|
||||||
return lyxfont::width(contents, font) + 4;
|
return lyxfont::width(contents, font) + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -319,11 +319,11 @@ int InsetLatexAccent::rbearing(LyXFont const & font) const
|
|||||||
|
|
||||||
|
|
||||||
bool InsetLatexAccent::displayISO8859_9(BufferView * bv, LyXFont const & font,
|
bool InsetLatexAccent::displayISO8859_9(BufferView * bv, LyXFont const & font,
|
||||||
int baseline,
|
int baseline,
|
||||||
float & x) const
|
float & x) const
|
||||||
{
|
{
|
||||||
unsigned char tmpic = ic;
|
unsigned char tmpic = ic;
|
||||||
|
|
||||||
switch (modtype) {
|
switch (modtype) {
|
||||||
case CEDILLA:
|
case CEDILLA:
|
||||||
{
|
{
|
||||||
@ -346,7 +346,7 @@ bool InsetLatexAccent::displayISO8859_9(BufferView * bv, LyXFont const & font,
|
|||||||
if (ic == 'U') tmpic = 0xdc;
|
if (ic == 'U') tmpic = 0xdc;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DOT: if (ic == 'I') tmpic = 0xdd; break;
|
case DOT: if (ic == 'I') tmpic = 0xdd; break;
|
||||||
case DOT_LESS_I: tmpic = 0xfd; break;
|
case DOT_LESS_I: tmpic = 0xfd; break;
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
@ -367,10 +367,10 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
|
|||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
|
|
||||||
if (lyxrc.font_norm_type == LyXRC::ISO_8859_9)
|
if (lyxrc.font_norm_type == LyXRC::ISO_8859_9)
|
||||||
if (displayISO8859_9(bv, font0, baseline, x))
|
if (displayISO8859_9(bv, font0, baseline, x))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* draw it! */
|
/* draw it! */
|
||||||
// All the manually drawn accents in this function could use an
|
// All the manually drawn accents in this function could use an
|
||||||
// overhaul. Different ways of drawing (what metrics to use)
|
// overhaul. Different ways of drawing (what metrics to use)
|
||||||
// should also be considered.
|
// should also be considered.
|
||||||
@ -378,7 +378,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
|
|||||||
LyXFont font(font0);
|
LyXFont font(font0);
|
||||||
if (lyxrc.font_norm_type == LyXRC::ISO_10646_1)
|
if (lyxrc.font_norm_type == LyXRC::ISO_10646_1)
|
||||||
font.setLanguage(english_language);
|
font.setLanguage(english_language);
|
||||||
|
|
||||||
if (candisp) {
|
if (candisp) {
|
||||||
int asc = ascent(bv, font);
|
int asc = ascent(bv, font);
|
||||||
int desc = descent(bv, font);
|
int desc = descent(bv, font);
|
||||||
@ -429,7 +429,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
|
|||||||
// now the rest - draw within (x, y, x+wid, y+hg)
|
// now the rest - draw within (x, y, x+wid, y+hg)
|
||||||
switch (modtype) {
|
switch (modtype) {
|
||||||
case ACUTE: // acute 0xB4
|
case ACUTE: // acute 0xB4
|
||||||
{
|
{
|
||||||
pain.text(int(x2 - (lyxfont::rbearing(0xB4, font) - lyxfont::lbearing(0xB4, font)) / 2),
|
pain.text(int(x2 - (lyxfont::rbearing(0xB4, font) - lyxfont::lbearing(0xB4, font)) / 2),
|
||||||
baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB4, font) - (lyxfont::ascent(0xB4, font) + lyxfont::descent(0xB4, font)) / 2,
|
baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB4, font) - (lyxfont::ascent(0xB4, font) + lyxfont::descent(0xB4, font)) / 2,
|
||||||
char(0xB4), font);
|
char(0xB4), font);
|
||||||
@ -466,7 +466,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
|
|||||||
{
|
{
|
||||||
pain.text(int(x2 - (lyxfont::rbearing(0xB8, font) - lyxfont::lbearing(0xB8, font)) / 2), baseline,
|
pain.text(int(x2 - (lyxfont::rbearing(0xB8, font) - lyxfont::lbearing(0xB8, font)) / 2), baseline,
|
||||||
char(0xB8), font);
|
char(0xB8), font);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UNDERDOT: // underdot
|
case UNDERDOT: // underdot
|
||||||
@ -509,7 +509,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
|
|||||||
case CARON: // caron
|
case CARON: // caron
|
||||||
{
|
{
|
||||||
int xp[3], yp[3];
|
int xp[3], yp[3];
|
||||||
|
|
||||||
xp[0] = int(x2 - hg35); yp[0] = int(y + hg35);
|
xp[0] = int(x2 - hg35); yp[0] = int(y + hg35);
|
||||||
xp[1] = int(x2); yp[1] = int(y + hg);
|
xp[1] = int(x2); yp[1] = int(y + hg);
|
||||||
xp[2] = int(x2 + hg35); yp[2] = int(y + hg35);
|
xp[2] = int(x2 + hg35); yp[2] = int(y + hg35);
|
||||||
@ -525,10 +525,10 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
|
|||||||
int xp[3], yp[3];
|
int xp[3], yp[3];
|
||||||
xp[0] = int(x + wid);
|
xp[0] = int(x + wid);
|
||||||
yp[0] = int(y + hg35 + hg);
|
yp[0] = int(y + hg35 + hg);
|
||||||
|
|
||||||
xp[1] = int(x + wid + (hg35 / 2.0));
|
xp[1] = int(x + wid + (hg35 / 2.0));
|
||||||
yp[1] = int(y + hg + (hg35 / 2.0));
|
yp[1] = int(y + hg + (hg35 / 2.0));
|
||||||
|
|
||||||
xp[2] = int(x + wid + (hg35 / 2.0));
|
xp[2] = int(x + wid + (hg35 / 2.0));
|
||||||
yp[2] = y + int(hg);
|
yp[2] = y + int(hg);
|
||||||
|
|
||||||
@ -566,16 +566,16 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
|
|||||||
// this does probably not look like an ogonek, so
|
// this does probably not look like an ogonek, so
|
||||||
// it should certainly be refined
|
// it should certainly be refined
|
||||||
int xp[4], yp[4];
|
int xp[4], yp[4];
|
||||||
|
|
||||||
xp[0] = int(x2);
|
xp[0] = int(x2);
|
||||||
yp[0] = y;
|
yp[0] = y;
|
||||||
|
|
||||||
xp[1] = int(x2);
|
xp[1] = int(x2);
|
||||||
yp[1] = y + int(hg35);
|
yp[1] = y + int(hg35);
|
||||||
|
|
||||||
xp[2] = int(x2 - hg35);
|
xp[2] = int(x2 - hg35);
|
||||||
yp[2] = y + int(hg / 2.0);
|
yp[2] = y + int(hg / 2.0);
|
||||||
|
|
||||||
xp[3] = int(x2 + hg / 4.0);
|
xp[3] = int(x2 + hg / 4.0);
|
||||||
yp[3] = y + int(hg);
|
yp[3] = y + int(hg);
|
||||||
|
|
||||||
@ -586,15 +586,15 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
|
|||||||
case LSLASH:
|
case LSLASH:
|
||||||
{
|
{
|
||||||
int xp[2], yp[2];
|
int xp[2], yp[2];
|
||||||
|
|
||||||
xp[0] = int(x);
|
xp[0] = int(x);
|
||||||
yp[0] = y + int(3.0 * hg);
|
yp[0] = y + int(3.0 * hg);
|
||||||
|
|
||||||
xp[1] = int(x + float(wid) * 0.75);
|
xp[1] = int(x + float(wid) * 0.75);
|
||||||
yp[1] = y + int(hg);
|
yp[1] = y + int(hg);
|
||||||
|
|
||||||
pain.lines(xp, yp, 2);
|
pain.lines(xp, yp, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DOT_LESS_I: // dotless-i
|
case DOT_LESS_I: // dotless-i
|
||||||
case DOT_LESS_J: // dotless-j
|
case DOT_LESS_J: // dotless-j
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
@ -20,7 +20,7 @@
|
|||||||
#include "lyxlex.h"
|
#include "lyxlex.h"
|
||||||
|
|
||||||
/** Insertion of accents
|
/** Insertion of accents
|
||||||
|
|
||||||
Proper handling of accented characters.
|
Proper handling of accented characters.
|
||||||
This is class is supposed to handle all LaTeX accents, it
|
This is class is supposed to handle all LaTeX accents, it
|
||||||
is also possible that the class will change a bit so that
|
is also possible that the class will change a bit so that
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
inline bool canDisplay();
|
inline bool canDisplay();
|
||||||
// should this inset be handled like a normal charater
|
// should this inset be handled like a normal charater
|
||||||
bool isChar() const { return true; }
|
bool isChar() const { return true; }
|
||||||
|
|
||||||
/// all the accent types
|
/// all the accent types
|
||||||
enum ACCENT_TYPES{
|
enum ACCENT_TYPES{
|
||||||
///
|
///
|
||||||
@ -114,11 +114,11 @@ public:
|
|||||||
///
|
///
|
||||||
DOT_LESS_I,
|
DOT_LESS_I,
|
||||||
///
|
///
|
||||||
DOT_LESS_J, // 18
|
DOT_LESS_J, // 18
|
||||||
///
|
///
|
||||||
lSLASH,
|
lSLASH,
|
||||||
///
|
///
|
||||||
LSLASH
|
LSLASH
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);
|
friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);
|
||||||
@ -130,7 +130,7 @@ private:
|
|||||||
bool candisp;
|
bool candisp;
|
||||||
/// modifier type
|
/// modifier type
|
||||||
ACCENT_TYPES modtype;
|
ACCENT_TYPES modtype;
|
||||||
|
|
||||||
/// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
|
/// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
|
||||||
bool remdot;
|
bool remdot;
|
||||||
/// add something to ascent - accent at the top
|
/// add something to ascent - accent at the top
|
||||||
@ -138,7 +138,7 @@ private:
|
|||||||
/// add something to descent - underlined char
|
/// add something to descent - underlined char
|
||||||
bool plusdesc;
|
bool plusdesc;
|
||||||
/// international char
|
/// international char
|
||||||
mutable char ic;
|
mutable char ic;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
@ -69,9 +69,9 @@ int InsetList::latex(Buffer const * buf,
|
|||||||
ostream & os, bool fragile, bool fp) const
|
ostream & os, bool fragile, bool fp) const
|
||||||
{
|
{
|
||||||
os << "\\footnote{%\n";
|
os << "\\footnote{%\n";
|
||||||
|
|
||||||
int i = inset.latex(buf, os, fragile, fp);
|
int i = inset.latex(buf, os, fragile, fp);
|
||||||
os << "}%\n";
|
os << "}%\n";
|
||||||
|
|
||||||
return i + 2;
|
return i + 2;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
@ -19,7 +19,7 @@
|
|||||||
#include "insetcollapsable.h"
|
#include "insetcollapsable.h"
|
||||||
|
|
||||||
/** The list inset
|
/** The list inset
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class InsetList : public InsetCollapsable {
|
class InsetList : public InsetCollapsable {
|
||||||
public:
|
public:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
*
|
*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
@ -59,9 +59,9 @@ int InsetMarginal::latex(Buffer const * buf,
|
|||||||
ostream & os, bool fragile, bool fp) const
|
ostream & os, bool fragile, bool fp) const
|
||||||
{
|
{
|
||||||
os << "%\n\\marginpar{";
|
os << "%\n\\marginpar{";
|
||||||
|
|
||||||
int const i = inset.latex(buf, os, fragile, fp);
|
int const i = inset.latex(buf, os, fragile, fp);
|
||||||
os << "%\n}";
|
os << "%\n}";
|
||||||
|
|
||||||
return i + 2;
|
return i + 2;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
@ -19,7 +19,7 @@
|
|||||||
#include "insetfootlike.h"
|
#include "insetfootlike.h"
|
||||||
|
|
||||||
/** The marginal note inset
|
/** The marginal note inset
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class InsetMarginal : public InsetFootlike {
|
class InsetMarginal : public InsetFootlike {
|
||||||
public:
|
public:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
*======================================================*/
|
||||||
@ -80,7 +80,7 @@ InsetMinipage::InsetMinipage(BufferParams const & bp)
|
|||||||
// just for experimentation :)
|
// just for experimentation :)
|
||||||
setBackgroundColor(LColor::green);
|
setBackgroundColor(LColor::green);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inset.setFrameColor(0, LColor::blue);
|
inset.setFrameColor(0, LColor::blue);
|
||||||
setInsetName("Minipage");
|
setInsetName("Minipage");
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ InsetMinipage::~InsetMinipage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetMinipage::write(Buffer const * buf, ostream & os) const
|
void InsetMinipage::write(Buffer const * buf, ostream & os) const
|
||||||
{
|
{
|
||||||
os << getInsetName() << "\n"
|
os << getInsetName() << "\n"
|
||||||
<< "position " << pos_ << "\n"
|
<< "position " << pos_ << "\n"
|
||||||
@ -245,7 +245,7 @@ int InsetMinipage::latex(Buffer const * buf,
|
|||||||
}
|
}
|
||||||
os << "\\begin{minipage}[" << s_pos << "]{"
|
os << "\\begin{minipage}[" << s_pos << "]{"
|
||||||
<< width_.asLatexString() << "}%\n";
|
<< width_.asLatexString() << "}%\n";
|
||||||
|
|
||||||
int i = inset.latex(buf, os, fragile, fp);
|
int i = inset.latex(buf, os, fragile, fp);
|
||||||
|
|
||||||
os << "\\end{minipage}%\n";
|
os << "\\end{minipage}%\n";
|
||||||
@ -262,7 +262,7 @@ bool InsetMinipage::insetAllowed(Inset::Code code) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetMinipage::Position InsetMinipage::pos() const
|
InsetMinipage::Position InsetMinipage::pos() const
|
||||||
{
|
{
|
||||||
return pos_;
|
return pos_;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2001 The LyX Team.
|
* Copyright 2001 The LyX Team.
|
||||||
@ -21,7 +21,7 @@
|
|||||||
#include <sigc++/signal_system.h>
|
#include <sigc++/signal_system.h>
|
||||||
|
|
||||||
/** The minipage inset
|
/** The minipage inset
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class InsetMinipage : public InsetCollapsable {
|
class InsetMinipage : public InsetCollapsable {
|
||||||
public:
|
public:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
*
|
*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
@ -62,7 +62,7 @@ Inset * InsetNote::clone(Buffer const &, bool same_id) const
|
|||||||
|
|
||||||
|
|
||||||
// This constructor is used for reading old InsetInfo
|
// This constructor is used for reading old InsetInfo
|
||||||
InsetNote::InsetNote(Buffer const * buf, string const & contents,
|
InsetNote::InsetNote(Buffer const * buf, string const & contents,
|
||||||
bool collapsed)
|
bool collapsed)
|
||||||
: InsetCollapsable(buf->params, collapsed)
|
: InsetCollapsable(buf->params, collapsed)
|
||||||
{
|
{
|
||||||
@ -81,7 +81,7 @@ InsetNote::InsetNote(Buffer const * buf, string const & contents,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetNote::editMessage() const
|
string const InsetNote::editMessage() const
|
||||||
{
|
{
|
||||||
return _("Opened Note Inset");
|
return _("Opened Note Inset");
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2001 The LyX Team.
|
* Copyright 2001 The LyX Team.
|
||||||
@ -19,11 +19,11 @@
|
|||||||
#include "insetcollapsable.h"
|
#include "insetcollapsable.h"
|
||||||
|
|
||||||
/** The PostIt note inset
|
/** The PostIt note inset
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class InsetNote : public InsetCollapsable {
|
class InsetNote : public InsetCollapsable {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
InsetNote(BufferParams const &);
|
InsetNote(BufferParams const &);
|
||||||
///
|
///
|
||||||
InsetNote(InsetNote const &, bool same_id = false);
|
InsetNote(InsetNote const &, bool same_id = false);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1997-2001 The LyX Team.
|
* Copyright 1997-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
|
|
||||||
@ -38,14 +38,14 @@ InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf, bool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetParent::getScreenLabel(Buffer const *) const
|
string const InsetParent::getScreenLabel(Buffer const *) const
|
||||||
{
|
{
|
||||||
return string(_("Parent:")) + getContents();
|
return string(_("Parent:")) + getContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetParent::edit(BufferView * bv, int, int, unsigned int)
|
void InsetParent::edit(BufferView * bv, int, int, unsigned int)
|
||||||
{
|
{
|
||||||
bv->owner()->getLyXFunc()->
|
bv->owner()->getLyXFunc()->
|
||||||
dispatch(LFUN_CHILDOPEN, getContents());
|
dispatch(LFUN_CHILDOPEN, getContents());
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1997-2001 LyX Team
|
* Copyright 1997-2001 LyX Team
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef INSET_PARENT_H
|
#ifndef INSET_PARENT_H
|
||||||
@ -22,7 +22,7 @@ class Buffer;
|
|||||||
/** Reference to the parent document.
|
/** Reference to the parent document.
|
||||||
|
|
||||||
Useful to load a parent document from a child document and to
|
Useful to load a parent document from a child document and to
|
||||||
share parent's properties between preambleless children.
|
share parent's properties between preambleless children.
|
||||||
*/
|
*/
|
||||||
class InsetParent : public InsetCommand {
|
class InsetParent : public InsetCommand {
|
||||||
public:
|
public:
|
||||||
@ -42,9 +42,9 @@ public:
|
|||||||
void edit(BufferView *, int, int, unsigned int);
|
void edit(BufferView *, int, int, unsigned int);
|
||||||
///
|
///
|
||||||
void edit(BufferView * bv, bool front = true);
|
void edit(BufferView * bv, bool front = true);
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &,
|
int latex(Buffer const *, std::ostream &,
|
||||||
bool fragile, bool free_spc) const;
|
bool fragile, bool free_spc) const;
|
||||||
///
|
///
|
||||||
void setParent(string fn) { setContents(fn); }
|
void setParent(string fn) { setContents(fn); }
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -47,22 +47,22 @@ char const * const quote_char = ",'`<>";
|
|||||||
|
|
||||||
// Index of chars used for the quote. Index is [side, language]
|
// Index of chars used for the quote. Index is [side, language]
|
||||||
int quote_index[2][6] = {
|
int quote_index[2][6] = {
|
||||||
{ 2, 1, 0, 0, 3, 4 }, // "'',,<>"
|
{ 2, 1, 0, 0, 3, 4 }, // "'',,<>"
|
||||||
{ 1, 1, 2, 1, 4, 3 } }; // "`'`'><"
|
{ 1, 1, 2, 1, 4, 3 } }; // "`'`'><"
|
||||||
|
|
||||||
// Corresponding LaTeX code, for double and single quotes.
|
// Corresponding LaTeX code, for double and single quotes.
|
||||||
char const * const latex_quote_t1[2][5] =
|
char const * const latex_quote_t1[2][5] =
|
||||||
{ { "\\quotesinglbase{}", "'", "`",
|
{ { "\\quotesinglbase{}", "'", "`",
|
||||||
"\\guilsinglleft{}", "\\guilsinglright{}" },
|
"\\guilsinglleft{}", "\\guilsinglright{}" },
|
||||||
{ ",,", "''", "``", "<<", ">>" } };
|
{ ",,", "''", "``", "<<", ">>" } };
|
||||||
|
|
||||||
char const * const latex_quote_ot1[2][5] =
|
char const * const latex_quote_ot1[2][5] =
|
||||||
{ { "\\quotesinglbase{}", "'", "`",
|
{ { "\\quotesinglbase{}", "'", "`",
|
||||||
"\\guilsinglleft{}", "\\guilsinglright{}" },
|
"\\guilsinglleft{}", "\\guilsinglright{}" },
|
||||||
{ "\\quotedblbase{}", "''", "``",
|
{ "\\quotedblbase{}", "''", "``",
|
||||||
"\\guillemotleft{}", "\\guillemotright{}" } };
|
"\\guillemotleft{}", "\\guillemotright{}" } };
|
||||||
|
|
||||||
char const * const latex_quote_babel[2][5] =
|
char const * const latex_quote_babel[2][5] =
|
||||||
{ { "\\glq{}", "'", "`", "\\flq{}", "\\frq{}" },
|
{ { "\\glq{}", "'", "`", "\\flq{}", "\\frq{}" },
|
||||||
{ "\\glqq{}", "''", "``", "\\flqq{}", "\\frqq{}" } };
|
{ "\\glqq{}", "''", "``", "\\flqq{}", "\\frqq{}" } };
|
||||||
|
|
||||||
@ -85,12 +85,12 @@ InsetQuotes::InsetQuotes(quote_language l,
|
|||||||
InsetQuotes::InsetQuotes(char c, BufferParams const & params)
|
InsetQuotes::InsetQuotes(char c, BufferParams const & params)
|
||||||
: language_(params.quotes_language), times_(params.quotes_times)
|
: language_(params.quotes_language), times_(params.quotes_times)
|
||||||
{
|
{
|
||||||
// Decide whether left or right
|
// Decide whether left or right
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case ' ': case '(':
|
case ' ': case '(':
|
||||||
case Paragraph::META_HFILL:
|
case Paragraph::META_HFILL:
|
||||||
case Paragraph::META_NEWLINE:
|
case Paragraph::META_NEWLINE:
|
||||||
side_ = LeftQ; // left quote
|
side_ = LeftQ; // left quote
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
side_ = RightQ; // right quote
|
side_ = RightQ; // right quote
|
||||||
@ -108,7 +108,7 @@ void InsetQuotes::parseString(string const & s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 6; ++i) {
|
for (i = 0; i < 6; ++i) {
|
||||||
if (str[0] == language_char[i]) {
|
if (str[0] == language_char[i]) {
|
||||||
language_ = quote_language(i);
|
language_ = quote_language(i);
|
||||||
@ -118,7 +118,7 @@ void InsetQuotes::parseString(string const & s)
|
|||||||
if (i >= 6) {
|
if (i >= 6) {
|
||||||
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
||||||
" bad language specification." << endl;
|
" bad language specification." << endl;
|
||||||
language_ = EnglishQ;
|
language_ = EnglishQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 2; ++i) {
|
for (i = 0; i < 2; ++i) {
|
||||||
@ -130,7 +130,7 @@ void InsetQuotes::parseString(string const & s)
|
|||||||
if (i >= 2) {
|
if (i >= 2) {
|
||||||
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
||||||
" bad side specification." << endl;
|
" bad side specification." << endl;
|
||||||
side_ = LeftQ;
|
side_ = LeftQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 2; ++i) {
|
for (i = 0; i < 2; ++i) {
|
||||||
@ -142,30 +142,30 @@ void InsetQuotes::parseString(string const & s)
|
|||||||
if (i >= 2) {
|
if (i >= 2) {
|
||||||
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
||||||
" bad times specification." << endl;
|
" bad times specification." << endl;
|
||||||
times_ = DoubleQ;
|
times_ = DoubleQ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const InsetQuotes::dispString(Language const * loclang) const
|
string const InsetQuotes::dispString(Language const * loclang) const
|
||||||
{
|
{
|
||||||
string disp;
|
string disp;
|
||||||
disp += quote_char[quote_index[side_][language_]];
|
disp += quote_char[quote_index[side_][language_]];
|
||||||
if (times_ == DoubleQ)
|
if (times_ == DoubleQ)
|
||||||
disp += disp;
|
disp += disp;
|
||||||
|
|
||||||
if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
|
if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
|
||||||
|| lyxrc.font_norm_type == LyXRC::ISO_8859_3
|
|| lyxrc.font_norm_type == LyXRC::ISO_8859_3
|
||||||
|| lyxrc.font_norm_type == LyXRC::ISO_8859_4
|
|| lyxrc.font_norm_type == LyXRC::ISO_8859_4
|
||||||
|| lyxrc.font_norm_type == LyXRC::ISO_8859_9) {
|
|| lyxrc.font_norm_type == LyXRC::ISO_8859_9) {
|
||||||
if (disp == "'")
|
if (disp == "'")
|
||||||
disp = "´";
|
disp = "´";
|
||||||
else if (disp == "''")
|
else if (disp == "''")
|
||||||
disp = "´´";
|
disp = "´´";
|
||||||
}
|
}
|
||||||
if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
|
if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
|
||||||
|| lyxrc.font_norm_type == LyXRC::ISO_8859_9
|
|| lyxrc.font_norm_type == LyXRC::ISO_8859_9
|
||||||
|| lyxrc.font_norm_type == LyXRC::ISO_8859_15) {
|
|| lyxrc.font_norm_type == LyXRC::ISO_8859_15) {
|
||||||
if (disp == "<<")
|
if (disp == "<<")
|
||||||
disp = '«';
|
disp = '«';
|
||||||
else if (disp == ">>")
|
else if (disp == ">>")
|
||||||
@ -179,8 +179,8 @@ string const InsetQuotes::dispString(Language const * loclang) const
|
|||||||
else
|
else
|
||||||
disp = " " + disp;
|
disp = " " + disp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return disp;
|
return disp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ void InsetQuotes::write(Buffer const *, ostream & os) const
|
|||||||
string text;
|
string text;
|
||||||
text += language_char[language_];
|
text += language_char[language_];
|
||||||
text += side_char[side_];
|
text += side_char[side_];
|
||||||
text += times_char[times_];
|
text += times_char[times_];
|
||||||
os << "Quotes " << text;
|
os << "Quotes " << text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,18 +272,18 @@ int InsetQuotes::latex(Buffer const * buf, ostream & os,
|
|||||||
|
|
||||||
const int quoteind = quote_index[side_][language_];
|
const int quoteind = quote_index[side_][language_];
|
||||||
string qstr;
|
string qstr;
|
||||||
|
|
||||||
if (language_ == FrenchQ && times_ == DoubleQ
|
if (language_ == FrenchQ && times_ == DoubleQ
|
||||||
&& curr_lang == "frenchb") {
|
&& curr_lang == "frenchb") {
|
||||||
if (side_ == LeftQ)
|
if (side_ == LeftQ)
|
||||||
qstr = "\\og "; //the spaces are important here
|
qstr = "\\og "; //the spaces are important here
|
||||||
else
|
else
|
||||||
qstr = " \\fg{}"; //and here
|
qstr = " \\fg{}"; //and here
|
||||||
} else if (language_ == FrenchQ && times_ == DoubleQ
|
} else if (language_ == FrenchQ && times_ == DoubleQ
|
||||||
&& curr_lang == "french") {
|
&& curr_lang == "french") {
|
||||||
if (side_ == LeftQ)
|
if (side_ == LeftQ)
|
||||||
qstr = "<< "; //the spaces are important here
|
qstr = "<< "; //the spaces are important here
|
||||||
else
|
else
|
||||||
qstr = " >>"; //and here
|
qstr = " >>"; //and here
|
||||||
} else if (lyxrc.fontenc == "T1") {
|
} else if (lyxrc.fontenc == "T1") {
|
||||||
qstr = latex_quote_t1[times_][quoteind];
|
qstr = latex_quote_t1[times_][quoteind];
|
||||||
@ -293,7 +293,7 @@ int InsetQuotes::latex(Buffer const * buf, ostream & os,
|
|||||||
} else if (!use_babel) {
|
} else if (!use_babel) {
|
||||||
#endif
|
#endif
|
||||||
qstr = latex_quote_ot1[times_][quoteind];
|
qstr = latex_quote_ot1[times_][quoteind];
|
||||||
} else {
|
} else {
|
||||||
qstr = latex_quote_babel[times_][quoteind];
|
qstr = latex_quote_babel[times_][quoteind];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,24 +337,24 @@ int InsetQuotes::docbook(Buffer const *, ostream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetQuotes::validate(LaTeXFeatures & features) const
|
void InsetQuotes::validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
char type = quote_char[quote_index[side_][language_]];
|
char type = quote_char[quote_index[side_][language_]];
|
||||||
|
|
||||||
#ifdef DO_USE_DEFAULT_LANGUAGE
|
#ifdef DO_USE_DEFAULT_LANGUAGE
|
||||||
if (features.bufferParams().language->lang() == "default"
|
if (features.bufferParams().language->lang() == "default"
|
||||||
#else
|
#else
|
||||||
if (!use_babel
|
if (!use_babel
|
||||||
#endif
|
#endif
|
||||||
&& lyxrc.fontenc != "T1") {
|
&& lyxrc.fontenc != "T1") {
|
||||||
if (times_ == SingleQ)
|
if (times_ == SingleQ)
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ',': features.require("quotesinglbase"); break;
|
case ',': features.require("quotesinglbase"); break;
|
||||||
case '<': features.require("guilsinglleft"); break;
|
case '<': features.require("guilsinglleft"); break;
|
||||||
case '>': features.require("guilsinglright"); break;
|
case '>': features.require("guilsinglright"); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ',': features.require("quotedblbase"); break;
|
case ',': features.require("quotedblbase"); break;
|
||||||
case '<': features.require("guillemotleft"); break;
|
case '<': features.require("guillemotleft"); break;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team
|
* Copyright 1995-2001 The LyX Team
|
||||||
*
|
*
|
||||||
@ -27,7 +27,7 @@ struct LaTeXFeatures;
|
|||||||
/** Quotes.
|
/** Quotes.
|
||||||
|
|
||||||
Used for the various quotes. German, English, French, all either
|
Used for the various quotes. German, English, French, all either
|
||||||
double or single **/
|
double or single **/
|
||||||
class InsetQuotes : public Inset {
|
class InsetQuotes : public Inset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
@ -50,20 +50,20 @@ public:
|
|||||||
///
|
///
|
||||||
LeftQ,
|
LeftQ,
|
||||||
///
|
///
|
||||||
RightQ
|
RightQ
|
||||||
};
|
};
|
||||||
///
|
///
|
||||||
enum quote_times {
|
enum quote_times {
|
||||||
///
|
///
|
||||||
SingleQ,
|
SingleQ,
|
||||||
///
|
///
|
||||||
DoubleQ
|
DoubleQ
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The constructor works like this:
|
/** The constructor works like this:
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item fls <- french single quote left
|
\item fls <- french single quote left
|
||||||
\item grd <- german double quote right
|
\item grd <- german double quote right
|
||||||
\item etc.
|
\item etc.
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
*/
|
*/
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
Inset::Code lyxCode() const;
|
Inset::Code lyxCode() const;
|
||||||
// should this inset be handled like a normal charater
|
// should this inset be handled like a normal charater
|
||||||
bool isChar() const { return true; }
|
bool isChar() const { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
quote_language language_;
|
quote_language language_;
|
||||||
@ -124,4 +124,3 @@ private:
|
|||||||
string const dispString(Language const *) const;
|
string const dispString(Language const *) const;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ void InsetRef::edit(BufferView * bv, int, int, unsigned int button)
|
|||||||
{
|
{
|
||||||
// Eventually trigger dialog with button 3 not 1
|
// Eventually trigger dialog with button 3 not 1
|
||||||
if (button == 3)
|
if (button == 3)
|
||||||
bv->owner()->getLyXFunc()->
|
bv->owner()->getLyXFunc()->
|
||||||
dispatch(LFUN_REF_GOTO, getContents());
|
dispatch(LFUN_REF_GOTO, getContents());
|
||||||
else if (button == 1)
|
else if (button == 1)
|
||||||
bv->owner()->getDialogs()->showRef(this);
|
bv->owner()->getDialogs()->showRef(this);
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1997 LyX Team (this file was created this year)
|
* Copyright 1997 LyX Team (this file was created this year)
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef INSET_REF_H
|
#ifndef INSET_REF_H
|
||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
struct LaTeXFeatures;
|
struct LaTeXFeatures;
|
||||||
|
|
||||||
/** The reference inset
|
/** The reference inset
|
||||||
*/
|
*/
|
||||||
class InsetRef : public InsetCommand {
|
class InsetRef : public InsetCommand {
|
||||||
public:
|
public:
|
||||||
@ -57,7 +57,7 @@ public:
|
|||||||
bool display() const { return false; }
|
bool display() const { return false; }
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &,
|
int latex(Buffer const *, std::ostream &,
|
||||||
bool fragile, bool free_spc) const;
|
bool fragile, bool free_spc) const;
|
||||||
///
|
///
|
||||||
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
||||||
///
|
///
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2000-2001 The LyX Team.
|
* Copyright 2000-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2000-2001 The LyX Team.
|
* Copyright 2000-2001 The LyX Team.
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1997 Asger Alstrup
|
* Copyright 1997 Asger Alstrup
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
@ -53,7 +53,7 @@ int InsetSpecialChar::width(BufferView *, LyXFont const & font) const
|
|||||||
case HYPHENATION:
|
case HYPHENATION:
|
||||||
{
|
{
|
||||||
int w = lyxfont::width('-', font);
|
int w = lyxfont::width('-', font);
|
||||||
if (w > 5)
|
if (w > 5)
|
||||||
w -= 2; // to make it look shorter
|
w -= 2; // to make it look shorter
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ int InsetSpecialChar::width(BufferView *, LyXFont const & font) const
|
|||||||
{
|
{
|
||||||
return lyxfont::width('x', font);
|
return lyxfont::width('x', font);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return 1; // To shut up gcc
|
return 1; // To shut up gcc
|
||||||
}
|
}
|
||||||
@ -125,12 +125,12 @@ void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f,
|
|||||||
int ox = lyxfont::width(' ', font) + int(x);
|
int ox = lyxfont::width(' ', font) + int(x);
|
||||||
int h = lyxfont::ascent('x', font);
|
int h = lyxfont::ascent('x', font);
|
||||||
int xp[4], yp[4];
|
int xp[4], yp[4];
|
||||||
|
|
||||||
xp[0] = ox; yp[0] = baseline;
|
xp[0] = ox; yp[0] = baseline;
|
||||||
xp[1] = ox; yp[1] = baseline - h;
|
xp[1] = ox; yp[1] = baseline - h;
|
||||||
xp[2] = ox + w; yp[2] = baseline - h/2;
|
xp[2] = ox + w; yp[2] = baseline - h/2;
|
||||||
xp[3] = ox; yp[3] = baseline;
|
xp[3] = ox; yp[3] = baseline;
|
||||||
|
|
||||||
pain.lines(xp, yp, 4, LColor::special);
|
pain.lines(xp, yp, 4, LColor::special);
|
||||||
x += width(bv, font);
|
x += width(bv, font);
|
||||||
break;
|
break;
|
||||||
@ -140,7 +140,7 @@ void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f,
|
|||||||
float w = width(bv, font);
|
float w = width(bv, font);
|
||||||
int h = lyxfont::ascent('x', font);
|
int h = lyxfont::ascent('x', font);
|
||||||
int xp[4], yp[4];
|
int xp[4], yp[4];
|
||||||
|
|
||||||
xp[0] = int(x);
|
xp[0] = int(x);
|
||||||
yp[0] = baseline - max(h / 4, 1);
|
yp[0] = baseline - max(h / 4, 1);
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f,
|
|||||||
|
|
||||||
xp[3] = int(x + w);
|
xp[3] = int(x + w);
|
||||||
yp[3] = baseline - max(h / 4, 1);
|
yp[3] = baseline - max(h / 4, 1);
|
||||||
|
|
||||||
pain.lines(xp, yp, 4, LColor::special);
|
pain.lines(xp, yp, 4, LColor::special);
|
||||||
x += w;
|
x += w;
|
||||||
break;
|
break;
|
||||||
@ -166,20 +166,20 @@ void InsetSpecialChar::write(Buffer const *, ostream & os) const
|
|||||||
{
|
{
|
||||||
string command;
|
string command;
|
||||||
switch (kind_) {
|
switch (kind_) {
|
||||||
case HYPHENATION:
|
case HYPHENATION:
|
||||||
command = "\\-";
|
command = "\\-";
|
||||||
break;
|
break;
|
||||||
case LIGATURE_BREAK:
|
case LIGATURE_BREAK:
|
||||||
command = "\\textcompwordmark{}";
|
command = "\\textcompwordmark{}";
|
||||||
break;
|
break;
|
||||||
case END_OF_SENTENCE:
|
case END_OF_SENTENCE:
|
||||||
command = "\\@.";
|
command = "\\@.";
|
||||||
break;
|
break;
|
||||||
case LDOTS:
|
case LDOTS:
|
||||||
command = "\\ldots{}";
|
command = "\\ldots{}";
|
||||||
break;
|
break;
|
||||||
case MENU_SEPARATOR:
|
case MENU_SEPARATOR:
|
||||||
command = "\\menuseparator";
|
command = "\\menuseparator";
|
||||||
break;
|
break;
|
||||||
case PROTECTED_SEPARATOR:
|
case PROTECTED_SEPARATOR:
|
||||||
//command = "\\protected_separator";
|
//command = "\\protected_separator";
|
||||||
@ -192,7 +192,7 @@ void InsetSpecialChar::write(Buffer const *, ostream & os) const
|
|||||||
|
|
||||||
// This function will not be necessary when lyx3
|
// This function will not be necessary when lyx3
|
||||||
void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
|
void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
|
||||||
{
|
{
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
string const command = lex.getString();
|
string const command = lex.getString();
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
|
|||||||
else if (command == "\\ldots{}")
|
else if (command == "\\ldots{}")
|
||||||
kind_ = LDOTS;
|
kind_ = LDOTS;
|
||||||
else if (command == "\\menuseparator")
|
else if (command == "\\menuseparator")
|
||||||
kind_ = MENU_SEPARATOR;
|
kind_ = MENU_SEPARATOR;
|
||||||
else if (command == "\\protected_separator"
|
else if (command == "\\protected_separator"
|
||||||
|| command == "~")
|
|| command == "~")
|
||||||
kind_ = PROTECTED_SEPARATOR;
|
kind_ = PROTECTED_SEPARATOR;
|
||||||
@ -218,23 +218,23 @@ int InsetSpecialChar::latex(Buffer const *, ostream & os, bool /*fragile*/,
|
|||||||
bool free_space) const
|
bool free_space) const
|
||||||
{
|
{
|
||||||
switch (kind_) {
|
switch (kind_) {
|
||||||
case HYPHENATION:
|
case HYPHENATION:
|
||||||
os << "\\-";
|
os << "\\-";
|
||||||
break;
|
break;
|
||||||
case LIGATURE_BREAK:
|
case LIGATURE_BREAK:
|
||||||
os << "\\textcompwordmark{}";
|
os << "\\textcompwordmark{}";
|
||||||
break;
|
break;
|
||||||
case END_OF_SENTENCE:
|
case END_OF_SENTENCE:
|
||||||
os << "\\@.";
|
os << "\\@.";
|
||||||
break;
|
break;
|
||||||
case LDOTS:
|
case LDOTS:
|
||||||
os << "\\ldots{}";
|
os << "\\ldots{}";
|
||||||
break;
|
break;
|
||||||
case MENU_SEPARATOR:
|
case MENU_SEPARATOR:
|
||||||
os << "\\lyxarrow{}";
|
os << "\\lyxarrow{}";
|
||||||
break;
|
break;
|
||||||
case PROTECTED_SEPARATOR:
|
case PROTECTED_SEPARATOR:
|
||||||
os << (free_space ? " " : "~");
|
os << (free_space ? " " : "~");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -247,16 +247,16 @@ int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const
|
|||||||
case HYPHENATION:
|
case HYPHENATION:
|
||||||
case LIGATURE_BREAK:
|
case LIGATURE_BREAK:
|
||||||
break;
|
break;
|
||||||
case END_OF_SENTENCE:
|
case END_OF_SENTENCE:
|
||||||
os << ".";
|
os << ".";
|
||||||
break;
|
break;
|
||||||
case LDOTS:
|
case LDOTS:
|
||||||
os << "...";
|
os << "...";
|
||||||
break;
|
break;
|
||||||
case MENU_SEPARATOR:
|
case MENU_SEPARATOR:
|
||||||
os << "->";
|
os << "->";
|
||||||
break;
|
break;
|
||||||
case PROTECTED_SEPARATOR:
|
case PROTECTED_SEPARATOR:
|
||||||
os << " ";
|
os << " ";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -274,10 +274,10 @@ int InsetSpecialChar::linuxdoc(Buffer const *, ostream & os) const
|
|||||||
os << ".";
|
os << ".";
|
||||||
break;
|
break;
|
||||||
case LDOTS:
|
case LDOTS:
|
||||||
os << "...";
|
os << "...";
|
||||||
break;
|
break;
|
||||||
case MENU_SEPARATOR:
|
case MENU_SEPARATOR:
|
||||||
os << "&lyxarrow;";
|
os << "&lyxarrow;";
|
||||||
break;
|
break;
|
||||||
case PROTECTED_SEPARATOR:
|
case PROTECTED_SEPARATOR:
|
||||||
os << " ";
|
os << " ";
|
||||||
@ -297,7 +297,7 @@ int InsetSpecialChar::docbook(Buffer const *, ostream & os) const
|
|||||||
os << ".";
|
os << ".";
|
||||||
break;
|
break;
|
||||||
case LDOTS:
|
case LDOTS:
|
||||||
os << "...";
|
os << "...";
|
||||||
break;
|
break;
|
||||||
case MENU_SEPARATOR:
|
case MENU_SEPARATOR:
|
||||||
os << "&lyxarrow;";
|
os << "&lyxarrow;";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1997 Asger Alstrup
|
* Copyright 1997 Asger Alstrup
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
@ -59,7 +59,7 @@ public:
|
|||||||
void write(Buffer const *, std::ostream &) const;
|
void write(Buffer const *, std::ostream &) const;
|
||||||
/// Will not be used when lyxf3
|
/// Will not be used when lyxf3
|
||||||
void read(Buffer const *, LyXLex & lex);
|
void read(Buffer const *, LyXLex & lex);
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &,
|
int latex(Buffer const *, std::ostream &,
|
||||||
bool fragile, bool free_spc) const;
|
bool fragile, bool free_spc) const;
|
||||||
///
|
///
|
||||||
@ -70,19 +70,19 @@ public:
|
|||||||
int docbook(Buffer const *, std::ostream &) const;
|
int docbook(Buffer const *, std::ostream &) const;
|
||||||
///
|
///
|
||||||
virtual Inset * clone(Buffer const &, bool same_id = false) const;
|
virtual Inset * clone(Buffer const &, bool same_id = false) const;
|
||||||
///
|
///
|
||||||
Inset::Code lyxCode() const
|
Inset::Code lyxCode() const
|
||||||
{
|
{
|
||||||
return Inset::SPECIALCHAR_CODE;
|
return Inset::SPECIALCHAR_CODE;
|
||||||
}
|
}
|
||||||
/// We don't need \begin_inset and \end_inset
|
/// We don't need \begin_inset and \end_inset
|
||||||
bool directWrite() const
|
bool directWrite() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
///
|
///
|
||||||
void validate(LaTeXFeatures &) const;
|
void validate(LaTeXFeatures &) const;
|
||||||
|
|
||||||
// should this inset be handled like a normal charater
|
// should this inset be handled like a normal charater
|
||||||
bool isChar() const;
|
bool isChar() const;
|
||||||
/// is this equivalent to a letter?
|
/// is this equivalent to a letter?
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2001 The LyX Team.
|
* Copyright 2001 The LyX Team.
|
||||||
@ -261,13 +261,13 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
x += static_cast<float>(scroll());
|
x += static_cast<float>(scroll());
|
||||||
#endif
|
#endif
|
||||||
if (!cleared && ((need_update == INIT) || (need_update == FULL) ||
|
if (!cleared && ((need_update == INIT) || (need_update == FULL) ||
|
||||||
(top_x != int(x)) || (top_baseline != baseline)))
|
(top_x != int(x)) || (top_baseline != baseline)))
|
||||||
{
|
{
|
||||||
int h = ascent(bv, font) + descent(bv, font);
|
int h = ascent(bv, font) + descent(bv, font);
|
||||||
int const tx = display() || !owner() ? 0 : top_x;
|
int const tx = display() || !owner() ? 0 : top_x;
|
||||||
int w = tx ? width(bv, font) : pain.paperWidth();
|
int w = tx ? width(bv, font) : pain.paperWidth();
|
||||||
int ty = baseline - ascent(bv, font);
|
int ty = baseline - ascent(bv, font);
|
||||||
|
|
||||||
if (ty < 0)
|
if (ty < 0)
|
||||||
ty = 0;
|
ty = 0;
|
||||||
if ((ty + h) > pain.paperHeight())
|
if ((ty + h) > pain.paperHeight())
|
||||||
@ -308,7 +308,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
if (hasSelection()) {
|
if (hasSelection()) {
|
||||||
drawCellSelection(pain, nx, baseline, i, j, cell);
|
drawCellSelection(pain, nx, baseline, i, j, cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
tabular->GetCellInset(cell)->draw(bv, font, baseline, cx, cleared);
|
tabular->GetCellInset(cell)->draw(bv, font, baseline, cx, cleared);
|
||||||
drawCellLines(pain, nx, baseline, i, cell);
|
drawCellLines(pain, nx, baseline, i, cell);
|
||||||
nx += tabular->GetWidthOfColumn(cell);
|
nx += tabular->GetWidthOfColumn(cell);
|
||||||
@ -376,7 +376,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
//
|
//
|
||||||
// +--------------------+
|
// +--------------------+
|
||||||
// | C | The rectangles are A, B and C
|
// | C | The rectangles are A, B and C
|
||||||
// | A |------------| B | below, origin top left (tx, ty),
|
// | A |------------| B | below, origin top left (tx, ty),
|
||||||
// | | inset box | | dimensions w(idth), h(eight).
|
// | | inset box | | dimensions w(idth), h(eight).
|
||||||
// +---+------------+---+ x grows rightward, y downward
|
// +---+------------+---+ x grows rightward, y downward
|
||||||
// | D |
|
// | D |
|
||||||
@ -388,10 +388,10 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
#endif
|
#endif
|
||||||
// clear before the inset
|
// clear before the inset
|
||||||
int tx, ty, w, h;
|
int tx, ty, w, h;
|
||||||
tx = nx + 1;
|
tx = nx + 1;
|
||||||
ty = baseline - tabular->GetAscentOfRow(i) + 1;
|
ty = baseline - tabular->GetAscentOfRow(i) + 1;
|
||||||
w = int(cx - nx - 1);
|
w = int(cx - nx - 1);
|
||||||
h = tabular->GetAscentOfRow(i) +
|
h = tabular->GetAscentOfRow(i) +
|
||||||
tabular->GetDescentOfRow(i) - 1;
|
tabular->GetDescentOfRow(i) - 1;
|
||||||
pain.fillRectangle(tx, ty, w, h, backgroundColor());
|
pain.fillRectangle(tx, ty, w, h, backgroundColor());
|
||||||
// clear behind the inset
|
// clear behind the inset
|
||||||
@ -437,11 +437,11 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
|
|||||||
|
|
||||||
|
|
||||||
void InsetTabular::drawCellLines(Painter & pain, int x, int baseline,
|
void InsetTabular::drawCellLines(Painter & pain, int x, int baseline,
|
||||||
int row, int cell) const
|
int row, int cell) const
|
||||||
{
|
{
|
||||||
int x2 = x + tabular->GetWidthOfColumn(cell);
|
int x2 = x + tabular->GetWidthOfColumn(cell);
|
||||||
bool on_off;
|
bool on_off;
|
||||||
|
|
||||||
if (!tabular->TopAlreadyDrawed(cell)) {
|
if (!tabular->TopAlreadyDrawed(cell)) {
|
||||||
on_off = !tabular->TopLine(cell);
|
on_off = !tabular->TopLine(cell);
|
||||||
pain.line(x, baseline - tabular->GetAscentOfRow(row),
|
pain.line(x, baseline - tabular->GetAscentOfRow(row),
|
||||||
@ -483,12 +483,12 @@ void InsetTabular::drawCellSelection(Painter & pain, int x, int baseline,
|
|||||||
} else {
|
} else {
|
||||||
ce = tabular->right_column_of_cell(sel_cell_end);
|
ce = tabular->right_column_of_cell(sel_cell_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rs = tabular->row_of_cell(sel_cell_start);
|
int rs = tabular->row_of_cell(sel_cell_start);
|
||||||
int re = tabular->row_of_cell(sel_cell_end);
|
int re = tabular->row_of_cell(sel_cell_end);
|
||||||
if (rs > re)
|
if (rs > re)
|
||||||
swap(rs, re);
|
swap(rs, re);
|
||||||
|
|
||||||
if ((column >= cs) && (column <= ce) && (row >= rs) && (row <= re)) {
|
if ((column >= cs) && (column <= ce) && (row >= rs) && (row <= re)) {
|
||||||
int w = tabular->GetWidthOfColumn(cell);
|
int w = tabular->GetWidthOfColumn(cell);
|
||||||
int h = tabular->GetAscentOfRow(row) + tabular->GetDescentOfRow(row);
|
int h = tabular->GetAscentOfRow(row) + tabular->GetDescentOfRow(row);
|
||||||
@ -552,7 +552,7 @@ string const InsetTabular::editMessage() const
|
|||||||
void InsetTabular::edit(BufferView * bv, int x, int y, unsigned int button)
|
void InsetTabular::edit(BufferView * bv, int x, int y, unsigned int button)
|
||||||
{
|
{
|
||||||
UpdatableInset::edit(bv, x, y, button);
|
UpdatableInset::edit(bv, x, y, button);
|
||||||
|
|
||||||
if (!bv->lockInset(this)) {
|
if (!bv->lockInset(this)) {
|
||||||
lyxerr[Debug::INSETTEXT] << "InsetTabular::Cannot lock inset" << endl;
|
lyxerr[Debug::INSETTEXT] << "InsetTabular::Cannot lock inset" << endl;
|
||||||
return;
|
return;
|
||||||
@ -573,7 +573,7 @@ void InsetTabular::edit(BufferView * bv, int x, int y, unsigned int button)
|
|||||||
void InsetTabular::edit(BufferView * bv, bool front)
|
void InsetTabular::edit(BufferView * bv, bool front)
|
||||||
{
|
{
|
||||||
UpdatableInset::edit(bv, front);
|
UpdatableInset::edit(bv, front);
|
||||||
|
|
||||||
if (!bv->lockInset(this)) {
|
if (!bv->lockInset(this)) {
|
||||||
lyxerr[Debug::INSETTEXT] << "InsetTabular::Cannot lock inset" << endl;
|
lyxerr[Debug::INSETTEXT] << "InsetTabular::Cannot lock inset" << endl;
|
||||||
return;
|
return;
|
||||||
@ -612,7 +612,7 @@ void InsetTabular::insetUnlock(BufferView * bv)
|
|||||||
|
|
||||||
|
|
||||||
void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what,
|
void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what,
|
||||||
bool mark_dirty) const
|
bool mark_dirty) const
|
||||||
{
|
{
|
||||||
if (what == INIT) {
|
if (what == INIT) {
|
||||||
LyXFont font;
|
LyXFont font;
|
||||||
@ -821,7 +821,7 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
|
|||||||
|
|
||||||
|
|
||||||
bool InsetTabular::insetButtonRelease(BufferView * bv,
|
bool InsetTabular::insetButtonRelease(BufferView * bv,
|
||||||
int x, int y, int button)
|
int x, int y, int button)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (the_locking_inset)
|
if (the_locking_inset)
|
||||||
@ -844,10 +844,10 @@ void InsetTabular::insetMotionNotify(BufferView * bv, int x, int y, int button)
|
|||||||
button);
|
button);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hideInsetCursor(bv);
|
hideInsetCursor(bv);
|
||||||
// int const old_cell = actcell;
|
// int const old_cell = actcell;
|
||||||
|
|
||||||
setPos(bv, x, y);
|
setPos(bv, x, y);
|
||||||
if (!hasSelection()) {
|
if (!hasSelection()) {
|
||||||
setSelection(actcell, actcell);
|
setSelection(actcell, actcell);
|
||||||
@ -870,9 +870,9 @@ void InsetTabular::insetKeyPress(XKeyEvent * xke)
|
|||||||
|
|
||||||
UpdatableInset::RESULT
|
UpdatableInset::RESULT
|
||||||
InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
||||||
string const & arg)
|
string const & arg)
|
||||||
{
|
{
|
||||||
// We need to save the value of the_locking_inset as the call to
|
// We need to save the value of the_locking_inset as the call to
|
||||||
// the_locking_inset->LocalDispatch might unlock it.
|
// the_locking_inset->LocalDispatch might unlock it.
|
||||||
old_locking_inset = the_locking_inset;
|
old_locking_inset = the_locking_inset;
|
||||||
UpdatableInset::RESULT result =
|
UpdatableInset::RESULT result =
|
||||||
@ -949,7 +949,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
|||||||
setSelection(start, actcell);
|
setSelection(start, actcell);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int end = actcell;
|
int end = actcell;
|
||||||
// if we are starting a selection, only select
|
// if we are starting a selection, only select
|
||||||
// the current cell at the beginning
|
// the current cell at the beginning
|
||||||
@ -973,11 +973,11 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
|||||||
setSelection(start, actcell);
|
setSelection(start, actcell);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int end = actcell;
|
int end = actcell;
|
||||||
// if we are starting a selection, only select
|
// if we are starting a selection, only select
|
||||||
// the current cell at the beginning
|
// the current cell at the beginning
|
||||||
if (hasSelection()) {
|
if (hasSelection()) {
|
||||||
moveLeft(bv, false);
|
moveLeft(bv, false);
|
||||||
end = actcell;
|
end = actcell;
|
||||||
}
|
}
|
||||||
@ -1090,7 +1090,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
|||||||
case LFUN_NEXTSEL:
|
case LFUN_NEXTSEL:
|
||||||
case LFUN_WORDLEFT:
|
case LFUN_WORDLEFT:
|
||||||
case LFUN_WORDLEFTSEL:
|
case LFUN_WORDLEFTSEL:
|
||||||
case LFUN_WORDRIGHT:
|
case LFUN_WORDRIGHT:
|
||||||
case LFUN_WORDRIGHTSEL:
|
case LFUN_WORDRIGHTSEL:
|
||||||
case LFUN_DOWN_PARAGRAPH:
|
case LFUN_DOWN_PARAGRAPH:
|
||||||
case LFUN_DOWN_PARAGRAPHSEL:
|
case LFUN_DOWN_PARAGRAPHSEL:
|
||||||
@ -1103,7 +1103,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
|||||||
case LFUN_END:
|
case LFUN_END:
|
||||||
case LFUN_ENDSEL:
|
case LFUN_ENDSEL:
|
||||||
case LFUN_BEGINNINGBUF:
|
case LFUN_BEGINNINGBUF:
|
||||||
case LFUN_BEGINNINGBUFSEL:
|
case LFUN_BEGINNINGBUFSEL:
|
||||||
case LFUN_ENDBUF:
|
case LFUN_ENDBUF:
|
||||||
case LFUN_ENDBUFSEL:
|
case LFUN_ENDBUFSEL:
|
||||||
break;
|
break;
|
||||||
@ -1116,7 +1116,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
|||||||
break;
|
break;
|
||||||
// insert file functions
|
// insert file functions
|
||||||
case LFUN_FILE_INSERT_ASCII_PARA:
|
case LFUN_FILE_INSERT_ASCII_PARA:
|
||||||
case LFUN_FILE_INSERT_ASCII:
|
case LFUN_FILE_INSERT_ASCII:
|
||||||
{
|
{
|
||||||
string tmpstr = getContentsOfAsciiFile(bv, arg, false);
|
string tmpstr = getContentsOfAsciiFile(bv, arg, false);
|
||||||
if (tmpstr.empty())
|
if (tmpstr.empty())
|
||||||
@ -1132,8 +1132,8 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
|||||||
if (!copySelection(bv))
|
if (!copySelection(bv))
|
||||||
break;
|
break;
|
||||||
setUndo(bv, Undo::DELETE,
|
setUndo(bv, Undo::DELETE,
|
||||||
bv->text->cursor.par(),
|
bv->text->cursor.par(),
|
||||||
bv->text->cursor.par()->next());
|
bv->text->cursor.par()->next());
|
||||||
cutSelection();
|
cutSelection();
|
||||||
updateLocal(bv, INIT, true);
|
updateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
@ -1217,8 +1217,8 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
|||||||
case LFUN_PASTE:
|
case LFUN_PASTE:
|
||||||
if (hasPasteBuffer()) {
|
if (hasPasteBuffer()) {
|
||||||
setUndo(bv, Undo::INSERT,
|
setUndo(bv, Undo::INSERT,
|
||||||
bv->text->cursor.par(),
|
bv->text->cursor.par(),
|
||||||
bv->text->cursor.par()->next());
|
bv->text->cursor.par()->next());
|
||||||
pasteSelection(bv);
|
pasteSelection(bv);
|
||||||
updateLocal(bv, INIT, true);
|
updateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
@ -1285,7 +1285,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
|||||||
|
|
||||||
|
|
||||||
int InsetTabular::latex(Buffer const * buf, ostream & os,
|
int InsetTabular::latex(Buffer const * buf, ostream & os,
|
||||||
bool fragile, bool fp) const
|
bool fragile, bool fp) const
|
||||||
{
|
{
|
||||||
return tabular->latex(buf, os, fragile, fp);
|
return tabular->latex(buf, os, fragile, fp);
|
||||||
}
|
}
|
||||||
@ -1295,7 +1295,7 @@ int InsetTabular::ascii(Buffer const * buf, ostream & os, int ll) const
|
|||||||
{
|
{
|
||||||
if (ll > 0)
|
if (ll > 0)
|
||||||
return tabular->ascii(buf, os, (int)parOwner()->params().depth(),
|
return tabular->ascii(buf, os, (int)parOwner()->params().depth(),
|
||||||
false,0);
|
false,0);
|
||||||
return tabular->ascii(buf, os, 0, false,0);
|
return tabular->ascii(buf, os, 0, false,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1342,15 +1342,15 @@ void InsetTabular::validate(LaTeXFeatures & features) const
|
|||||||
|
|
||||||
|
|
||||||
bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
|
bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
|
||||||
LyXFont const & font,
|
LyXFont const & font,
|
||||||
bool reinit) const
|
bool reinit) const
|
||||||
{
|
{
|
||||||
int cell = -1;
|
int cell = -1;
|
||||||
int maxAsc = 0;
|
int maxAsc = 0;
|
||||||
int maxDesc = 0;
|
int maxDesc = 0;
|
||||||
InsetText * inset;
|
InsetText * inset;
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
// if we have a locking_inset we should have to check only this cell for
|
// if we have a locking_inset we should have to check only this cell for
|
||||||
// change so I'll try this to have a boost, but who knows ;)
|
// change so I'll try this to have a boost, but who knows ;)
|
||||||
if ((need_update != INIT) &&
|
if ((need_update != INIT) &&
|
||||||
@ -1411,12 +1411,12 @@ void InsetTabular::toggleInsetCursor(BufferView * bv)
|
|||||||
the_locking_inset->toggleInsetCursor(bv);
|
the_locking_inset->toggleInsetCursor(bv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LyXFont font; // = the_locking_inset->GetFont(par, cursor.pos);
|
LyXFont font; // = the_locking_inset->GetFont(par, cursor.pos);
|
||||||
|
|
||||||
int const asc = lyxfont::maxAscent(font);
|
int const asc = lyxfont::maxAscent(font);
|
||||||
int const desc = lyxfont::maxDescent(font);
|
int const desc = lyxfont::maxDescent(font);
|
||||||
|
|
||||||
if (isCursorVisible())
|
if (isCursorVisible())
|
||||||
bv->hideLockedInsetCursor();
|
bv->hideLockedInsetCursor();
|
||||||
else
|
else
|
||||||
@ -1431,7 +1431,7 @@ void InsetTabular::showInsetCursor(BufferView * bv, bool show)
|
|||||||
return;
|
return;
|
||||||
if (!isCursorVisible()) {
|
if (!isCursorVisible()) {
|
||||||
LyXFont font; // = GetFont(par, cursor.pos);
|
LyXFont font; // = GetFont(par, cursor.pos);
|
||||||
|
|
||||||
int const asc = lyxfont::maxAscent(font);
|
int const asc = lyxfont::maxAscent(font);
|
||||||
int const desc = lyxfont::maxDescent(font);
|
int const desc = lyxfont::maxDescent(font);
|
||||||
bv->fitLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc);
|
bv->fitLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc);
|
||||||
@ -1458,7 +1458,7 @@ void InsetTabular::fitInsetCursor(BufferView * bv) const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LyXFont font;
|
LyXFont font;
|
||||||
|
|
||||||
int const asc = lyxfont::maxAscent(font);
|
int const asc = lyxfont::maxAscent(font);
|
||||||
int const desc = lyxfont::maxDescent(font);
|
int const desc = lyxfont::maxDescent(font);
|
||||||
bv->fitLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc);
|
bv->fitLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc);
|
||||||
@ -1468,7 +1468,7 @@ void InsetTabular::fitInsetCursor(BufferView * bv) const
|
|||||||
void InsetTabular::setPos(BufferView * bv, int x, int y) const
|
void InsetTabular::setPos(BufferView * bv, int x, int y) const
|
||||||
{
|
{
|
||||||
cursor_.y(0);
|
cursor_.y(0);
|
||||||
|
|
||||||
actcell = actrow = actcol = 0;
|
actcell = actrow = actcol = 0;
|
||||||
int ly = tabular->GetDescentOfRow(actrow);
|
int ly = tabular->GetDescentOfRow(actrow);
|
||||||
|
|
||||||
@ -1497,7 +1497,7 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
|
|||||||
int InsetTabular::getCellXPos(int cell) const
|
int InsetTabular::getCellXPos(int cell) const
|
||||||
{
|
{
|
||||||
int c = cell;
|
int c = cell;
|
||||||
|
|
||||||
for (; !tabular->IsFirstCellInRow(c); --c)
|
for (; !tabular->IsFirstCellInRow(c); --c)
|
||||||
;
|
;
|
||||||
int lx = tabular->GetWidthOfColumn(cell);
|
int lx = tabular->GetWidthOfColumn(cell);
|
||||||
@ -1729,15 +1729,15 @@ bool InsetTabular::deletable() const
|
|||||||
|
|
||||||
|
|
||||||
void InsetTabular::setFont(BufferView * bv, LyXFont const & font, bool tall,
|
void InsetTabular::setFont(BufferView * bv, LyXFont const & font, bool tall,
|
||||||
bool selectall)
|
bool selectall)
|
||||||
{
|
{
|
||||||
if (selectall) {
|
if (selectall) {
|
||||||
setSelection(0, tabular->GetNumberOfCells() - 1);
|
setSelection(0, tabular->GetNumberOfCells() - 1);
|
||||||
}
|
}
|
||||||
if (hasSelection()) {
|
if (hasSelection()) {
|
||||||
setUndo(bv, Undo::EDIT,
|
setUndo(bv, Undo::EDIT,
|
||||||
bv->text->cursor.par(),
|
bv->text->cursor.par(),
|
||||||
bv->text->cursor.par()->next());
|
bv->text->cursor.par()->next());
|
||||||
bool frozen = undo_frozen;
|
bool frozen = undo_frozen;
|
||||||
if (!frozen)
|
if (!frozen)
|
||||||
freezeUndo();
|
freezeUndo();
|
||||||
@ -1764,11 +1764,11 @@ void InsetTabular::setFont(BufferView * bv, LyXFont const & font, bool tall,
|
|||||||
bool InsetTabular::tabularFeatures(BufferView * bv, string const & what)
|
bool InsetTabular::tabularFeatures(BufferView * bv, string const & what)
|
||||||
{
|
{
|
||||||
LyXTabular::Feature action = LyXTabular::LAST_ACTION;
|
LyXTabular::Feature action = LyXTabular::LAST_ACTION;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; tabularFeature[i].action != LyXTabular::LAST_ACTION; ++i) {
|
for (; tabularFeature[i].action != LyXTabular::LAST_ACTION; ++i) {
|
||||||
string const tmp = tabularFeature[i].feature;
|
string const tmp = tabularFeature[i].feature;
|
||||||
|
|
||||||
if (tmp == what.substr(0, tmp.length())) {
|
if (tmp == what.substr(0, tmp.length())) {
|
||||||
//if (!compare(tabularFeatures[i].feature.c_str(), what.c_str(),
|
//if (!compare(tabularFeatures[i].feature.c_str(), what.c_str(),
|
||||||
//tabularFeatures[i].feature.length())) {
|
//tabularFeatures[i].feature.length())) {
|
||||||
@ -1786,7 +1786,7 @@ bool InsetTabular::tabularFeatures(BufferView * bv, string const & what)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void checkLongtableSpecial(LyXTabular::ltType & ltt,
|
static void checkLongtableSpecial(LyXTabular::ltType & ltt,
|
||||||
string const & special, bool & flag)
|
string const & special, bool & flag)
|
||||||
{
|
{
|
||||||
if (special == "dl_above") {
|
if (special == "dl_above") {
|
||||||
ltt.topDL = flag;
|
ltt.topDL = flag;
|
||||||
@ -1805,8 +1805,8 @@ static void checkLongtableSpecial(LyXTabular::ltType & ltt,
|
|||||||
|
|
||||||
|
|
||||||
void InsetTabular::tabularFeatures(BufferView * bv,
|
void InsetTabular::tabularFeatures(BufferView * bv,
|
||||||
LyXTabular::Feature feature,
|
LyXTabular::Feature feature,
|
||||||
string const & value)
|
string const & value)
|
||||||
{
|
{
|
||||||
int sel_col_start;
|
int sel_col_start;
|
||||||
int sel_col_end;
|
int sel_col_end;
|
||||||
@ -1851,20 +1851,20 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
|
sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
|
||||||
}
|
}
|
||||||
setUndo(bv, Undo::FINISH,
|
setUndo(bv, Undo::FINISH,
|
||||||
bv->text->cursor.par(),
|
bv->text->cursor.par(),
|
||||||
bv->text->cursor.par()->next());
|
bv->text->cursor.par()->next());
|
||||||
|
|
||||||
int row = tabular->row_of_cell(actcell);
|
int row = tabular->row_of_cell(actcell);
|
||||||
int column = tabular->column_of_cell(actcell);
|
int column = tabular->column_of_cell(actcell);
|
||||||
bool flag = true;
|
bool flag = true;
|
||||||
LyXTabular::ltType ltt;
|
LyXTabular::ltType ltt;
|
||||||
|
|
||||||
switch (feature) {
|
switch (feature) {
|
||||||
case LyXTabular::SET_PWIDTH:
|
case LyXTabular::SET_PWIDTH:
|
||||||
{
|
{
|
||||||
LyXLength const vallen(value);
|
LyXLength const vallen(value);
|
||||||
LyXLength const & tmplen = tabular->GetColumnPWidth(actcell);
|
LyXLength const & tmplen = tabular->GetColumnPWidth(actcell);
|
||||||
|
|
||||||
bool const update = (tmplen != vallen);
|
bool const update = (tmplen != vallen);
|
||||||
tabular->SetColumnPWidth(actcell, vallen);
|
tabular->SetColumnPWidth(actcell, vallen);
|
||||||
if (update) {
|
if (update) {
|
||||||
@ -1881,7 +1881,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
{
|
{
|
||||||
LyXLength const vallen(value);
|
LyXLength const vallen(value);
|
||||||
LyXLength const & tmplen = tabular->GetPWidth(actcell);
|
LyXLength const & tmplen = tabular->GetPWidth(actcell);
|
||||||
|
|
||||||
bool const update = (tmplen != vallen);
|
bool const update = (tmplen != vallen);
|
||||||
tabular->SetMColumnPWidth(actcell, vallen);
|
tabular->SetMColumnPWidth(actcell, vallen);
|
||||||
if (update) {
|
if (update) {
|
||||||
@ -1946,12 +1946,12 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
updateLocal(bv, INIT, true);
|
updateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LyXTabular::M_TOGGLE_LINE_BOTTOM:
|
case LyXTabular::M_TOGGLE_LINE_BOTTOM:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::TOGGLE_LINE_BOTTOM:
|
case LyXTabular::TOGGLE_LINE_BOTTOM:
|
||||||
{
|
{
|
||||||
bool lineSet = !tabular->BottomLine(actcell, flag);
|
bool lineSet = !tabular->BottomLine(actcell, flag);
|
||||||
for (int i = sel_row_start; i <= sel_row_end; ++i)
|
for (int i = sel_row_start; i <= sel_row_end; ++i)
|
||||||
for (int j = sel_col_start; j <= sel_col_end; ++j)
|
for (int j = sel_col_start; j <= sel_col_end; ++j)
|
||||||
tabular->SetBottomLine(
|
tabular->SetBottomLine(
|
||||||
@ -1961,7 +1961,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
updateLocal(bv, INIT, true);
|
updateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LyXTabular::M_TOGGLE_LINE_LEFT:
|
case LyXTabular::M_TOGGLE_LINE_LEFT:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::TOGGLE_LINE_LEFT:
|
case LyXTabular::TOGGLE_LINE_LEFT:
|
||||||
@ -1976,7 +1976,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
updateLocal(bv, INIT, true);
|
updateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LyXTabular::M_TOGGLE_LINE_RIGHT:
|
case LyXTabular::M_TOGGLE_LINE_RIGHT:
|
||||||
flag = false;
|
flag = false;
|
||||||
case LyXTabular::TOGGLE_LINE_RIGHT:
|
case LyXTabular::TOGGLE_LINE_RIGHT:
|
||||||
@ -1991,7 +1991,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
updateLocal(bv, INIT, true);
|
updateLocal(bv, INIT, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LyXTabular::M_ALIGN_LEFT:
|
case LyXTabular::M_ALIGN_LEFT:
|
||||||
case LyXTabular::M_ALIGN_RIGHT:
|
case LyXTabular::M_ALIGN_RIGHT:
|
||||||
case LyXTabular::M_ALIGN_CENTER:
|
case LyXTabular::M_ALIGN_CENTER:
|
||||||
@ -2024,8 +2024,8 @@ void InsetTabular::tabularFeatures(BufferView * bv,
|
|||||||
case LyXTabular::MULTICOLUMN:
|
case LyXTabular::MULTICOLUMN:
|
||||||
{
|
{
|
||||||
if (sel_row_start != sel_row_end) {
|
if (sel_row_start != sel_row_end) {
|
||||||
Alert::alert(_("Impossible Operation!"),
|
Alert::alert(_("Impossible Operation!"),
|
||||||
_("Multicolumns can only be horizontally."),
|
_("Multicolumns can only be horizontally."),
|
||||||
_("Sorry."));
|
_("Sorry."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2189,7 +2189,7 @@ bool InsetTabular::insetHit(BufferView *, int x, int) const
|
|||||||
int InsetTabular::getMaxWidthOfCell(BufferView * bv, int cell) const
|
int InsetTabular::getMaxWidthOfCell(BufferView * bv, int cell) const
|
||||||
{
|
{
|
||||||
LyXLength const len = tabular->GetPWidth(cell);
|
LyXLength const len = tabular->GetPWidth(cell);
|
||||||
|
|
||||||
if (len.zero())
|
if (len.zero())
|
||||||
return -1;
|
return -1;
|
||||||
return len.inPixels(latexTextWidth(bv), bv->text->defaultHeight());
|
return len.inPixels(latexTextWidth(bv), bv->text->defaultHeight());
|
||||||
@ -2197,7 +2197,7 @@ int InsetTabular::getMaxWidthOfCell(BufferView * bv, int cell) const
|
|||||||
|
|
||||||
|
|
||||||
int InsetTabular::getMaxWidth(BufferView * bv,
|
int InsetTabular::getMaxWidth(BufferView * bv,
|
||||||
UpdatableInset const * inset) const
|
UpdatableInset const * inset) const
|
||||||
{
|
{
|
||||||
int cell = tabular->GetCellFromInset(inset, actcell);
|
int cell = tabular->GetCellFromInset(inset, actcell);
|
||||||
|
|
||||||
@ -2206,13 +2206,13 @@ int InsetTabular::getMaxWidth(BufferView * bv,
|
|||||||
<< endl;
|
<< endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w = getMaxWidthOfCell(bv, cell);
|
int w = getMaxWidthOfCell(bv, cell);
|
||||||
if (w > 0) {
|
if (w > 0) {
|
||||||
// because the inset then subtracts it's top_x and owner->x()
|
// because the inset then subtracts it's top_x and owner->x()
|
||||||
w += (inset->x() - top_x);
|
w += (inset->x() - top_x);
|
||||||
}
|
}
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2237,7 +2237,7 @@ void InsetTabular::resizeLyXText(BufferView * bv, bool force) const
|
|||||||
|
|
||||||
|
|
||||||
LyXText * InsetTabular::getLyXText(BufferView const * bv,
|
LyXText * InsetTabular::getLyXText(BufferView const * bv,
|
||||||
bool const recursive) const
|
bool const recursive) const
|
||||||
{
|
{
|
||||||
if (the_locking_inset)
|
if (the_locking_inset)
|
||||||
return the_locking_inset->getLyXText(bv, recursive);
|
return the_locking_inset->getLyXText(bv, recursive);
|
||||||
@ -2286,11 +2286,11 @@ FuncStatus InsetTabular::getStatus(string const & what) const
|
|||||||
{
|
{
|
||||||
int action = LyXTabular::LAST_ACTION;
|
int action = LyXTabular::LAST_ACTION;
|
||||||
FuncStatus status;
|
FuncStatus status;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; tabularFeature[i].action != LyXTabular::LAST_ACTION; ++i) {
|
for (; tabularFeature[i].action != LyXTabular::LAST_ACTION; ++i) {
|
||||||
string const tmp = tabularFeature[i].feature;
|
string const tmp = tabularFeature[i].feature;
|
||||||
if (tmp == what.substr(0, tmp.length())) {
|
if (tmp == what.substr(0, tmp.length())) {
|
||||||
//if (!compare(tabularFeatures[i].feature.c_str(), what.c_str(),
|
//if (!compare(tabularFeatures[i].feature.c_str(), what.c_str(),
|
||||||
// tabularFeatures[i].feature.length())) {
|
// tabularFeatures[i].feature.length())) {
|
||||||
action = tabularFeature[i].action;
|
action = tabularFeature[i].action;
|
||||||
@ -2301,7 +2301,7 @@ FuncStatus InsetTabular::getStatus(string const & what) const
|
|||||||
status.clear();
|
status.clear();
|
||||||
return status.unknown(true);
|
return status.unknown(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
string const argument = frontStrip(what.substr(tabularFeature[i].feature.length()));
|
string const argument = frontStrip(what.substr(tabularFeature[i].feature.length()));
|
||||||
|
|
||||||
int sel_row_start;
|
int sel_row_start;
|
||||||
@ -2477,7 +2477,7 @@ bool InsetTabular::copySelection(BufferView * bv)
|
|||||||
|
|
||||||
ostringstream sstr;
|
ostringstream sstr;
|
||||||
paste_tabular->ascii(bv->buffer(), sstr,
|
paste_tabular->ascii(bv->buffer(), sstr,
|
||||||
(int)parOwner()->params().depth(), true, '\t');
|
(int)parOwner()->params().depth(), true, '\t');
|
||||||
bv->stuffClipboard(sstr.str().c_str());
|
bv->stuffClipboard(sstr.str().c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2582,7 +2582,7 @@ void InsetTabular::getSelection(int & srow, int & erow,
|
|||||||
{
|
{
|
||||||
int const start = hasSelection() ? sel_cell_start : actcell;
|
int const start = hasSelection() ? sel_cell_start : actcell;
|
||||||
int const end = hasSelection() ? sel_cell_end : actcell;
|
int const end = hasSelection() ? sel_cell_end : actcell;
|
||||||
|
|
||||||
srow = tabular->row_of_cell(start);
|
srow = tabular->row_of_cell(start);
|
||||||
erow = tabular->row_of_cell(end);
|
erow = tabular->row_of_cell(end);
|
||||||
if (srow > erow) {
|
if (srow > erow) {
|
||||||
@ -2694,7 +2694,7 @@ string InsetTabular::selectNextWordInt(BufferView * bv, float & value) const
|
|||||||
bv->unlockInset(const_cast<InsetTabular *>(this));
|
bv->unlockInset(const_cast<InsetTabular *>(this));
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise we have to lock the next inset and ask for it's selecttion
|
// otherwise we have to lock the next inset and ask for it's selecttion
|
||||||
UpdatableInset * inset =
|
UpdatableInset * inset =
|
||||||
static_cast<UpdatableInset*>(tabular->GetCellInset(++actcell));
|
static_cast<UpdatableInset*>(tabular->GetCellInset(++actcell));
|
||||||
@ -2722,7 +2722,7 @@ void InsetTabular::toggleSelection(BufferView * bv, bool kill_selection)
|
|||||||
|
|
||||||
|
|
||||||
bool InsetTabular::searchForward(BufferView * bv, string const & str,
|
bool InsetTabular::searchForward(BufferView * bv, string const & str,
|
||||||
bool cs, bool mw)
|
bool cs, bool mw)
|
||||||
{
|
{
|
||||||
nodraw(true);
|
nodraw(true);
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
@ -2750,7 +2750,7 @@ bool InsetTabular::searchForward(BufferView * bv, string const & str,
|
|||||||
|
|
||||||
|
|
||||||
bool InsetTabular::searchBackward(BufferView * bv, string const & str,
|
bool InsetTabular::searchBackward(BufferView * bv, string const & str,
|
||||||
bool cs, bool mw)
|
bool cs, bool mw)
|
||||||
{
|
{
|
||||||
nodraw(true);
|
nodraw(true);
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
@ -2800,11 +2800,11 @@ bool InsetTabular::forceDefaultParagraphs(Inset const * in) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
|
bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
|
||||||
bool usePaste)
|
bool usePaste)
|
||||||
{
|
{
|
||||||
if (buf.find('\t') == string::npos)
|
if (buf.find('\t') == string::npos)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int cols = 1;
|
int cols = 1;
|
||||||
int rows = 1;
|
int rows = 1;
|
||||||
int maxCols = 1;
|
int maxCols = 1;
|
||||||
@ -2835,7 +2835,7 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
|
|||||||
if (usePaste) {
|
if (usePaste) {
|
||||||
delete paste_tabular;
|
delete paste_tabular;
|
||||||
paste_tabular = new LyXTabular(bv->buffer()->params,
|
paste_tabular = new LyXTabular(bv->buffer()->params,
|
||||||
this, rows, maxCols);
|
this, rows, maxCols);
|
||||||
loctab = paste_tabular;
|
loctab = paste_tabular;
|
||||||
cols = 0;
|
cols = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -2880,6 +2880,6 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
|
|||||||
// check for the last cell if there is no trailing '\n'
|
// check for the last cell if there is no trailing '\n'
|
||||||
if ((cell < cells) && (op < len))
|
if ((cell < cells) && (op < len))
|
||||||
loctab->GetCellInset(cell)->setText(buf.substr(op, len-op));
|
loctab->GetCellInset(cell)->setText(buf.substr(op, len-op));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
@ -166,7 +166,7 @@ public:
|
|||||||
int getActCell() const { return actcell; }
|
int getActCell() const { return actcell; }
|
||||||
///
|
///
|
||||||
void setFont(BufferView *, LyXFont const &, bool toggleall = false,
|
void setFont(BufferView *, LyXFont const &, bool toggleall = false,
|
||||||
bool selectall = false);
|
bool selectall = false);
|
||||||
///
|
///
|
||||||
int getMaxWidth(BufferView *, UpdatableInset const *) const;
|
int getMaxWidth(BufferView *, UpdatableInset const *) const;
|
||||||
///
|
///
|
||||||
@ -218,14 +218,14 @@ public:
|
|||||||
void toggleSelection(BufferView *, bool kill_selection);
|
void toggleSelection(BufferView *, bool kill_selection);
|
||||||
///
|
///
|
||||||
bool searchForward(BufferView *, string const &,
|
bool searchForward(BufferView *, string const &,
|
||||||
bool = true, bool = false);
|
bool = true, bool = false);
|
||||||
bool searchBackward(BufferView *, string const &,
|
bool searchBackward(BufferView *, string const &,
|
||||||
bool = true, bool = false);
|
bool = true, bool = false);
|
||||||
|
|
||||||
// this should return true if we have a "normal" cell, otherwise true.
|
// this should return true if we have a "normal" cell, otherwise true.
|
||||||
// "normal" means without width set!
|
// "normal" means without width set!
|
||||||
bool forceDefaultParagraphs(Inset const * in) const;
|
bool forceDefaultParagraphs(Inset const * in) const;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Public structures and variables
|
// Public structures and variables
|
||||||
///
|
///
|
||||||
@ -313,7 +313,7 @@ private:
|
|||||||
string selectNextWordInt(BufferView *, float & value) const;
|
string selectNextWordInt(BufferView *, float & value) const;
|
||||||
///
|
///
|
||||||
bool insertAsciiString(BufferView *, string const & buf, bool usePaste);
|
bool insertAsciiString(BufferView *, string const & buf, bool usePaste);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private structures and variables
|
// Private structures and variables
|
||||||
///
|
///
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998-2001 The LyX Team.
|
* Copyright 1998-2001 The LyX Team.
|
||||||
@ -82,7 +82,7 @@ void InsetText::saveLyXTextState(LyXText * t) const
|
|||||||
break;
|
break;
|
||||||
p = p->next();
|
p = p->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p && t->cursor.pos() <= p->size()) {
|
if (p && t->cursor.pos() <= p->size()) {
|
||||||
sstate.lpar = t->cursor.par();
|
sstate.lpar = t->cursor.par();
|
||||||
sstate.pos = t->cursor.pos();
|
sstate.pos = t->cursor.pos();
|
||||||
@ -110,10 +110,10 @@ void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
|
|||||||
t->selection.mark(sstate.mark_set);
|
t->selection.mark(sstate.mark_set);
|
||||||
if (sstate.selection) {
|
if (sstate.selection) {
|
||||||
t->setCursor(bv, sstate.selstartpar, sstate.selstartpos,
|
t->setCursor(bv, sstate.selstartpar, sstate.selstartpos,
|
||||||
true, sstate.selstartboundary);
|
true, sstate.selstartboundary);
|
||||||
t->selection.cursor = t->cursor;
|
t->selection.cursor = t->cursor;
|
||||||
t->setCursor(bv, sstate.selendpar, sstate.selendpos,
|
t->setCursor(bv, sstate.selendpar, sstate.selendpos,
|
||||||
true, sstate.selendboundary);
|
true, sstate.selendboundary);
|
||||||
t->setSelection(bv);
|
t->setSelection(bv);
|
||||||
t->setCursor(bv, sstate.lpar, sstate.pos);
|
t->setCursor(bv, sstate.lpar, sstate.pos);
|
||||||
} else {
|
} else {
|
||||||
@ -140,7 +140,7 @@ InsetText::InsetText(BufferParams const & bp)
|
|||||||
{
|
{
|
||||||
par = new Paragraph;
|
par = new Paragraph;
|
||||||
par->layout(textclasslist[bp.textclass].defaultLayoutName());
|
par->layout(textclasslist[bp.textclass].defaultLayoutName());
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ InsetText::~InsetText()
|
|||||||
cached_bview = 0;
|
cached_bview = 0;
|
||||||
|
|
||||||
// NOTE
|
// NOTE
|
||||||
|
|
||||||
while (par) {
|
while (par) {
|
||||||
Paragraph * tmp = par->next();
|
Paragraph * tmp = par->next();
|
||||||
delete par;
|
delete par;
|
||||||
@ -219,7 +219,7 @@ void InsetText::clear()
|
|||||||
{
|
{
|
||||||
// This is a gross hack...
|
// This is a gross hack...
|
||||||
string old_layout = par->layout();
|
string old_layout = par->layout();
|
||||||
|
|
||||||
while (par) {
|
while (par) {
|
||||||
Paragraph * tmp = par->next();
|
Paragraph * tmp = par->next();
|
||||||
delete par;
|
delete par;
|
||||||
@ -228,7 +228,7 @@ void InsetText::clear()
|
|||||||
par = new Paragraph;
|
par = new Paragraph;
|
||||||
par->setInsetOwner(this);
|
par->setInsetOwner(this);
|
||||||
par->layout(old_layout);
|
par->layout(old_layout);
|
||||||
|
|
||||||
reinitLyXText();
|
reinitLyXText();
|
||||||
need_update = INIT;
|
need_update = INIT;
|
||||||
}
|
}
|
||||||
@ -258,11 +258,11 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
|
|||||||
string token;
|
string token;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
Paragraph * return_par = 0;
|
Paragraph * return_par = 0;
|
||||||
Paragraph::depth_type depth = 0;
|
Paragraph::depth_type depth = 0;
|
||||||
LyXFont font(LyXFont::ALL_INHERIT);
|
LyXFont font(LyXFont::ALL_INHERIT);
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
while (lex.isOK()) {
|
while (lex.isOK()) {
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
token = lex.getString();
|
token = lex.getString();
|
||||||
@ -274,7 +274,7 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const_cast<Buffer*>(buf)->
|
if (const_cast<Buffer*>(buf)->
|
||||||
parseSingleLyXformat2Token(lex, par, return_par,
|
parseSingleLyXformat2Token(lex, par, return_par,
|
||||||
token, pos, depth, font)) {
|
token, pos, depth, font)) {
|
||||||
@ -290,7 +290,7 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
|
|||||||
return_par->setInsetOwner(this);
|
return_par->setInsetOwner(this);
|
||||||
return_par = return_par->next();
|
return_par = return_par->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token != "\\end_inset") {
|
if (token != "\\end_inset") {
|
||||||
lex.printError("Missing \\end_inset at this point. "
|
lex.printError("Missing \\end_inset at this point. "
|
||||||
"Read: `$$Token'");
|
"Read: `$$Token'");
|
||||||
@ -335,7 +335,7 @@ int InsetText::textWidth(BufferView * bv, bool fordraw) const
|
|||||||
}
|
}
|
||||||
if (fordraw) {
|
if (fordraw) {
|
||||||
return max(w - (2 * TEXT_TO_INSET_OFFSET),
|
return max(w - (2 * TEXT_TO_INSET_OFFSET),
|
||||||
(int)getLyXText(bv)->width);
|
(int)getLyXText(bv)->width);
|
||||||
} else if (w < 0) {
|
} else if (w < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -344,13 +344,13 @@ int InsetText::textWidth(BufferView * bv, bool fordraw) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetText::draw(BufferView * bv, LyXFont const & f,
|
void InsetText::draw(BufferView * bv, LyXFont const & f,
|
||||||
int baseline, float & x, bool cleared) const
|
int baseline, float & x, bool cleared) const
|
||||||
{
|
{
|
||||||
if (nodraw())
|
if (nodraw())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Painter & pain = bv->painter();
|
Painter & pain = bv->painter();
|
||||||
|
|
||||||
// this is the first thing we have to ask because if the x pos
|
// this is the first thing we have to ask because if the x pos
|
||||||
// changed we have to do a complete rebreak of the text as we
|
// changed we have to do a complete rebreak of the text as we
|
||||||
// may have few space to draw in. Well we should check on this too
|
// may have few space to draw in. Well we should check on this too
|
||||||
@ -368,7 +368,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// call these methods so that insetWidth, insetAscent and
|
// call these methods so that insetWidth, insetAscent and
|
||||||
// insetDescent have the right values.
|
// insetDescent have the right values.
|
||||||
width(bv, f);
|
width(bv, f);
|
||||||
ascent(bv, f);
|
ascent(bv, f);
|
||||||
descent(bv, f);
|
descent(bv, f);
|
||||||
@ -415,7 +415,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
|||||||
top_y = baseline - insetAscent;
|
top_y = baseline - insetAscent;
|
||||||
|
|
||||||
if (last_drawn_width != insetWidth) {
|
if (last_drawn_width != insetWidth) {
|
||||||
if (!cleared)
|
if (!cleared)
|
||||||
clearInset(bv, baseline, cleared);
|
clearInset(bv, baseline, cleared);
|
||||||
need_update |= FULL;
|
need_update |= FULL;
|
||||||
last_drawn_width = insetWidth;
|
last_drawn_width = insetWidth;
|
||||||
@ -429,7 +429,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
|||||||
if (!cleared && (need_update == CURSOR)
|
if (!cleared && (need_update == CURSOR)
|
||||||
&& !getLyXText(bv)->selection.set()) {
|
&& !getLyXText(bv)->selection.set()) {
|
||||||
drawFrame(pain, cleared);
|
drawFrame(pain, cleared);
|
||||||
x += insetWidth;
|
x += insetWidth;
|
||||||
need_update = NONE;
|
need_update = NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -458,7 +458,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
|||||||
y = 0;
|
y = 0;
|
||||||
while ((row != 0) && (yf < ph)) {
|
while ((row != 0) && (yf < ph)) {
|
||||||
lt->getVisibleRow(bv, y+y_offset, int(x), row,
|
lt->getVisibleRow(bv, y+y_offset, int(x), row,
|
||||||
y+first, cleared);
|
y+first, cleared);
|
||||||
y += row->height();
|
y += row->height();
|
||||||
yf += row->height();
|
yf += row->height();
|
||||||
row = row->next();
|
row = row->next();
|
||||||
@ -493,9 +493,9 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
|
|||||||
} else if (need_update & CLEAR_FRAME) {
|
} else if (need_update & CLEAR_FRAME) {
|
||||||
clearFrame(pain, cleared);
|
clearFrame(pain, cleared);
|
||||||
}
|
}
|
||||||
|
|
||||||
x += insetWidth - TEXT_TO_INSET_OFFSET;
|
x += insetWidth - TEXT_TO_INSET_OFFSET;
|
||||||
|
|
||||||
if (bv->text->status() == LyXText::CHANGED_IN_DRAW) {
|
if (bv->text->status() == LyXText::CHANGED_IN_DRAW) {
|
||||||
need_update |= FULL;
|
need_update |= FULL;
|
||||||
} else if (need_update != INIT) {
|
} else if (need_update != INIT) {
|
||||||
@ -515,7 +515,7 @@ void InsetText::drawFrame(Painter & pain, bool cleared) const
|
|||||||
frame_w = insetWidth - TEXT_TO_INSET_OFFSET;
|
frame_w = insetWidth - TEXT_TO_INSET_OFFSET;
|
||||||
frame_h = insetAscent + insetDescent - TEXT_TO_INSET_OFFSET;
|
frame_h = insetAscent + insetDescent - TEXT_TO_INSET_OFFSET;
|
||||||
pain.rectangle(frame_x, frame_y, frame_w, frame_h,
|
pain.rectangle(frame_x, frame_y, frame_w, frame_h,
|
||||||
frame_color);
|
frame_color);
|
||||||
frame_is_visible = true;
|
frame_is_visible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -526,7 +526,7 @@ void InsetText::clearFrame(Painter & pain, bool cleared) const
|
|||||||
if (frame_is_visible) {
|
if (frame_is_visible) {
|
||||||
if (!cleared) {
|
if (!cleared) {
|
||||||
pain.rectangle(frame_x, frame_y, frame_w, frame_h,
|
pain.rectangle(frame_x, frame_y, frame_w, frame_h,
|
||||||
backgroundColor());
|
backgroundColor());
|
||||||
}
|
}
|
||||||
frame_is_visible = false;
|
frame_is_visible = false;
|
||||||
}
|
}
|
||||||
@ -580,7 +580,7 @@ void InsetText::setUpdateStatus(BufferView * bv, int what) const
|
|||||||
{
|
{
|
||||||
// this does nothing dangerous so use only a localized buffer
|
// this does nothing dangerous so use only a localized buffer
|
||||||
LyXText * llt = getLyXText(bv);
|
LyXText * llt = getLyXText(bv);
|
||||||
|
|
||||||
need_update |= what;
|
need_update |= what;
|
||||||
// we have to redraw us full if our LyXText NEEDS_MORE_REFRES or
|
// we have to redraw us full if our LyXText NEEDS_MORE_REFRES or
|
||||||
// if we don't break row so that we only have one row to update!
|
// if we don't break row so that we only have one row to update!
|
||||||
@ -614,7 +614,7 @@ void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty) const
|
|||||||
lt->fullRebreak(bv);
|
lt->fullRebreak(bv);
|
||||||
setUpdateStatus(bv, what);
|
setUpdateStatus(bv, what);
|
||||||
bool flag = (((need_update != CURSOR) && (need_update != NONE)) ||
|
bool flag = (((need_update != CURSOR) && (need_update != NONE)) ||
|
||||||
(lt->status() != LyXText::UNCHANGED) || lt->selection.set());
|
(lt->status() != LyXText::UNCHANGED) || lt->selection.set());
|
||||||
if (!lt->selection.set())
|
if (!lt->selection.set())
|
||||||
lt->selection.cursor = lt->cursor;
|
lt->selection.cursor = lt->cursor;
|
||||||
if (clear)
|
if (clear)
|
||||||
@ -623,7 +623,7 @@ void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty) const
|
|||||||
bv->updateInset(const_cast<InsetText *>(this), mark_dirty);
|
bv->updateInset(const_cast<InsetText *>(this), mark_dirty);
|
||||||
else
|
else
|
||||||
bv->fitCursor();
|
bv->fitCursor();
|
||||||
|
|
||||||
if (need_update == CURSOR)
|
if (need_update == CURSOR)
|
||||||
need_update = NONE;
|
need_update = NONE;
|
||||||
bv->owner()->showState();
|
bv->owner()->showState();
|
||||||
@ -645,7 +645,7 @@ string const InsetText::editMessage() const
|
|||||||
void InsetText::edit(BufferView * bv, int x, int y, unsigned int button)
|
void InsetText::edit(BufferView * bv, int x, int y, unsigned int button)
|
||||||
{
|
{
|
||||||
UpdatableInset::edit(bv, x, y, button);
|
UpdatableInset::edit(bv, x, y, button);
|
||||||
|
|
||||||
if (!bv->lockInset(this)) {
|
if (!bv->lockInset(this)) {
|
||||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||||
return;
|
return;
|
||||||
@ -664,7 +664,7 @@ void InsetText::edit(BufferView * bv, int x, int y, unsigned int button)
|
|||||||
}
|
}
|
||||||
if (!checkAndActivateInset(bv, x, tmp_y, button))
|
if (!checkAndActivateInset(bv, x, tmp_y, button))
|
||||||
lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
|
lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
|
||||||
y + insetAscent);
|
y + insetAscent);
|
||||||
lt->clearSelection();
|
lt->clearSelection();
|
||||||
finishUndo();
|
finishUndo();
|
||||||
// If the inset is empty set the language of the current font to the
|
// If the inset is empty set the language of the current font to the
|
||||||
@ -679,7 +679,7 @@ void InsetText::edit(BufferView * bv, int x, int y, unsigned int button)
|
|||||||
// showInsetCursor(bv);
|
// showInsetCursor(bv);
|
||||||
if (clear)
|
if (clear)
|
||||||
lt = 0;
|
lt = 0;
|
||||||
|
|
||||||
int code = CURSOR;
|
int code = CURSOR;
|
||||||
if (drawFrame_ == LOCKED)
|
if (drawFrame_ == LOCKED)
|
||||||
code = CURSOR|DRAW_FRAME;
|
code = CURSOR|DRAW_FRAME;
|
||||||
@ -690,7 +690,7 @@ void InsetText::edit(BufferView * bv, int x, int y, unsigned int button)
|
|||||||
void InsetText::edit(BufferView * bv, bool front)
|
void InsetText::edit(BufferView * bv, bool front)
|
||||||
{
|
{
|
||||||
UpdatableInset::edit(bv, front);
|
UpdatableInset::edit(bv, front);
|
||||||
|
|
||||||
if (!bv->lockInset(this)) {
|
if (!bv->lockInset(this)) {
|
||||||
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
|
||||||
return;
|
return;
|
||||||
@ -747,7 +747,7 @@ void InsetText::insetUnlock(BufferView * bv)
|
|||||||
int code;
|
int code;
|
||||||
if (drawFrame_ == LOCKED)
|
if (drawFrame_ == LOCKED)
|
||||||
code = CURSOR|CLEAR_FRAME;
|
code = CURSOR|CLEAR_FRAME;
|
||||||
else
|
else
|
||||||
code = CURSOR;
|
code = CURSOR;
|
||||||
bool clear = false;
|
bool clear = false;
|
||||||
if (!lt) {
|
if (!lt) {
|
||||||
@ -759,7 +759,7 @@ void InsetText::insetUnlock(BufferView * bv)
|
|||||||
code = FULL;
|
code = FULL;
|
||||||
} else if (owner()) {
|
} else if (owner()) {
|
||||||
bv->owner()->setLayout(owner()->getLyXText(bv)
|
bv->owner()->setLayout(owner()->getLyXText(bv)
|
||||||
->cursor.par()->layout());
|
->cursor.par()->layout());
|
||||||
} else
|
} else
|
||||||
bv->owner()->setLayout(bv->text->cursor.par()->layout());
|
bv->owner()->setLayout(bv->text->cursor.par()->layout());
|
||||||
// hack for deleteEmptyParMech
|
// hack for deleteEmptyParMech
|
||||||
@ -837,7 +837,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
|
|||||||
|
|
||||||
|
|
||||||
bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
|
bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
|
||||||
bool lr)
|
bool lr)
|
||||||
{
|
{
|
||||||
if (!the_locking_inset)
|
if (!the_locking_inset)
|
||||||
return false;
|
return false;
|
||||||
@ -924,9 +924,9 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
|
|||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
if (the_locking_inset == inset) {
|
if (the_locking_inset == inset) {
|
||||||
the_locking_inset->insetButtonPress(bv,
|
the_locking_inset->insetButtonPress(bv,
|
||||||
x - inset_x,
|
x - inset_x,
|
||||||
y - inset_y,
|
y - inset_y,
|
||||||
button);
|
button);
|
||||||
no_selection = false;
|
no_selection = false;
|
||||||
return;
|
return;
|
||||||
} else if (inset) {
|
} else if (inset) {
|
||||||
@ -936,7 +936,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
|
|||||||
inset_y = cy(bv) + drawTextYOffset;
|
inset_y = cy(bv) + drawTextYOffset;
|
||||||
the_locking_inset = 0;
|
the_locking_inset = 0;
|
||||||
inset->insetButtonPress(bv, x - inset_x,
|
inset->insetButtonPress(bv, x - inset_x,
|
||||||
y - inset_y, button);
|
y - inset_y, button);
|
||||||
// inset->edit(bv, x - inset_x, y - inset_y, button);
|
// inset->edit(bv, x - inset_x, y - inset_y, button);
|
||||||
if (the_locking_inset)
|
if (the_locking_inset)
|
||||||
updateLocal(bv, CURSOR, false);
|
updateLocal(bv, CURSOR, false);
|
||||||
@ -957,7 +957,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
|
|||||||
inset_boundary = cboundary(bv);
|
inset_boundary = cboundary(bv);
|
||||||
the_locking_inset = uinset;
|
the_locking_inset = uinset;
|
||||||
uinset->insetButtonPress(bv, x - inset_x, y - inset_y,
|
uinset->insetButtonPress(bv, x - inset_x, y - inset_y,
|
||||||
button);
|
button);
|
||||||
uinset->edit(bv, x - inset_x, y - inset_y, 0);
|
uinset->edit(bv, x - inset_x, y - inset_y, 0);
|
||||||
if (the_locking_inset)
|
if (the_locking_inset)
|
||||||
updateLocal(bv, CURSOR, false);
|
updateLocal(bv, CURSOR, false);
|
||||||
@ -978,7 +978,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
|
lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
|
||||||
y + insetAscent);
|
y + insetAscent);
|
||||||
// set the selection cursor!
|
// set the selection cursor!
|
||||||
lt->selection.cursor = lt->cursor;
|
lt->selection.cursor = lt->cursor;
|
||||||
lt->cursor.x_fix(lt->cursor.x());
|
lt->cursor.x_fix(lt->cursor.x());
|
||||||
@ -1004,7 +1004,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
|
|||||||
localDispatch(bv, LFUN_PASTE, "");
|
localDispatch(bv, LFUN_PASTE, "");
|
||||||
else
|
else
|
||||||
localDispatch(bv, LFUN_PASTESELECTION,
|
localDispatch(bv, LFUN_PASTESELECTION,
|
||||||
"paragraph");
|
"paragraph");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getLyXText(bv)->clearSelection();
|
getLyXText(bv)->clearSelection();
|
||||||
@ -1018,8 +1018,8 @@ bool InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
|
|||||||
{
|
{
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
return the_locking_inset->insetButtonRelease(bv,
|
return the_locking_inset->insetButtonRelease(bv,
|
||||||
x - inset_x, y - inset_y,
|
x - inset_x, y - inset_y,
|
||||||
button);
|
button);
|
||||||
}
|
}
|
||||||
int tmp_x = x - drawTextXOffset;
|
int tmp_x = x - drawTextXOffset;
|
||||||
int tmp_y = y + insetAscent - getLyXText(bv)->first_y;
|
int tmp_y = y + insetAscent - getLyXText(bv)->first_y;
|
||||||
@ -1028,14 +1028,14 @@ bool InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
|
|||||||
if (inset) {
|
if (inset) {
|
||||||
if (isHighlyEditableInset(inset)) {
|
if (isHighlyEditableInset(inset)) {
|
||||||
ret = inset->insetButtonRelease(bv, x - inset_x,
|
ret = inset->insetButtonRelease(bv, x - inset_x,
|
||||||
y - inset_y, button);
|
y - inset_y, button);
|
||||||
} else {
|
} else {
|
||||||
inset_x = cx(bv) - top_x + drawTextXOffset;
|
inset_x = cx(bv) - top_x + drawTextXOffset;
|
||||||
inset_y = cy(bv) + drawTextYOffset;
|
inset_y = cy(bv) + drawTextYOffset;
|
||||||
ret = inset->insetButtonRelease(bv, x - inset_x,
|
ret = inset->insetButtonRelease(bv, x - inset_x,
|
||||||
y - inset_y, button);
|
y - inset_y, button);
|
||||||
inset->edit(bv, x - inset_x,
|
inset->edit(bv, x - inset_x,
|
||||||
y - inset_y, button);
|
y - inset_y, button);
|
||||||
}
|
}
|
||||||
updateLocal(bv, CURSOR_PAR, false);
|
updateLocal(bv, CURSOR_PAR, false);
|
||||||
}
|
}
|
||||||
@ -1049,7 +1049,7 @@ void InsetText::insetMotionNotify(BufferView * bv, int x, int y, int state)
|
|||||||
return;
|
return;
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
the_locking_inset->insetMotionNotify(bv, x - inset_x,
|
the_locking_inset->insetMotionNotify(bv, x - inset_x,
|
||||||
y - inset_y,state);
|
y - inset_y,state);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool clear = false;
|
bool clear = false;
|
||||||
@ -1088,7 +1088,7 @@ void InsetText::insetKeyPress(XKeyEvent * xke)
|
|||||||
|
|
||||||
UpdatableInset::RESULT
|
UpdatableInset::RESULT
|
||||||
InsetText::localDispatch(BufferView * bv,
|
InsetText::localDispatch(BufferView * bv,
|
||||||
kb_action action, string const & arg)
|
kb_action action, string const & arg)
|
||||||
{
|
{
|
||||||
bool was_empty = par->size() == 0 && !par->next();
|
bool was_empty = par->size() == 0 && !par->next();
|
||||||
no_selection = false;
|
no_selection = false;
|
||||||
@ -1161,7 +1161,7 @@ InsetText::localDispatch(BufferView * bv,
|
|||||||
* true (on). */
|
* true (on). */
|
||||||
|
|
||||||
setUndo(bv, Undo::INSERT,
|
setUndo(bv, Undo::INSERT,
|
||||||
lt->cursor.par(), lt->cursor.par()->next());
|
lt->cursor.par(), lt->cursor.par()->next());
|
||||||
bv->setState();
|
bv->setState();
|
||||||
if (lyxrc.auto_region_delete) {
|
if (lyxrc.auto_region_delete) {
|
||||||
if (lt->selection.set()) {
|
if (lt->selection.set()) {
|
||||||
@ -1234,7 +1234,7 @@ InsetText::localDispatch(BufferView * bv,
|
|||||||
break;
|
break;
|
||||||
case LFUN_BACKSPACE: {
|
case LFUN_BACKSPACE: {
|
||||||
setUndo(bv, Undo::DELETE,
|
setUndo(bv, Undo::DELETE,
|
||||||
lt->cursor.par(), lt->cursor.par()->next());
|
lt->cursor.par(), lt->cursor.par()->next());
|
||||||
if (lt->selection.set())
|
if (lt->selection.set())
|
||||||
lt->cutSelection(bv);
|
lt->cutSelection(bv);
|
||||||
else
|
else
|
||||||
@ -1243,10 +1243,10 @@ InsetText::localDispatch(BufferView * bv,
|
|||||||
updflag = true;
|
updflag = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_DELETE: {
|
case LFUN_DELETE: {
|
||||||
setUndo(bv, Undo::DELETE,
|
setUndo(bv, Undo::DELETE,
|
||||||
lt->cursor.par(), lt->cursor.par()->next());
|
lt->cursor.par(), lt->cursor.par()->next());
|
||||||
if (lt->selection.set()) {
|
if (lt->selection.set()) {
|
||||||
lt->cutSelection(bv);
|
lt->cutSelection(bv);
|
||||||
} else {
|
} else {
|
||||||
@ -1256,10 +1256,10 @@ InsetText::localDispatch(BufferView * bv,
|
|||||||
updflag = true;
|
updflag = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CUT: {
|
case LFUN_CUT: {
|
||||||
setUndo(bv, Undo::DELETE,
|
setUndo(bv, Undo::DELETE,
|
||||||
lt->cursor.par(), lt->cursor.par()->next());
|
lt->cursor.par(), lt->cursor.par()->next());
|
||||||
lt->cutSelection(bv);
|
lt->cutSelection(bv);
|
||||||
updwhat = CURSOR_PAR;
|
updwhat = CURSOR_PAR;
|
||||||
updflag = true;
|
updflag = true;
|
||||||
@ -1274,7 +1274,7 @@ InsetText::localDispatch(BufferView * bv,
|
|||||||
case LFUN_PASTESELECTION:
|
case LFUN_PASTESELECTION:
|
||||||
{
|
{
|
||||||
string const clip(bv->getClipboard());
|
string const clip(bv->getClipboard());
|
||||||
|
|
||||||
if (clip.empty())
|
if (clip.empty())
|
||||||
break;
|
break;
|
||||||
if (arg == "paragraph") {
|
if (arg == "paragraph") {
|
||||||
@ -1297,7 +1297,7 @@ InsetText::localDispatch(BufferView * bv,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setUndo(bv, Undo::INSERT,
|
setUndo(bv, Undo::INSERT,
|
||||||
lt->cursor.par(), lt->cursor.par()->next());
|
lt->cursor.par(), lt->cursor.par()->next());
|
||||||
lt->pasteSelection(bv);
|
lt->pasteSelection(bv);
|
||||||
updwhat = CURSOR_PAR;
|
updwhat = CURSOR_PAR;
|
||||||
updflag = true;
|
updflag = true;
|
||||||
@ -1329,7 +1329,7 @@ InsetText::localDispatch(BufferView * bv,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
setUndo(bv, Undo::INSERT,
|
setUndo(bv, Undo::INSERT,
|
||||||
lt->cursor.par(), lt->cursor.par()->next());
|
lt->cursor.par(), lt->cursor.par()->next());
|
||||||
lt->insertChar(bv, Paragraph::META_NEWLINE);
|
lt->insertChar(bv, Paragraph::META_NEWLINE);
|
||||||
updwhat = CURSOR_PAR;
|
updwhat = CURSOR_PAR;
|
||||||
updflag = true;
|
updflag = true;
|
||||||
@ -1340,9 +1340,9 @@ InsetText::localDispatch(BufferView * bv,
|
|||||||
// do not set layouts on non breakable textinsets
|
// do not set layouts on non breakable textinsets
|
||||||
if (autoBreakRows) {
|
if (autoBreakRows) {
|
||||||
string cur_layout = cpar(bv)->layout();
|
string cur_layout = cpar(bv)->layout();
|
||||||
|
|
||||||
// Derive layout number from given argument (string)
|
// Derive layout number from given argument (string)
|
||||||
// and current buffer's textclass (number). */
|
// and current buffer's textclass (number). */
|
||||||
textclass_type tclass = bv->buffer()->params.textclass;
|
textclass_type tclass = bv->buffer()->params.textclass;
|
||||||
string layout = arg;
|
string layout = arg;
|
||||||
bool hasLayout = textclasslist[tclass].hasLayout(layout);
|
bool hasLayout = textclasslist[tclass].hasLayout(layout);
|
||||||
@ -1352,7 +1352,7 @@ InsetText::localDispatch(BufferView * bv,
|
|||||||
string const & obs =
|
string const & obs =
|
||||||
textclasslist[tclass][layout].
|
textclasslist[tclass][layout].
|
||||||
obsoleted_by();
|
obsoleted_by();
|
||||||
if (!obs.empty())
|
if (!obs.empty())
|
||||||
layout = obs;
|
layout = obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1386,7 +1386,7 @@ InsetText::localDispatch(BufferView * bv,
|
|||||||
if (cur_spacing == Spacing::Other) {
|
if (cur_spacing == Spacing::Other) {
|
||||||
cur_value = par->params().spacing().getValue();
|
cur_value = par->params().spacing().getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
istringstream istr(arg.c_str());
|
istringstream istr(arg.c_str());
|
||||||
string tmp;
|
string tmp;
|
||||||
istr >> tmp;
|
istr >> tmp;
|
||||||
@ -1421,7 +1421,7 @@ InsetText::localDispatch(BufferView * bv,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!bv->Dispatch(action, arg))
|
if (!bv->Dispatch(action, arg))
|
||||||
result = UNDISPATCHED;
|
result = UNDISPATCHED;
|
||||||
@ -1458,7 +1458,7 @@ int InsetText::ascii(Buffer const * buf, ostream & os, int linelen) const
|
|||||||
{
|
{
|
||||||
Paragraph * p = par;
|
Paragraph * p = par;
|
||||||
unsigned int lines = 0;
|
unsigned int lines = 0;
|
||||||
|
|
||||||
while (p) {
|
while (p) {
|
||||||
string const tmp = buf->asciiParagraph(p, linelen, p->previous()==0);
|
string const tmp = buf->asciiParagraph(p, linelen, p->previous()==0);
|
||||||
lines += lyx::count(tmp.begin(), tmp.end(), '\n');
|
lines += lyx::count(tmp.begin(), tmp.end(), '\n');
|
||||||
@ -1476,10 +1476,10 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
|
|||||||
|
|
||||||
vector<string> environment_stack(10);
|
vector<string> environment_stack(10);
|
||||||
vector<string> environment_inner(10);
|
vector<string> environment_inner(10);
|
||||||
|
|
||||||
int const command_depth = 0;
|
int const command_depth = 0;
|
||||||
string item_name;
|
string item_name;
|
||||||
|
|
||||||
Paragraph::depth_type depth = 0; // paragraph depth
|
Paragraph::depth_type depth = 0; // paragraph depth
|
||||||
|
|
||||||
while (p) {
|
while (p) {
|
||||||
@ -1517,13 +1517,13 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
|
|||||||
depth + command_depth,
|
depth + command_depth,
|
||||||
environment_inner[depth]);
|
environment_inner[depth]);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf->sgmlCloseTag(os, depth + command_depth,
|
buf->sgmlCloseTag(os, depth + command_depth,
|
||||||
environment_stack[depth]);
|
environment_stack[depth]);
|
||||||
|
|
||||||
environment_stack[depth].erase();
|
environment_stack[depth].erase();
|
||||||
environment_inner[depth].erase();
|
environment_inner[depth].erase();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write opening SGML tags.
|
// Write opening SGML tags.
|
||||||
switch (style.latextype) {
|
switch (style.latextype) {
|
||||||
@ -1566,7 +1566,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
|
|||||||
environment_inner[depth]);
|
environment_inner[depth]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style.latextype == LATEX_ENVIRONMENT) {
|
if (style.latextype == LATEX_ENVIRONMENT) {
|
||||||
if (!style.latexparam().empty()) {
|
if (!style.latexparam().empty()) {
|
||||||
if (style.latexparam() == "CDATA")
|
if (style.latexparam() == "CDATA")
|
||||||
@ -1641,16 +1641,16 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
|
|||||||
item_name = "listitem";
|
item_name = "listitem";
|
||||||
buf->sgmlCloseTag(os, command_depth + depth,
|
buf->sgmlCloseTag(os, command_depth + depth,
|
||||||
item_name);
|
item_name);
|
||||||
if (environment_inner[depth] == "varlistentry")
|
if (environment_inner[depth] == "varlistentry")
|
||||||
buf->sgmlCloseTag(os, depth + command_depth,
|
buf->sgmlCloseTag(os, depth + command_depth,
|
||||||
environment_inner[depth]);
|
environment_inner[depth]);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf->sgmlCloseTag(os, depth + command_depth,
|
buf->sgmlCloseTag(os, depth + command_depth,
|
||||||
environment_stack[depth]);
|
environment_stack[depth]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1706,7 +1706,7 @@ void InsetText::toggleInsetCursor(BufferView * bv)
|
|||||||
|
|
||||||
int const asc = lyxfont::maxAscent(font);
|
int const asc = lyxfont::maxAscent(font);
|
||||||
int const desc = lyxfont::maxDescent(font);
|
int const desc = lyxfont::maxDescent(font);
|
||||||
|
|
||||||
if (isCursorVisible())
|
if (isCursorVisible())
|
||||||
bv->hideLockedInsetCursor();
|
bv->hideLockedInsetCursor();
|
||||||
else
|
else
|
||||||
@ -1724,7 +1724,7 @@ void InsetText::showInsetCursor(BufferView * bv, bool show)
|
|||||||
if (!isCursorVisible()) {
|
if (!isCursorVisible()) {
|
||||||
LyXFont const font =
|
LyXFont const font =
|
||||||
getLyXText(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv));
|
getLyXText(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv));
|
||||||
|
|
||||||
int const asc = lyxfont::maxAscent(font);
|
int const asc = lyxfont::maxAscent(font);
|
||||||
int const desc = lyxfont::maxDescent(font);
|
int const desc = lyxfont::maxDescent(font);
|
||||||
|
|
||||||
@ -1755,7 +1755,7 @@ void InsetText::fitInsetCursor(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
LyXFont const font =
|
LyXFont const font =
|
||||||
getLyXText(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv));
|
getLyXText(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv));
|
||||||
|
|
||||||
int const asc = lyxfont::maxAscent(font);
|
int const asc = lyxfont::maxAscent(font);
|
||||||
int const desc = lyxfont::maxDescent(font);
|
int const desc = lyxfont::maxDescent(font);
|
||||||
|
|
||||||
@ -1784,8 +1784,8 @@ InsetText::moveLeft(BufferView * bv, bool activate_inset, bool selecting)
|
|||||||
|
|
||||||
|
|
||||||
UpdatableInset::RESULT
|
UpdatableInset::RESULT
|
||||||
InsetText::moveRightIntern(BufferView * bv, bool behind,
|
InsetText::moveRightIntern(BufferView * bv, bool behind,
|
||||||
bool activate_inset, bool selecting)
|
bool activate_inset, bool selecting)
|
||||||
{
|
{
|
||||||
if (!cpar(bv)->next() && (cpos(bv) >= cpar(bv)->size()))
|
if (!cpar(bv)->next() && (cpos(bv) >= cpar(bv)->size()))
|
||||||
return FINISHED_RIGHT;
|
return FINISHED_RIGHT;
|
||||||
@ -1800,7 +1800,7 @@ InsetText::moveRightIntern(BufferView * bv, bool behind,
|
|||||||
|
|
||||||
UpdatableInset::RESULT
|
UpdatableInset::RESULT
|
||||||
InsetText::moveLeftIntern(BufferView * bv, bool behind,
|
InsetText::moveLeftIntern(BufferView * bv, bool behind,
|
||||||
bool activate_inset, bool selecting)
|
bool activate_inset, bool selecting)
|
||||||
{
|
{
|
||||||
if (!cpar(bv)->previous() && (cpos(bv) <= 0))
|
if (!cpar(bv)->previous() && (cpos(bv) <= 0))
|
||||||
return FINISHED;
|
return FINISHED;
|
||||||
@ -1903,7 +1903,7 @@ bool InsetText::showInsetDialog(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vector<string> const InsetText::getLabelList() const
|
vector<string> const InsetText::getLabelList() const
|
||||||
{
|
{
|
||||||
vector<string> label_list;
|
vector<string> label_list;
|
||||||
|
|
||||||
@ -1922,7 +1922,7 @@ vector<string> const InsetText::getLabelList() const
|
|||||||
|
|
||||||
|
|
||||||
void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
|
void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
|
||||||
bool selectall)
|
bool selectall)
|
||||||
{
|
{
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
the_locking_inset->setFont(bv, font, toggleall, selectall);
|
the_locking_inset->setFont(bv, font, toggleall, selectall);
|
||||||
@ -2102,7 +2102,7 @@ int InsetText::cx(BufferView * bv) const
|
|||||||
int x = llt->cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
|
int x = llt->cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
LyXFont font = llt->getFont(bv->buffer(), llt->cursor.par(),
|
LyXFont font = llt->getFont(bv->buffer(), llt->cursor.par(),
|
||||||
llt->cursor.pos());
|
llt->cursor.pos());
|
||||||
if (font.isVisibleRightToLeft())
|
if (font.isVisibleRightToLeft())
|
||||||
x -= the_locking_inset->width(bv, font);
|
x -= the_locking_inset->width(bv, font);
|
||||||
}
|
}
|
||||||
@ -2142,7 +2142,7 @@ Row * InsetText::crow(BufferView * bv) const
|
|||||||
|
|
||||||
|
|
||||||
LyXText * InsetText::getLyXText(BufferView const * lbv,
|
LyXText * InsetText::getLyXText(BufferView const * lbv,
|
||||||
bool const recursive) const
|
bool const recursive) const
|
||||||
{
|
{
|
||||||
if (cached_bview == lbv) {
|
if (cached_bview == lbv) {
|
||||||
if (recursive && the_locking_inset)
|
if (recursive && the_locking_inset)
|
||||||
@ -2153,7 +2153,7 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
|
|||||||
}
|
}
|
||||||
// Super UGLY! (Lgb)
|
// Super UGLY! (Lgb)
|
||||||
BufferView * bv = const_cast<BufferView *>(lbv);
|
BufferView * bv = const_cast<BufferView *>(lbv);
|
||||||
|
|
||||||
cached_bview = bv;
|
cached_bview = bv;
|
||||||
Cache::iterator it = cache.find(bv);
|
Cache::iterator it = cache.find(bv);
|
||||||
|
|
||||||
@ -2198,7 +2198,7 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
|
|||||||
restoreLyXTextState(bv, cached_text.get());
|
restoreLyXTextState(bv, cached_text.get());
|
||||||
|
|
||||||
cache.insert(make_pair(bv, cached_text));
|
cache.insert(make_pair(bv, cached_text));
|
||||||
|
|
||||||
if (the_locking_inset && recursive) {
|
if (the_locking_inset && recursive) {
|
||||||
return the_locking_inset->getLyXText(bv);
|
return the_locking_inset->getLyXText(bv);
|
||||||
}
|
}
|
||||||
@ -2211,7 +2211,7 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
|
|||||||
cached_bview = 0;
|
cached_bview = 0;
|
||||||
|
|
||||||
Cache::iterator it = cache.find(bv);
|
Cache::iterator it = cache.find(bv);
|
||||||
|
|
||||||
if (it == cache.end()) {
|
if (it == cache.end()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2274,7 +2274,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
|
|||||||
}
|
}
|
||||||
if (!owner()) {
|
if (!owner()) {
|
||||||
updateLocal(bv, FULL, false);
|
updateLocal(bv, FULL, false);
|
||||||
// this will scroll the screen such that the cursor becomes visible
|
// this will scroll the screen such that the cursor becomes visible
|
||||||
bv->updateScrollbar();
|
bv->updateScrollbar();
|
||||||
} else {
|
} else {
|
||||||
need_update |= FULL;
|
need_update |= FULL;
|
||||||
@ -2314,7 +2314,7 @@ void InsetText::reinitLyXText() const
|
|||||||
}
|
}
|
||||||
if (!owner()) {
|
if (!owner()) {
|
||||||
updateLocal(bv, FULL, false);
|
updateLocal(bv, FULL, false);
|
||||||
// this will scroll the screen such that the cursor becomes visible
|
// this will scroll the screen such that the cursor becomes visible
|
||||||
bv->updateScrollbar();
|
bv->updateScrollbar();
|
||||||
} else {
|
} else {
|
||||||
need_update = FULL;
|
need_update = FULL;
|
||||||
@ -2326,7 +2326,7 @@ void InsetText::reinitLyXText() const
|
|||||||
void InsetText::removeNewlines()
|
void InsetText::removeNewlines()
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
for (Paragraph * p = par; p; p = p->next()) {
|
for (Paragraph * p = par; p; p = p->next()) {
|
||||||
for (int i = 0; i < p->size(); ++i) {
|
for (int i = 0; i < p->size(); ++i) {
|
||||||
if (p->getChar(i) == Paragraph::META_NEWLINE) {
|
if (p->getChar(i) == Paragraph::META_NEWLINE) {
|
||||||
@ -2386,7 +2386,7 @@ void InsetText::clearInset(BufferView * bv, int baseline, bool & cleared) const
|
|||||||
int w = insetWidth;
|
int w = insetWidth;
|
||||||
int h = insetAscent + insetDescent;
|
int h = insetAscent + insetDescent;
|
||||||
int ty = baseline - insetAscent;
|
int ty = baseline - insetAscent;
|
||||||
|
|
||||||
if (ty < 0) {
|
if (ty < 0) {
|
||||||
h += ty;
|
h += ty;
|
||||||
ty = 0;
|
ty = 0;
|
||||||
@ -2569,7 +2569,7 @@ void InsetText::toggleSelection(BufferView * bv, bool kill_selection)
|
|||||||
}
|
}
|
||||||
if (y_offset < 0)
|
if (y_offset < 0)
|
||||||
y_offset = y;
|
y_offset = y;
|
||||||
|
|
||||||
if (need_update & SELECTION)
|
if (need_update & SELECTION)
|
||||||
need_update = NONE;
|
need_update = NONE;
|
||||||
bv->screen()->toggleSelection(lt, bv, kill_selection, y_offset, x);
|
bv->screen()->toggleSelection(lt, bv, kill_selection, y_offset, x);
|
||||||
@ -2579,7 +2579,7 @@ void InsetText::toggleSelection(BufferView * bv, bool kill_selection)
|
|||||||
|
|
||||||
|
|
||||||
bool InsetText::searchForward(BufferView * bv, string const & str,
|
bool InsetText::searchForward(BufferView * bv, string const & str,
|
||||||
bool cs, bool mw)
|
bool cs, bool mw)
|
||||||
{
|
{
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
if (the_locking_inset->searchForward(bv, str, cs, mw))
|
if (the_locking_inset->searchForward(bv, str, cs, mw))
|
||||||
@ -2617,7 +2617,7 @@ bool InsetText::searchForward(BufferView * bv, string const & str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool InsetText::searchBackward(BufferView * bv, string const & str,
|
bool InsetText::searchBackward(BufferView * bv, string const & str,
|
||||||
bool cs, bool mw)
|
bool cs, bool mw)
|
||||||
{
|
{
|
||||||
if (the_locking_inset)
|
if (the_locking_inset)
|
||||||
if (the_locking_inset->searchBackward(bv, str, cs, mw))
|
if (the_locking_inset->searchBackward(bv, str, cs, mw))
|
||||||
@ -2659,12 +2659,12 @@ void InsetText::getDrawFont(LyXFont & font) const
|
|||||||
|
|
||||||
|
|
||||||
void InsetText::appendParagraphs(BufferParams const & bparams,
|
void InsetText::appendParagraphs(BufferParams const & bparams,
|
||||||
Paragraph * newpar)
|
Paragraph * newpar)
|
||||||
{
|
{
|
||||||
Paragraph * buf;
|
Paragraph * buf;
|
||||||
Paragraph * tmpbuf = newpar;
|
Paragraph * tmpbuf = newpar;
|
||||||
Paragraph * lastbuffer = buf = new Paragraph(*tmpbuf, false);
|
Paragraph * lastbuffer = buf = new Paragraph(*tmpbuf, false);
|
||||||
|
|
||||||
while (tmpbuf->next()) {
|
while (tmpbuf->next()) {
|
||||||
tmpbuf = tmpbuf->next();
|
tmpbuf = tmpbuf->next();
|
||||||
lastbuffer->next(new Paragraph(*tmpbuf, false));
|
lastbuffer->next(new Paragraph(*tmpbuf, false));
|
||||||
@ -2679,7 +2679,7 @@ void InsetText::appendParagraphs(BufferParams const & bparams,
|
|||||||
{
|
{
|
||||||
lastbuffer->insertChar(lastbuffer->size(), ' ');
|
lastbuffer->insertChar(lastbuffer->size(), ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
// make the buf exactly the same layout than our last paragraph
|
// make the buf exactly the same layout than our last paragraph
|
||||||
buf->makeSameLayout(lastbuffer);
|
buf->makeSameLayout(lastbuffer);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
@ -38,7 +38,7 @@ class Row;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
A text inset is like a TeX box to write full text
|
A text inset is like a TeX box to write full text
|
||||||
(including styles and other insets) in a given space.
|
(including styles and other insets) in a given space.
|
||||||
@author: Jürgen Vigna
|
@author: Jürgen Vigna
|
||||||
*/
|
*/
|
||||||
class InsetText : public UpdatableInset {
|
class InsetText : public UpdatableInset {
|
||||||
@ -170,7 +170,7 @@ public:
|
|||||||
///
|
///
|
||||||
void setFont(BufferView *, LyXFont const &,
|
void setFont(BufferView *, LyXFont const &,
|
||||||
bool toggleall = false,
|
bool toggleall = false,
|
||||||
bool selectall = false);
|
bool selectall = false);
|
||||||
///
|
///
|
||||||
int getMaxWidth(BufferView *, UpdatableInset const *) const;
|
int getMaxWidth(BufferView *, UpdatableInset const *) const;
|
||||||
///
|
///
|
||||||
@ -240,10 +240,10 @@ public:
|
|||||||
void toggleSelection(BufferView *, bool kill_selection);
|
void toggleSelection(BufferView *, bool kill_selection);
|
||||||
///
|
///
|
||||||
bool searchForward(BufferView *, string const &,
|
bool searchForward(BufferView *, string const &,
|
||||||
bool = true, bool = false);
|
bool = true, bool = false);
|
||||||
///
|
///
|
||||||
bool searchBackward(BufferView *, string const &,
|
bool searchBackward(BufferView *, string const &,
|
||||||
bool = true, bool = false);
|
bool = true, bool = false);
|
||||||
///
|
///
|
||||||
bool checkInsertChar(LyXFont &);
|
bool checkInsertChar(LyXFont &);
|
||||||
///
|
///
|
||||||
@ -301,7 +301,7 @@ private:
|
|||||||
bool activate_inset = true,
|
bool activate_inset = true,
|
||||||
bool selecting = false);
|
bool selecting = false);
|
||||||
///
|
///
|
||||||
UpdatableInset::RESULT moveLeftIntern(BufferView *, bool behind,
|
UpdatableInset::RESULT moveLeftIntern(BufferView *, bool behind,
|
||||||
bool activate_inset = true,
|
bool activate_inset = true,
|
||||||
bool selecting = false);
|
bool selecting = false);
|
||||||
|
|
||||||
@ -315,7 +315,7 @@ private:
|
|||||||
bool checkAndActivateInset(BufferView * bv, bool behind);
|
bool checkAndActivateInset(BufferView * bv, bool behind);
|
||||||
///
|
///
|
||||||
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
|
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
|
||||||
int button = 0);
|
int button = 0);
|
||||||
///
|
///
|
||||||
void removeNewlines();
|
void removeNewlines();
|
||||||
///
|
///
|
||||||
@ -344,7 +344,7 @@ private:
|
|||||||
void reinitLyXText() const;
|
void reinitLyXText() const;
|
||||||
///
|
///
|
||||||
void collapseParagraphs(BufferParams const & bparams) const;
|
void collapseParagraphs(BufferParams const & bparams) const;
|
||||||
|
|
||||||
/* Private structures and variables */
|
/* Private structures and variables */
|
||||||
///
|
///
|
||||||
Paragraph * par;
|
Paragraph * par;
|
||||||
@ -405,7 +405,7 @@ private:
|
|||||||
};
|
};
|
||||||
///
|
///
|
||||||
mutable save_state sstate;
|
mutable save_state sstate;
|
||||||
|
|
||||||
///
|
///
|
||||||
// this is needed globally so we know that we're using it actually and
|
// this is needed globally so we know that we're using it actually and
|
||||||
// so the LyXText-Cache is not erased until used!
|
// so the LyXText-Cache is not erased until used!
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
*
|
*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
@ -49,7 +49,7 @@ InsetTheorem::InsetTheorem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetTheorem::write(Buffer const * buf, ostream & os) const
|
void InsetTheorem::write(Buffer const * buf, ostream & os) const
|
||||||
{
|
{
|
||||||
os << getInsetName() << "\n";
|
os << getInsetName() << "\n";
|
||||||
InsetCollapsable::write(buf, os);
|
InsetCollapsable::write(buf, os);
|
||||||
@ -62,7 +62,7 @@ Inset * InsetTheorem::clone(Buffer const &, bool) const
|
|||||||
#warning Is this inset used? If YES this is WRONG!!! (Jug)
|
#warning Is this inset used? If YES this is WRONG!!! (Jug)
|
||||||
#endif
|
#endif
|
||||||
InsetTheorem * result = new InsetTheorem;
|
InsetTheorem * result = new InsetTheorem;
|
||||||
|
|
||||||
result->collapsed_ = collapsed_;
|
result->collapsed_ = collapsed_;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -78,9 +78,9 @@ int InsetTheorem::latex(Buffer const * buf,
|
|||||||
ostream & os, bool fragile, bool fp) const
|
ostream & os, bool fragile, bool fp) const
|
||||||
{
|
{
|
||||||
os << "\\begin{theorem}%\n";
|
os << "\\begin{theorem}%\n";
|
||||||
|
|
||||||
int i = inset.latex(buf, os, fragile, fp);
|
int i = inset.latex(buf, os, fragile, fp);
|
||||||
os << "\\end{theorem}%\n";
|
os << "\\end{theorem}%\n";
|
||||||
|
|
||||||
return i + 2;
|
return i + 2;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1998 The LyX Team.
|
* Copyright 1998 The LyX Team.
|
||||||
@ -19,7 +19,7 @@
|
|||||||
#include "insetcollapsable.h"
|
#include "insetcollapsable.h"
|
||||||
|
|
||||||
/** The theorem inset
|
/** The theorem inset
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class InsetTheorem : public InsetCollapsable {
|
class InsetTheorem : public InsetCollapsable {
|
||||||
public:
|
public:
|
||||||
|
@ -17,10 +17,10 @@ using std::vector;
|
|||||||
using std::ostream;
|
using std::ostream;
|
||||||
|
|
||||||
|
|
||||||
string const InsetTOC::getScreenLabel(Buffer const *) const
|
string const InsetTOC::getScreenLabel(Buffer const *) const
|
||||||
{
|
{
|
||||||
string const cmdname(getCmdName());
|
string const cmdname(getCmdName());
|
||||||
|
|
||||||
if (cmdname == "tableofcontents")
|
if (cmdname == "tableofcontents")
|
||||||
return _("Table of Contents");
|
return _("Table of Contents");
|
||||||
return _("Unknown toc list");
|
return _("Unknown toc list");
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Word Processor
|
* LyX, The Document Word Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1996-2001 The LyX Team.
|
* Copyright 1996-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef INSET_TOC_H
|
#ifndef INSET_TOC_H
|
||||||
|
@ -38,7 +38,7 @@ string const InsetUrl::getScreenLabel(Buffer const *) const
|
|||||||
string temp;
|
string temp;
|
||||||
if (getCmdName() == "url")
|
if (getCmdName() == "url")
|
||||||
temp = _("Url: ");
|
temp = _("Url: ");
|
||||||
else
|
else
|
||||||
temp = _("HtmlUrl: ");
|
temp = _("HtmlUrl: ");
|
||||||
|
|
||||||
if (!getOptions().empty())
|
if (!getOptions().empty())
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of*
|
/* This file is part of*
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1997-2001 The LyX Team.
|
* Copyright 1997-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef INSET_URL_H
|
#ifndef INSET_URL_H
|
||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
struct LaTeXFeatures;
|
struct LaTeXFeatures;
|
||||||
|
|
||||||
/** The url inset
|
/** The url inset
|
||||||
*/
|
*/
|
||||||
class InsetUrl : public InsetCommand {
|
class InsetUrl : public InsetCommand {
|
||||||
public:
|
public:
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
bool display() const { return false; }
|
bool display() const { return false; }
|
||||||
///
|
///
|
||||||
int latex(Buffer const *, std::ostream &,
|
int latex(Buffer const *, std::ostream &,
|
||||||
bool fragile, bool free_spc) const;
|
bool fragile, bool free_spc) const;
|
||||||
///
|
///
|
||||||
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
||||||
///
|
///
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
2002-03-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
2002-03-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||||
|
|
||||||
|
* most files: ws cleanup
|
||||||
|
|
||||||
* Makefile.am: remove ld -r stuff
|
* Makefile.am: remove ld -r stuff
|
||||||
|
|
||||||
2002-03-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
2002-03-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
|
||||||
|
@ -49,7 +49,7 @@ protected:
|
|||||||
///
|
///
|
||||||
virtual int sync() { return 0; }
|
virtual int sync() { return 0; }
|
||||||
#endif
|
#endif
|
||||||
///
|
///
|
||||||
virtual streamsize xsputn(char_type const *, streamsize n) {
|
virtual streamsize xsputn(char_type const *, streamsize n) {
|
||||||
// fakes a purge of the buffer by returning n
|
// fakes a purge of the buffer by returning n
|
||||||
return n;
|
return n;
|
||||||
@ -174,7 +174,7 @@ DebugStream::DebugStream(Debug::type t)
|
|||||||
: ostream(new debugbuf(cerr.rdbuf())),
|
: ostream(new debugbuf(cerr.rdbuf())),
|
||||||
dt(t), nullstream(new nullbuf), internal(0) {}
|
dt(t), nullstream(new nullbuf), internal(0) {}
|
||||||
|
|
||||||
|
|
||||||
/// Constructor, sets the log file to f, and the debug level to t.
|
/// Constructor, sets the log file to f, and the debug level to t.
|
||||||
DebugStream::DebugStream(char const * f, Debug::type t)
|
DebugStream::DebugStream(char const * f, Debug::type t)
|
||||||
: ostream(new debugbuf(cerr.rdbuf())),
|
: ostream(new debugbuf(cerr.rdbuf())),
|
||||||
@ -218,37 +218,37 @@ int main(int, char **)
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
I have been running some tests on this to see how much overhead
|
I have been running some tests on this to see how much overhead
|
||||||
this kind of permanent debug code has. My conclusion is: not
|
this kind of permanent debug code has. My conclusion is: not
|
||||||
much. In all, but the most time critical code, this will have
|
much. In all, but the most time critical code, this will have
|
||||||
close to no impact at all.
|
close to no impact at all.
|
||||||
|
|
||||||
In the tests that I have run the use of
|
In the tests that I have run the use of
|
||||||
if (debugstream.debugging(DebugStream::INFO))
|
if (debugstream.debugging(DebugStream::INFO))
|
||||||
debugstream << "some debug\n";
|
debugstream << "some debug\n";
|
||||||
has close to no overhead when the debug level is not
|
has close to no overhead when the debug level is not
|
||||||
DebugStream::INFO.
|
DebugStream::INFO.
|
||||||
|
|
||||||
The overhead for
|
The overhead for
|
||||||
debugstream.debug(DebugStream::INFO) << "some debug\n";
|
debugstream.debug(DebugStream::INFO) << "some debug\n";
|
||||||
is also very small when the debug level is not
|
is also very small when the debug level is not
|
||||||
DebugStream::INFO. However the overhead for this will increase
|
DebugStream::INFO. However the overhead for this will increase
|
||||||
if complex debugging information is output.
|
if complex debugging information is output.
|
||||||
|
|
||||||
The overhead when the debug level is DebugStream::INFO can be
|
The overhead when the debug level is DebugStream::INFO can be
|
||||||
significant, but since we then are running in debug mode it is
|
significant, but since we then are running in debug mode it is
|
||||||
of no concern.
|
of no concern.
|
||||||
|
|
||||||
Why should we use this instead of the class Error that we already
|
Why should we use this instead of the class Error that we already
|
||||||
have? First of all it uses C++ iostream and constructs, secondly
|
have? First of all it uses C++ iostream and constructs, secondly
|
||||||
it will be a lot easier to output the debug info that we need
|
it will be a lot easier to output the debug info that we need
|
||||||
without a lot of manual conversions, thirdly we can now use
|
without a lot of manual conversions, thirdly we can now use
|
||||||
iomanipulators and the complete iostream formatting functions.
|
iomanipulators and the complete iostream formatting functions.
|
||||||
pluss it will work for all types that have a operator<<
|
pluss it will work for all types that have a operator<<
|
||||||
defined, and can be used in functors that take a ostream & as
|
defined, and can be used in functors that take a ostream & as
|
||||||
parameter. And there should be less need for temporary objects.
|
parameter. And there should be less need for temporary objects.
|
||||||
And one nice bonus is that we get a log file almost for
|
And one nice bonus is that we get a log file almost for
|
||||||
free.
|
free.
|
||||||
|
|
||||||
Some of the names are of course open to modifications. I will try
|
Some of the names are of course open to modifications. I will try
|
||||||
to use the names we already use in LyX.
|
to use the names we already use in LyX.
|
||||||
*/
|
*/
|
||||||
@ -268,7 +268,7 @@ int main(int, char **)
|
|||||||
debugstream.debug(Debug::WARN) << "more debug(WARN)\n";
|
debugstream.debug(Debug::WARN) << "more debug(WARN)\n";
|
||||||
debugstream.debug(Debug::INFO) << "even more debug(INFO)\n";
|
debugstream.debug(Debug::INFO) << "even more debug(INFO)\n";
|
||||||
debugstream.debug(Debug::CRIT) << "even more debug(CRIT)\n";
|
debugstream.debug(Debug::CRIT) << "even more debug(CRIT)\n";
|
||||||
debugstream.addLevel(Debug::type(Debug::CRIT |
|
debugstream.addLevel(Debug::type(Debug::CRIT |
|
||||||
Debug::WARN));
|
Debug::WARN));
|
||||||
debugstream << "Adding Debug::CRIT and Debug::WARN\n";
|
debugstream << "Adding Debug::CRIT and Debug::WARN\n";
|
||||||
debugstream[Debug::WARN] << "more debug(WARN)\n";
|
debugstream[Debug::WARN] << "more debug(WARN)\n";
|
||||||
@ -287,7 +287,7 @@ int main(int, char **)
|
|||||||
// note: the (void*) is needed on g++ 2.7.x since it does not
|
// note: the (void*) is needed on g++ 2.7.x since it does not
|
||||||
// support partial specialization. In egcs this should not be
|
// support partial specialization. In egcs this should not be
|
||||||
// needed.
|
// needed.
|
||||||
debugstream << "automatic " << &i
|
debugstream << "automatic " << &i
|
||||||
<< ", free store " << p << endl;
|
<< ", free store " << p << endl;
|
||||||
delete p;
|
delete p;
|
||||||
/*
|
/*
|
||||||
|
@ -53,12 +53,12 @@ struct Debug {
|
|||||||
INFO
|
INFO
|
||||||
Always
|
Always
|
||||||
|
|
||||||
If you want to have debug output from time critical code you should
|
If you want to have debug output from time critical code you should
|
||||||
use this construct:
|
use this construct:
|
||||||
if (debug.debugging(Debug::INFO)) {
|
if (debug.debugging(Debug::INFO)) {
|
||||||
debug << "...debug output...\n";
|
debug << "...debug output...\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
To give debug info even if no debug (NONE) is requested:
|
To give debug info even if no debug (NONE) is requested:
|
||||||
debug << "... always output ...\n";
|
debug << "... always output ...\n";
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class DebugStream : public std::ostream
|
|||||||
public:
|
public:
|
||||||
/// Constructor, sets the debug level to t.
|
/// Constructor, sets the debug level to t.
|
||||||
explicit DebugStream(Debug::type t = Debug::NONE);
|
explicit DebugStream(Debug::type t = Debug::NONE);
|
||||||
|
|
||||||
/// Constructor, sets the log file to f, and the debug level to t.
|
/// Constructor, sets the log file to f, and the debug level to t.
|
||||||
explicit
|
explicit
|
||||||
DebugStream(char const * f, Debug::type t = Debug::NONE);
|
DebugStream(char const * f, Debug::type t = Debug::NONE);
|
||||||
@ -110,7 +110,7 @@ public:
|
|||||||
|
|
||||||
/// Sets the debugstreams' logfile to f.
|
/// Sets the debugstreams' logfile to f.
|
||||||
void logFile(char const * f);
|
void logFile(char const * f);
|
||||||
|
|
||||||
/// Returns true if t is part of the current debug level.
|
/// Returns true if t is part of the current debug level.
|
||||||
bool debugging(Debug::type t = Debug::ANY) const
|
bool debugging(Debug::type t = Debug::ANY) const
|
||||||
{
|
{
|
||||||
@ -118,7 +118,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Returns the no-op stream if t is not part of the
|
/** Returns the no-op stream if t is not part of the
|
||||||
current debug level otherwise the real debug stream
|
current debug level otherwise the real debug stream
|
||||||
is used.
|
is used.
|
||||||
@ -128,7 +128,7 @@ public:
|
|||||||
return nullstream;
|
return nullstream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** This is an operator to give a more convenient use:
|
/** This is an operator to give a more convenient use:
|
||||||
dbgstream[Debug::INFO] << "Info!\n";
|
dbgstream[Debug::INFO] << "Info!\n";
|
||||||
*/
|
*/
|
||||||
@ -147,5 +147,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -56,7 +56,7 @@
|
|||||||
#undef S_ISNWK
|
#undef S_ISNWK
|
||||||
#undef S_ISREG
|
#undef S_ISREG
|
||||||
#undef S_ISSOCK
|
#undef S_ISSOCK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(S_ISBLK) && defined(S_IFBLK)
|
#if !defined(S_ISBLK) && defined(S_IFBLK)
|
||||||
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||||
@ -87,7 +87,7 @@
|
|||||||
#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
|
#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Since major is a function on SVR4, we can't use `ifndef major'.
|
// Since major is a function on SVR4, we can't use `ifndef major'.
|
||||||
// might want to put MAJOR_IN_MKDEV for SYSV
|
// might want to put MAJOR_IN_MKDEV for SYSV
|
||||||
#ifdef MAJOR_IN_MKDEV
|
#ifdef MAJOR_IN_MKDEV
|
||||||
#include <sys/mkdev.h>
|
#include <sys/mkdev.h>
|
||||||
@ -97,7 +97,7 @@
|
|||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
#define HAVE_MAJOR
|
#define HAVE_MAJOR
|
||||||
#endif
|
#endif
|
||||||
#ifdef major
|
#ifdef major
|
||||||
#define HAVE_MAJOR
|
#define HAVE_MAJOR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ void FileInfo::dostat(bool link)
|
|||||||
FileInfo & FileInfo::newFile(string const & path, bool link)
|
FileInfo & FileInfo::newFile(string const & path, bool link)
|
||||||
{
|
{
|
||||||
fname = path;
|
fname = path;
|
||||||
|
|
||||||
status = 0;
|
status = 0;
|
||||||
err = NoErr;
|
err = NoErr;
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ FileInfo & FileInfo::newFile(int fildes)
|
|||||||
char const * FileInfo::typeIndicator() const
|
char const * FileInfo::typeIndicator() const
|
||||||
{
|
{
|
||||||
lyx::Assert(isOK());
|
lyx::Assert(isOK());
|
||||||
|
|
||||||
if (S_ISDIR(buf.st_mode)) return ("/");
|
if (S_ISDIR(buf.st_mode)) return ("/");
|
||||||
#ifdef S_ISLNK
|
#ifdef S_ISLNK
|
||||||
if (S_ISLNK(buf.st_mode)) return ("@");
|
if (S_ISLNK(buf.st_mode)) return ("@");
|
||||||
@ -196,7 +196,7 @@ char const * FileInfo::typeIndicator() const
|
|||||||
mode_t FileInfo::getMode() const
|
mode_t FileInfo::getMode() const
|
||||||
{
|
{
|
||||||
lyx::Assert(isOK());
|
lyx::Assert(isOK());
|
||||||
|
|
||||||
return buf.st_mode;
|
return buf.st_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ void FileInfo::modeString(char * szString) const
|
|||||||
char FileInfo::typeLetter() const
|
char FileInfo::typeLetter() const
|
||||||
{
|
{
|
||||||
lyx::Assert(isOK());
|
lyx::Assert(isOK());
|
||||||
|
|
||||||
#ifdef S_ISBLK
|
#ifdef S_ISBLK
|
||||||
if (S_ISBLK(buf.st_mode)) return 'b';
|
if (S_ISBLK(buf.st_mode)) return 'b';
|
||||||
#endif
|
#endif
|
||||||
@ -256,7 +256,7 @@ void FileInfo::flagRWX(mode_t i, char * szString) const
|
|||||||
void FileInfo::setSticky(char * szString) const
|
void FileInfo::setSticky(char * szString) const
|
||||||
{
|
{
|
||||||
lyx::Assert(isOK());
|
lyx::Assert(isOK());
|
||||||
|
|
||||||
#ifdef S_ISUID
|
#ifdef S_ISUID
|
||||||
if (buf.st_mode & S_ISUID) {
|
if (buf.st_mode & S_ISUID) {
|
||||||
if (szString[3] != 'x') szString[3] = 'S';
|
if (szString[3] != 'x') szString[3] = 'S';
|
||||||
@ -400,7 +400,7 @@ bool FileInfo::access(int p) const
|
|||||||
{
|
{
|
||||||
// if we don't have a filename we fail
|
// if we don't have a filename we fail
|
||||||
if (fname.empty()) return false;
|
if (fname.empty()) return false;
|
||||||
|
|
||||||
if (::access(fname.c_str(), p) == 0)
|
if (::access(fname.c_str(), p) == 0)
|
||||||
return true;
|
return true;
|
||||||
else {
|
else {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -33,7 +33,7 @@ class FileInfo : boost::noncopyable {
|
|||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
FileInfo();
|
FileInfo();
|
||||||
|
|
||||||
/** Get information about file.
|
/** Get information about file.
|
||||||
If link is true, the information is about the link itself, not
|
If link is true, the information is about the link itself, not
|
||||||
the file that is obtained by tracing the links. */
|
the file that is obtained by tracing the links. */
|
||||||
@ -46,52 +46,52 @@ public:
|
|||||||
|
|
||||||
/// Query a new file
|
/// Query a new file
|
||||||
FileInfo & newFile(string const & path, bool link = false);
|
FileInfo & newFile(string const & path, bool link = false);
|
||||||
|
|
||||||
/// Query a new file descriptor
|
/// Query a new file descriptor
|
||||||
FileInfo & newFile(int fildes);
|
FileInfo & newFile(int fildes);
|
||||||
|
|
||||||
/// Returns a character describing file type (ls -F)
|
/// Returns a character describing file type (ls -F)
|
||||||
char const * typeIndicator() const;
|
char const * typeIndicator() const;
|
||||||
|
|
||||||
/// File protection mode
|
/// File protection mode
|
||||||
mode_t getMode() const;
|
mode_t getMode() const;
|
||||||
|
|
||||||
/// Constructs standard mode string (ls style)
|
/// Constructs standard mode string (ls style)
|
||||||
void modeString(char * szString) const;
|
void modeString(char * szString) const;
|
||||||
|
|
||||||
/// returns a letter describing a file type (ls style)
|
/// returns a letter describing a file type (ls style)
|
||||||
char typeLetter() const;
|
char typeLetter() const;
|
||||||
|
|
||||||
/// builds 'rwx' string describing file access rights
|
/// builds 'rwx' string describing file access rights
|
||||||
void flagRWX(mode_t i, char * szString) const;
|
void flagRWX(mode_t i, char * szString) const;
|
||||||
|
|
||||||
/// updates mode string to match suid/sgid/sticky bits
|
/// updates mode string to match suid/sgid/sticky bits
|
||||||
void setSticky(char * szString) const;
|
void setSticky(char * szString) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
time_t getModificationTime() const;
|
time_t getModificationTime() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
time_t getAccessTime() const;
|
time_t getAccessTime() const;
|
||||||
|
|
||||||
///
|
///
|
||||||
time_t getStatusChangeTime() const;
|
time_t getStatusChangeTime() const;
|
||||||
|
|
||||||
/// Total file size in bytes
|
/// Total file size in bytes
|
||||||
off_t getSize() const;
|
off_t getSize() const;
|
||||||
|
|
||||||
/// Number of hard links
|
/// Number of hard links
|
||||||
nlink_t getNumberOfLinks() const;
|
nlink_t getNumberOfLinks() const;
|
||||||
|
|
||||||
/// User ID of owner
|
/// User ID of owner
|
||||||
uid_t getUid() const;
|
uid_t getUid() const;
|
||||||
|
|
||||||
/// Group ID of owner
|
/// Group ID of owner
|
||||||
gid_t getGid() const;
|
gid_t getGid() const;
|
||||||
|
|
||||||
/// Is the file information correct? Did the query succeed?
|
/// Is the file information correct? Did the query succeed?
|
||||||
bool isOK() const;
|
bool isOK() const;
|
||||||
|
|
||||||
/// Permission flags
|
/// Permission flags
|
||||||
enum perm_test {
|
enum perm_test {
|
||||||
/// test for read permission
|
/// test for read permission
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifndef LISTREAM_H
|
#ifndef LISTREAM_H
|
||||||
#define LISTREAM_H
|
#define LISTREAM_H
|
||||||
|
|
||||||
#ifdef HAVE_ISTREAM
|
#ifdef HAVE_ISTREAM
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#else
|
#else
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifndef LOSTREAM_H
|
#ifndef LOSTREAM_H
|
||||||
#define LOSTREAM_H
|
#define LOSTREAM_H
|
||||||
|
|
||||||
#ifdef HAVE_OSTREAM
|
#ifdef HAVE_OSTREAM
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#else
|
#else
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -20,40 +20,40 @@ using std::make_pair;
|
|||||||
struct LRegex::Impl {
|
struct LRegex::Impl {
|
||||||
///
|
///
|
||||||
regex_t * preg;
|
regex_t * preg;
|
||||||
|
|
||||||
///
|
///
|
||||||
int error_code;
|
int error_code;
|
||||||
|
|
||||||
///
|
///
|
||||||
mutable LRegex::SubMatches matches;
|
mutable LRegex::SubMatches matches;
|
||||||
|
|
||||||
///
|
///
|
||||||
Impl(string const & regex)
|
Impl(string const & regex)
|
||||||
: preg(new regex_t), error_code(0)
|
: preg(new regex_t), error_code(0)
|
||||||
{
|
{
|
||||||
error_code = regcomp(preg, regex.c_str(), REG_EXTENDED);
|
error_code = regcomp(preg, regex.c_str(), REG_EXTENDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
~Impl()
|
~Impl()
|
||||||
{
|
{
|
||||||
regfree(preg);
|
regfree(preg);
|
||||||
delete preg;
|
delete preg;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
bool exact_match(string const & str) const
|
bool exact_match(string const & str) const
|
||||||
{
|
{
|
||||||
regmatch_t tmp;
|
regmatch_t tmp;
|
||||||
if (!regexec(preg, str.c_str(), 1, &tmp, 0)) {
|
if (!regexec(preg, str.c_str(), 1, &tmp, 0)) {
|
||||||
if (tmp.rm_so == 0 &&
|
if (tmp.rm_so == 0 &&
|
||||||
tmp.rm_eo == static_cast<signed int>(str.length()))
|
tmp.rm_eo == static_cast<signed int>(str.length()))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// no match
|
// no match
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
LRegex::MatchPair const first_match(string const & str) const
|
LRegex::MatchPair const first_match(string const & str) const
|
||||||
{
|
{
|
||||||
@ -65,7 +65,7 @@ struct LRegex::Impl {
|
|||||||
tmp.rm_eo : string::npos;
|
tmp.rm_eo : string::npos;
|
||||||
return make_pair(first, second - first);
|
return make_pair(first, second - first);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
string const getError() const
|
string const getError() const
|
||||||
{
|
{
|
||||||
@ -76,7 +76,7 @@ struct LRegex::Impl {
|
|||||||
delete [] tmp;
|
delete [] tmp;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
LRegex::SubMatches const & exec(string const & str) const
|
LRegex::SubMatches const & exec(string const & str) const
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -13,7 +13,7 @@
|
|||||||
// Programming Language by Bjarne Stroustrup
|
// Programming Language by Bjarne Stroustrup
|
||||||
|
|
||||||
#ifndef LSUBSTRING_H
|
#ifndef LSUBSTRING_H
|
||||||
#define LSUBSTRING_H
|
#define LSUBSTRING_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2000-2001 Jean-Marc Lasgouttes
|
* Copyright 2000-2001 Jean-Marc Lasgouttes
|
||||||
*
|
*
|
||||||
* ======================================================*/
|
* ======================================================*/
|
||||||
@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
StrPool::~StrPool()
|
StrPool::~StrPool()
|
||||||
{
|
{
|
||||||
for (Pool::const_iterator cit = pool_.begin();
|
for (Pool::const_iterator cit = pool_.begin();
|
||||||
cit != pool_.end() ; ++cit) {
|
cit != pool_.end() ; ++cit) {
|
||||||
delete[] (*cit);
|
delete[] (*cit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One interesting thing here would be to store the strings in a map,
|
/* One interesting thing here would be to store the strings in a map,
|
||||||
@ -31,12 +31,11 @@ StrPool::~StrPool()
|
|||||||
char const * StrPool::add(string const & str)
|
char const * StrPool::add(string const & str)
|
||||||
{
|
{
|
||||||
string::size_type s = str.length();
|
string::size_type s = str.length();
|
||||||
char * buf = new char [s + 1];
|
char * buf = new char [s + 1];
|
||||||
str.copy(buf, s);
|
str.copy(buf, s);
|
||||||
buf[s] = '\0';
|
buf[s] = '\0';
|
||||||
pool_.push_back(buf);
|
pool_.push_back(buf);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
//StrPool strPool;
|
//StrPool strPool;
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 2000-2001 Jean-Marc Lasgouttes
|
* Copyright 2000-2001 Jean-Marc Lasgouttes
|
||||||
*
|
*
|
||||||
* ======================================================*/
|
* ======================================================*/
|
||||||
@ -22,16 +22,16 @@
|
|||||||
///
|
///
|
||||||
class StrPool {
|
class StrPool {
|
||||||
public:
|
public:
|
||||||
/// delete all the strings that have been allocated by add()
|
/// delete all the strings that have been allocated by add()
|
||||||
~StrPool();
|
~StrPool();
|
||||||
/// Make a copy of the string, and remember it in the pool
|
/// Make a copy of the string, and remember it in the pool
|
||||||
char const * add(string const & str);
|
char const * add(string const & str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
typedef std::vector<char const *> Pool;
|
typedef std::vector<char const *> Pool;
|
||||||
///
|
///
|
||||||
Pool pool_;
|
Pool pool_;
|
||||||
};
|
};
|
||||||
|
|
||||||
//extern StrPool strPool;
|
//extern StrPool strPool;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
filetools.C (former paths.C) - part of LyX project
|
filetools.C (former paths.C) - part of LyX project
|
||||||
General path-mangling functions
|
General path-mangling functions
|
||||||
Copyright 1996 Ivan Schreter
|
Copyright 1996 Ivan Schreter
|
||||||
Parts Copyright 1996 Dirk Niggemann
|
Parts Copyright 1996 Dirk Niggemann
|
||||||
Parts Copyright 1985, 1990, 1993 Free Software Foundation, Inc.
|
Parts Copyright 1985, 1990, 1993 Free Software Foundation, Inc.
|
||||||
Parts Copyright 1996 Asger Alstrup
|
Parts Copyright 1996 Asger Alstrup
|
||||||
|
|
||||||
See also filetools.h.
|
See also filetools.h.
|
||||||
|
|
||||||
lyx-filetool.C : tools functions for file/path handling
|
lyx-filetool.C : tools functions for file/path handling
|
||||||
@ -28,7 +28,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
@ -92,7 +92,7 @@ string const MakeLatexName(string const & file)
|
|||||||
{
|
{
|
||||||
string name = OnlyFilename(file);
|
string name = OnlyFilename(file);
|
||||||
string const path = OnlyPath(file);
|
string const path = OnlyPath(file);
|
||||||
|
|
||||||
for (string::size_type i = 0; i < name.length(); ++i) {
|
for (string::size_type i = 0; i < name.length(); ++i) {
|
||||||
name[i] &= 0x7f; // set 8th bit to 0
|
name[i] &= 0x7f; // set 8th bit to 0
|
||||||
};
|
};
|
||||||
@ -101,7 +101,7 @@ string const MakeLatexName(string const & file)
|
|||||||
string const keep("abcdefghijklmnopqrstuvwxyz"
|
string const keep("abcdefghijklmnopqrstuvwxyz"
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
"@!\"'()*+,-./0123456789:;<=>?[]`|");
|
"@!\"'()*+,-./0123456789:;<=>?[]`|");
|
||||||
|
|
||||||
string::size_type pos = 0;
|
string::size_type pos = 0;
|
||||||
while ((pos = name.find_first_not_of(keep, pos)) != string::npos) {
|
while ((pos = name.find_first_not_of(keep, pos)) != string::npos) {
|
||||||
name[pos++] = '_';
|
name[pos++] = '_';
|
||||||
@ -133,11 +133,11 @@ bool IsFileReadable (string const & path)
|
|||||||
// Is a file read_only?
|
// Is a file read_only?
|
||||||
// return 1 read-write
|
// return 1 read-write
|
||||||
// 0 read_only
|
// 0 read_only
|
||||||
// -1 error (doesn't exist, no access, anything else)
|
// -1 error (doesn't exist, no access, anything else)
|
||||||
int IsFileWriteable (string const & path)
|
int IsFileWriteable (string const & path)
|
||||||
{
|
{
|
||||||
FileInfo fi(path);
|
FileInfo fi(path);
|
||||||
|
|
||||||
if (fi.access(FileInfo::wperm|FileInfo::rperm)) // read-write
|
if (fi.access(FileInfo::wperm|FileInfo::rperm)) // read-write
|
||||||
return 1;
|
return 1;
|
||||||
if (fi.readable()) // read-only
|
if (fi.readable()) // read-only
|
||||||
@ -151,12 +151,12 @@ int IsFileWriteable (string const & path)
|
|||||||
bool IsDirWriteable (string const & path)
|
bool IsDirWriteable (string const & path)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::FILES] << "IsDirWriteable: " << path << endl;
|
lyxerr[Debug::FILES] << "IsDirWriteable: " << path << endl;
|
||||||
|
|
||||||
string const tmpfl(lyx::tempName(path, "lyxwritetest"));
|
string const tmpfl(lyx::tempName(path, "lyxwritetest"));
|
||||||
|
|
||||||
if (tmpfl.empty())
|
if (tmpfl.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
lyx::unlink(tmpfl);
|
lyx::unlink(tmpfl);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -167,22 +167,22 @@ bool IsDirWriteable (string const & path)
|
|||||||
// If path entry begins with $$LyX/, use system_lyxdir
|
// If path entry begins with $$LyX/, use system_lyxdir
|
||||||
// If path entry begins with $$User/, use user_lyxdir
|
// If path entry begins with $$User/, use user_lyxdir
|
||||||
// Example: "$$User/doc;$$LyX/doc"
|
// Example: "$$User/doc;$$LyX/doc"
|
||||||
string const FileOpenSearch (string const & path, string const & name,
|
string const FileOpenSearch (string const & path, string const & name,
|
||||||
string const & ext)
|
string const & ext)
|
||||||
{
|
{
|
||||||
string real_file, path_element;
|
string real_file, path_element;
|
||||||
bool notfound = true;
|
bool notfound = true;
|
||||||
string tmppath = split(path, path_element, ';');
|
string tmppath = split(path, path_element, ';');
|
||||||
|
|
||||||
while (notfound && !path_element.empty()) {
|
while (notfound && !path_element.empty()) {
|
||||||
path_element = os::slashify_path(path_element);
|
path_element = os::slashify_path(path_element);
|
||||||
if (!suffixIs(path_element, '/'))
|
if (!suffixIs(path_element, '/'))
|
||||||
path_element+= '/';
|
path_element+= '/';
|
||||||
path_element = subst(path_element, "$$LyX", system_lyxdir);
|
path_element = subst(path_element, "$$LyX", system_lyxdir);
|
||||||
path_element = subst(path_element, "$$User", user_lyxdir);
|
path_element = subst(path_element, "$$User", user_lyxdir);
|
||||||
|
|
||||||
real_file = FileSearch(path_element, name, ext);
|
real_file = FileSearch(path_element, name, ext);
|
||||||
|
|
||||||
if (real_file.empty()) {
|
if (real_file.empty()) {
|
||||||
do {
|
do {
|
||||||
tmppath = split(tmppath, path_element, ';');
|
tmppath = split(tmppath, path_element, ';');
|
||||||
@ -211,12 +211,12 @@ vector<string> const DirList(string const & dir, string const & ext)
|
|||||||
vector<string> dirlist;
|
vector<string> dirlist;
|
||||||
DIR * dirp = ::opendir(dir.c_str());
|
DIR * dirp = ::opendir(dir.c_str());
|
||||||
if (!dirp) {
|
if (!dirp) {
|
||||||
lyxerr[Debug::FILES]
|
lyxerr[Debug::FILES]
|
||||||
<< "Directory \"" << dir
|
<< "Directory \"" << dir
|
||||||
<< "\" does not exist to DirList." << endl;
|
<< "\" does not exist to DirList." << endl;
|
||||||
return dirlist;
|
return dirlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
dirent * dire;
|
dirent * dire;
|
||||||
while ((dire = ::readdir(dirp))) {
|
while ((dire = ::readdir(dirp))) {
|
||||||
string const fil = dire->d_name;
|
string const fil = dire->d_name;
|
||||||
@ -238,9 +238,9 @@ vector<string> const DirList(string const & dir, string const & ext)
|
|||||||
vector<string> dirlist;
|
vector<string> dirlist;
|
||||||
directory_iterator dit("dir");
|
directory_iterator dit("dir");
|
||||||
while (dit != directory_iterator()) {
|
while (dit != directory_iterator()) {
|
||||||
string fil = dit->filename;
|
string fil = dit->filename;
|
||||||
if (prefixIs(fil, extension)) {
|
if (prefixIs(fil, extension)) {
|
||||||
dirlist.push_back(fil);
|
dirlist.push_back(fil);
|
||||||
}
|
}
|
||||||
++dit;
|
++dit;
|
||||||
}
|
}
|
||||||
@ -251,8 +251,8 @@ vector<string> const DirList(string const & dir, string const & ext)
|
|||||||
|
|
||||||
|
|
||||||
// Returns the real name of file name in directory path, with optional
|
// Returns the real name of file name in directory path, with optional
|
||||||
// extension ext.
|
// extension ext.
|
||||||
string const FileSearch(string const & path, string const & name,
|
string const FileSearch(string const & path, string const & name,
|
||||||
string const & ext)
|
string const & ext)
|
||||||
{
|
{
|
||||||
// if `name' is an absolute path, we ignore the setting of `path'
|
// if `name' is an absolute path, we ignore the setting of `path'
|
||||||
@ -262,14 +262,14 @@ string const FileSearch(string const & path, string const & name,
|
|||||||
// search first without extension, then with it.
|
// search first without extension, then with it.
|
||||||
if (IsFileReadable(fullname))
|
if (IsFileReadable(fullname))
|
||||||
return fullname;
|
return fullname;
|
||||||
else if (ext.empty())
|
else if (ext.empty())
|
||||||
return string();
|
return string();
|
||||||
else { // Is it not more reasonable to use ChangeExtension()? (SMiyata)
|
else { // Is it not more reasonable to use ChangeExtension()? (SMiyata)
|
||||||
fullname += '.';
|
fullname += '.';
|
||||||
fullname += ext;
|
fullname += ext;
|
||||||
if (IsFileReadable(fullname))
|
if (IsFileReadable(fullname))
|
||||||
return fullname;
|
return fullname;
|
||||||
else
|
else
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -279,28 +279,28 @@ string const FileSearch(string const & path, string const & name,
|
|||||||
// 1) user_lyxdir
|
// 1) user_lyxdir
|
||||||
// 2) build_lyxdir (if not empty)
|
// 2) build_lyxdir (if not empty)
|
||||||
// 3) system_lyxdir
|
// 3) system_lyxdir
|
||||||
string const LibFileSearch(string const & dir, string const & name,
|
string const LibFileSearch(string const & dir, string const & name,
|
||||||
string const & ext)
|
string const & ext)
|
||||||
{
|
{
|
||||||
string fullname = FileSearch(AddPath(user_lyxdir, dir), name, ext);
|
string fullname = FileSearch(AddPath(user_lyxdir, dir), name, ext);
|
||||||
if (!fullname.empty())
|
if (!fullname.empty())
|
||||||
return fullname;
|
return fullname;
|
||||||
|
|
||||||
if (!build_lyxdir.empty())
|
if (!build_lyxdir.empty())
|
||||||
fullname = FileSearch(AddPath(build_lyxdir, dir), name, ext);
|
fullname = FileSearch(AddPath(build_lyxdir, dir), name, ext);
|
||||||
if (!fullname.empty())
|
if (!fullname.empty())
|
||||||
return fullname;
|
return fullname;
|
||||||
|
|
||||||
return FileSearch(AddPath(system_lyxdir, dir), name, ext);
|
return FileSearch(AddPath(system_lyxdir, dir), name, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const
|
string const
|
||||||
i18nLibFileSearch(string const & dir, string const & name,
|
i18nLibFileSearch(string const & dir, string const & name,
|
||||||
string const & ext)
|
string const & ext)
|
||||||
{
|
{
|
||||||
// this comment is from intl/dcigettext.c. We try to mimick this
|
// this comment is from intl/dcigettext.c. We try to mimick this
|
||||||
// behaviour here.
|
// behaviour here.
|
||||||
/* The highest priority value is the `LANGUAGE' environment
|
/* The highest priority value is the `LANGUAGE' environment
|
||||||
variable. But we don't use the value if the currently
|
variable. But we don't use the value if the currently
|
||||||
selected locale is the C locale. This is a GNU extension. */
|
selected locale is the C locale. This is a GNU extension. */
|
||||||
@ -313,9 +313,9 @@ i18nLibFileSearch(string const & dir, string const & name,
|
|||||||
lang = GetEnv("LANG");
|
lang = GetEnv("LANG");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lang = token(lang, '_', 0);
|
lang = token(lang, '_', 0);
|
||||||
|
|
||||||
if (lang.empty() || lang == "C")
|
if (lang.empty() || lang == "C")
|
||||||
return LibFileSearch(dir, name, ext);
|
return LibFileSearch(dir, name, ext);
|
||||||
else {
|
else {
|
||||||
@ -356,7 +356,7 @@ bool PutEnv(string const & envstr)
|
|||||||
|
|
||||||
#if HAVE_PUTENV
|
#if HAVE_PUTENV
|
||||||
// this leaks, but what can we do about it?
|
// this leaks, but what can we do about it?
|
||||||
// Is doing a getenv() and a free() of the older value
|
// Is doing a getenv() and a free() of the older value
|
||||||
// a good idea? (JMarc)
|
// a good idea? (JMarc)
|
||||||
// Actually we don't have to leak...calling putenv like this
|
// Actually we don't have to leak...calling putenv like this
|
||||||
// should be enough: ... and this is obviously not enough if putenv
|
// should be enough: ... and this is obviously not enough if putenv
|
||||||
@ -377,7 +377,7 @@ bool PutEnv(string const & envstr)
|
|||||||
// I will enable the above.
|
// I will enable the above.
|
||||||
//int retval = lyx::putenv(envstr.c_str());
|
//int retval = lyx::putenv(envstr.c_str());
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_SETENV
|
#ifdef HAVE_SETENV
|
||||||
string varname;
|
string varname;
|
||||||
string const str = envstr.split(varname,'=');
|
string const str = envstr.split(varname,'=');
|
||||||
int const retval = ::setenv(varname.c_str(), str.c_str(), true);
|
int const retval = ::setenv(varname.c_str(), str.c_str(), true);
|
||||||
@ -429,11 +429,11 @@ int DeleteAllFilesInDir (string const & path)
|
|||||||
int return_value = 0;
|
int return_value = 0;
|
||||||
while ((de = readdir(dir))) {
|
while ((de = readdir(dir))) {
|
||||||
string const temp = de->d_name;
|
string const temp = de->d_name;
|
||||||
if (temp == "." || temp == "..")
|
if (temp == "." || temp == "..")
|
||||||
continue;
|
continue;
|
||||||
string const unlinkpath = AddName (path, temp);
|
string const unlinkpath = AddName (path, temp);
|
||||||
|
|
||||||
lyxerr[Debug::FILES] << "Deleting file: " << unlinkpath
|
lyxerr[Debug::FILES] << "Deleting file: " << unlinkpath
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
bool deleted = true;
|
bool deleted = true;
|
||||||
@ -441,12 +441,12 @@ int DeleteAllFilesInDir (string const & path)
|
|||||||
if (fi.isOK() && fi.isDir())
|
if (fi.isOK() && fi.isDir())
|
||||||
deleted = (DeleteAllFilesInDir(unlinkpath) == 0);
|
deleted = (DeleteAllFilesInDir(unlinkpath) == 0);
|
||||||
deleted &= (lyx::unlink(unlinkpath) == 0);
|
deleted &= (lyx::unlink(unlinkpath) == 0);
|
||||||
if (!deleted) {
|
if (!deleted) {
|
||||||
Alert::err_alert(_("Error! Could not remove file:"),
|
Alert::err_alert(_("Error! Could not remove file:"),
|
||||||
unlinkpath);
|
unlinkpath);
|
||||||
return_value = -1;
|
return_value = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
@ -457,14 +457,14 @@ string const CreateTmpDir(string const & tempdir, string const & mask)
|
|||||||
lyxerr[Debug::FILES]
|
lyxerr[Debug::FILES]
|
||||||
<< "CreateTmpDir: tempdir=`" << tempdir << "'\n"
|
<< "CreateTmpDir: tempdir=`" << tempdir << "'\n"
|
||||||
<< "CreateTmpDir: mask=`" << mask << "'" << endl;
|
<< "CreateTmpDir: mask=`" << mask << "'" << endl;
|
||||||
|
|
||||||
string const tmpfl(lyx::tempName(tempdir, mask));
|
string const tmpfl(lyx::tempName(tempdir, mask));
|
||||||
// lyx::tempName actually creates a file to make sure that it
|
// lyx::tempName actually creates a file to make sure that it
|
||||||
// stays unique. So we have to delete it before we can create
|
// stays unique. So we have to delete it before we can create
|
||||||
// a dir with the same name. Note also that we are not thread
|
// a dir with the same name. Note also that we are not thread
|
||||||
// safe because of the gap between unlink and mkdir. (Lgb)
|
// safe because of the gap between unlink and mkdir. (Lgb)
|
||||||
lyx::unlink(tmpfl.c_str());
|
lyx::unlink(tmpfl.c_str());
|
||||||
|
|
||||||
if (tmpfl.empty() || lyx::mkdir(tmpfl, 0700)) {
|
if (tmpfl.empty() || lyx::mkdir(tmpfl, 0700)) {
|
||||||
Alert::err_alert(_("Error! Couldn't create temporary directory:"),
|
Alert::err_alert(_("Error! Couldn't create temporary directory:"),
|
||||||
tempdir);
|
tempdir);
|
||||||
@ -482,12 +482,12 @@ int DestroyTmpDir(string const & tmpdir, bool Allfiles)
|
|||||||
if (Allfiles && DeleteAllFilesInDir(tmpdir)) {
|
if (Allfiles && DeleteAllFilesInDir(tmpdir)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (lyx::rmdir(tmpdir)) {
|
if (lyx::rmdir(tmpdir)) {
|
||||||
Alert::err_alert(_("Error! Couldn't delete temporary directory:"),
|
Alert::err_alert(_("Error! Couldn't delete temporary directory:"),
|
||||||
tmpdir);
|
tmpdir);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace anon
|
} // namespace anon
|
||||||
@ -594,7 +594,7 @@ string const MakeAbsPath(string const & RelPath, string const & BasePath)
|
|||||||
TempBase = BasePath;
|
TempBase = BasePath;
|
||||||
else
|
else
|
||||||
TempBase = AddPath(lyx::getcwd(), BasePath);
|
TempBase = AddPath(lyx::getcwd(), BasePath);
|
||||||
|
|
||||||
// Handle /./ at the end of the path
|
// Handle /./ at the end of the path
|
||||||
while (suffixIs(TempBase, "/./"))
|
while (suffixIs(TempBase, "/./"))
|
||||||
TempBase.erase(TempBase.length() - 2);
|
TempBase.erase(TempBase.length() - 2);
|
||||||
@ -606,7 +606,7 @@ string const MakeAbsPath(string const & RelPath, string const & BasePath)
|
|||||||
while (!RTemp.empty()) {
|
while (!RTemp.empty()) {
|
||||||
// Split by next /
|
// Split by next /
|
||||||
RTemp = split(RTemp, Temp, '/');
|
RTemp = split(RTemp, Temp, '/');
|
||||||
|
|
||||||
if (Temp == ".") continue;
|
if (Temp == ".") continue;
|
||||||
if (Temp == "..") {
|
if (Temp == "..") {
|
||||||
// Remove one level of TempBase
|
// Remove one level of TempBase
|
||||||
@ -729,7 +729,7 @@ string const NormalizePath(string const & path)
|
|||||||
while (!RTemp.empty()) {
|
while (!RTemp.empty()) {
|
||||||
// Split by next /
|
// Split by next /
|
||||||
RTemp = split(RTemp, Temp, '/');
|
RTemp = split(RTemp, Temp, '/');
|
||||||
|
|
||||||
if (Temp == ".") {
|
if (Temp == ".") {
|
||||||
TempBase = "./";
|
TempBase = "./";
|
||||||
} else if (Temp == "..") {
|
} else if (Temp == "..") {
|
||||||
@ -747,7 +747,7 @@ string const NormalizePath(string const & path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns absolute path
|
// returns absolute path
|
||||||
return TempBase;
|
return TempBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -771,24 +771,24 @@ string const GetFileContents(string const & fname)
|
|||||||
//
|
//
|
||||||
// Search ${...} as Variable-Name inside the string and replace it with
|
// Search ${...} as Variable-Name inside the string and replace it with
|
||||||
// the denoted environmentvariable
|
// the denoted environmentvariable
|
||||||
// Allow Variables according to
|
// Allow Variables according to
|
||||||
// variable := '$' '{' [A-Za-z_]{[A-Za-z_0-9]*} '}'
|
// variable := '$' '{' [A-Za-z_]{[A-Za-z_0-9]*} '}'
|
||||||
//
|
//
|
||||||
|
|
||||||
string const ReplaceEnvironmentPath(string const & path)
|
string const ReplaceEnvironmentPath(string const & path)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// CompareChar: Environmentvariables starts with this character
|
// CompareChar: Environmentvariables starts with this character
|
||||||
// PathChar: Next path component start with this character
|
// PathChar: Next path component start with this character
|
||||||
// while CompareChar found do:
|
// while CompareChar found do:
|
||||||
// Split String with PathChar
|
// Split String with PathChar
|
||||||
// Search Environmentvariable
|
// Search Environmentvariable
|
||||||
// if found: Replace Strings
|
// if found: Replace Strings
|
||||||
//
|
//
|
||||||
char const CompareChar = '$';
|
char const CompareChar = '$';
|
||||||
char const FirstChar = '{';
|
char const FirstChar = '{';
|
||||||
char const EndChar = '}';
|
char const EndChar = '}';
|
||||||
char const UnderscoreChar = '_';
|
char const UnderscoreChar = '_';
|
||||||
string EndString; EndString += EndChar;
|
string EndString; EndString += EndChar;
|
||||||
string FirstString; FirstString += FirstChar;
|
string FirstString; FirstString += FirstChar;
|
||||||
string CompareString; CompareString += CompareChar;
|
string CompareString; CompareString += CompareChar;
|
||||||
@ -800,9 +800,9 @@ string const ReplaceEnvironmentPath(string const & path)
|
|||||||
string result0 = split(path, result1, CompareChar);
|
string result0 = split(path, result1, CompareChar);
|
||||||
while (!result0.empty()) {
|
while (!result0.empty()) {
|
||||||
string copy1(result0); // contains String after $
|
string copy1(result0); // contains String after $
|
||||||
|
|
||||||
// Check, if there is an EndChar inside original String.
|
// Check, if there is an EndChar inside original String.
|
||||||
|
|
||||||
if (!regexMatch(copy1, RegExp)) {
|
if (!regexMatch(copy1, RegExp)) {
|
||||||
// No EndChar inside. So we are finished
|
// No EndChar inside. So we are finished
|
||||||
result1 += CompareString + result0;
|
result1 += CompareString + result0;
|
||||||
@ -833,8 +833,8 @@ string const ReplaceEnvironmentPath(string const & path)
|
|||||||
bool result = isalpha(*cp1) || (*cp1 == UnderscoreChar);
|
bool result = isalpha(*cp1) || (*cp1 == UnderscoreChar);
|
||||||
++cp1;
|
++cp1;
|
||||||
while (*cp1 && result) {
|
while (*cp1 && result) {
|
||||||
result = isalnum(*cp1) ||
|
result = isalnum(*cp1) ||
|
||||||
(*cp1 == UnderscoreChar);
|
(*cp1 == UnderscoreChar);
|
||||||
++cp1;
|
++cp1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,7 +845,7 @@ string const ReplaceEnvironmentPath(string const & path)
|
|||||||
result1 += res1;
|
result1 += res1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
string env(GetEnv(res1_contents + 1));
|
string env(GetEnv(res1_contents + 1));
|
||||||
if (!env.empty()) {
|
if (!env.empty()) {
|
||||||
// Congratulations. Environmentvariable found
|
// Congratulations. Environmentvariable found
|
||||||
@ -856,7 +856,7 @@ string const ReplaceEnvironmentPath(string const & path)
|
|||||||
// Next $-Sign?
|
// Next $-Sign?
|
||||||
result0 = split(res0, res1, CompareChar);
|
result0 = split(res0, res1, CompareChar);
|
||||||
result1 += res1;
|
result1 += res1;
|
||||||
}
|
}
|
||||||
return result1;
|
return result1;
|
||||||
} // ReplaceEnvironmentPath
|
} // ReplaceEnvironmentPath
|
||||||
|
|
||||||
@ -919,7 +919,7 @@ string const AddPath(string const & path, string const & path_2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!path2.empty()) {
|
if (!path2.empty()) {
|
||||||
string::size_type const p2start = path2.find_first_not_of('/');
|
string::size_type const p2start = path2.find_first_not_of('/');
|
||||||
string::size_type const p2end = path2.find_last_not_of('/');
|
string::size_type const p2end = path2.find_last_not_of('/');
|
||||||
string const tmp = path2.substr(p2start, p2end - p2start + 1);
|
string const tmp = path2.substr(p2start, p2end - p2start + 1);
|
||||||
buf += tmp + '/';
|
buf += tmp + '/';
|
||||||
@ -928,7 +928,7 @@ string const AddPath(string const & path, string const & path_2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Change extension of oldname to extension.
|
Change extension of oldname to extension.
|
||||||
Strips path off if no_path == true.
|
Strips path off if no_path == true.
|
||||||
If no extension on oldname, just appends.
|
If no extension on oldname, just appends.
|
||||||
@ -939,7 +939,7 @@ string const ChangeExtension(string const & oldname, string const & extension)
|
|||||||
string::size_type last_dot = oldname.rfind('.');
|
string::size_type last_dot = oldname.rfind('.');
|
||||||
if (last_dot < last_slash && last_slash != string::npos)
|
if (last_dot < last_slash && last_slash != string::npos)
|
||||||
last_dot = string::npos;
|
last_dot = string::npos;
|
||||||
|
|
||||||
string ext;
|
string ext;
|
||||||
// Make sure the extension starts with a dot
|
// Make sure the extension starts with a dot
|
||||||
if (!extension.empty() && extension[0] != '.')
|
if (!extension.empty() && extension[0] != '.')
|
||||||
@ -965,7 +965,7 @@ string const GetExtension(string const & name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// the different filetypes and what they contain in one of the first lines
|
// the different filetypes and what they contain in one of the first lines
|
||||||
// (dots are any characters). (Herbert 20020131)
|
// (dots are any characters). (Herbert 20020131)
|
||||||
// AGR Grace...
|
// AGR Grace...
|
||||||
// BMP BM...
|
// BMP BM...
|
||||||
// EPS %!PS-Adobe-3.0 EPSF...
|
// EPS %!PS-Adobe-3.0 EPSF...
|
||||||
@ -974,9 +974,9 @@ string const GetExtension(string const & name)
|
|||||||
// JPG JFIF
|
// JPG JFIF
|
||||||
// PDF %PDF-...
|
// PDF %PDF-...
|
||||||
// PNG .PNG...
|
// PNG .PNG...
|
||||||
// PBM P1... or P4 (B/W)
|
// PBM P1... or P4 (B/W)
|
||||||
// PGM P2... or P5 (Grayscale)
|
// PGM P2... or P5 (Grayscale)
|
||||||
// PPM P3... or P6 (color)
|
// PPM P3... or P6 (color)
|
||||||
// PS %!PS-Adobe-2.0 or 1.0, no "EPSF"!
|
// PS %!PS-Adobe-2.0 or 1.0, no "EPSF"!
|
||||||
// SGI \001\332... (decimal 474)
|
// SGI \001\332... (decimal 474)
|
||||||
// TGIF %TGIF...
|
// TGIF %TGIF...
|
||||||
@ -996,7 +996,7 @@ string const getExtFromContents(string const & filename) {
|
|||||||
if (filename.empty() || !IsFileReadable(filename))
|
if (filename.empty() || !IsFileReadable(filename))
|
||||||
// paranoia check
|
// paranoia check
|
||||||
return string();
|
return string();
|
||||||
|
|
||||||
ifstream ifs(filename.c_str());
|
ifstream ifs(filename.c_str());
|
||||||
if (!ifs)
|
if (!ifs)
|
||||||
// Couldn't open file...
|
// Couldn't open file...
|
||||||
@ -1068,7 +1068,7 @@ string const getExtFromContents(string const & filename) {
|
|||||||
format = "ppm";
|
format = "ppm";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (stamp == "\001\332")
|
if (stamp == "\001\332")
|
||||||
format = "sgi";
|
format = "sgi";
|
||||||
else if ((stamp == "II") || (stamp == "MM"))
|
else if ((stamp == "II") || (stamp == "MM"))
|
||||||
@ -1120,20 +1120,20 @@ string const getExtFromContents(string const & filename) {
|
|||||||
else if (contains(str,"BITPIX"))
|
else if (contains(str,"BITPIX"))
|
||||||
format = "fits";
|
format = "fits";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!format.empty()) {
|
if (!format.empty()) {
|
||||||
lyxerr[Debug::GRAPHICS]
|
lyxerr[Debug::GRAPHICS]
|
||||||
<< "Recognised Fileformat: " << format << endl;
|
<< "Recognised Fileformat: " << format << endl;
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
||||||
string const ext(GetExtension(filename));
|
string const ext(GetExtension(filename));
|
||||||
lyxerr[Debug::GRAPHICS]
|
lyxerr[Debug::GRAPHICS]
|
||||||
<< "filetools(getExtFromContents)\n"
|
<< "filetools(getExtFromContents)\n"
|
||||||
<< "\tCouldn't find a known Type!\n";
|
<< "\tCouldn't find a known Type!\n";
|
||||||
if (!ext.empty()) {
|
if (!ext.empty()) {
|
||||||
lyxerr[Debug::GRAPHICS]
|
lyxerr[Debug::GRAPHICS]
|
||||||
<< "\twill take the file extension -> "
|
<< "\twill take the file extension -> "
|
||||||
<< ext << endl;
|
<< ext << endl;
|
||||||
return ext;
|
return ext;
|
||||||
} else {
|
} else {
|
||||||
@ -1196,9 +1196,9 @@ MakeDisplayPath (string const & path, unsigned int threshold)
|
|||||||
if (l2 > threshold) {
|
if (l2 > threshold) {
|
||||||
// Yes, shortend it
|
// Yes, shortend it
|
||||||
prefix += ".../";
|
prefix += ".../";
|
||||||
|
|
||||||
string temp;
|
string temp;
|
||||||
|
|
||||||
while (relhome.length() > threshold)
|
while (relhome.length() > threshold)
|
||||||
relhome = split(relhome, temp, '/');
|
relhome = split(relhome, temp, '/');
|
||||||
|
|
||||||
@ -1250,7 +1250,7 @@ cmdret const do_popen(string const & cmd)
|
|||||||
// (Claus Hentschel) Check if popen was succesful ;-)
|
// (Claus Hentschel) Check if popen was succesful ;-)
|
||||||
if (!inf)
|
if (!inf)
|
||||||
return make_pair(-1, string());
|
return make_pair(-1, string());
|
||||||
|
|
||||||
string ret;
|
string ret;
|
||||||
int c = fgetc(inf);
|
int c = fgetc(inf);
|
||||||
while (c != EOF) {
|
while (c != EOF) {
|
||||||
@ -1274,13 +1274,13 @@ string const findtexfile(string const & fil, string const & /*format*/)
|
|||||||
going to implement this until I see some demand for it.
|
going to implement this until I see some demand for it.
|
||||||
Lgb
|
Lgb
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// If the file can be found directly, we just return a
|
// If the file can be found directly, we just return a
|
||||||
// absolute path version of it.
|
// absolute path version of it.
|
||||||
if (FileInfo(fil).exist())
|
if (FileInfo(fil).exist())
|
||||||
return MakeAbsPath(fil);
|
return MakeAbsPath(fil);
|
||||||
|
|
||||||
// No we try to find it using kpsewhich.
|
// No we try to find it using kpsewhich.
|
||||||
// It seems from the kpsewhich manual page that it is safe to use
|
// It seems from the kpsewhich manual page that it is safe to use
|
||||||
// kpsewhich without --format: "When the --format option is not
|
// kpsewhich without --format: "When the --format option is not
|
||||||
// given, the search path used when looking for a file is inferred
|
// given, the search path used when looking for a file is inferred
|
||||||
@ -1305,9 +1305,9 @@ string const findtexfile(string const & fil, string const & /*format*/)
|
|||||||
cmdret const c = do_popen(kpsecmd);
|
cmdret const c = do_popen(kpsecmd);
|
||||||
|
|
||||||
lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n"
|
lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n"
|
||||||
<< "kpse result = `" << strip(c.second, '\n')
|
<< "kpse result = `" << strip(c.second, '\n')
|
||||||
<< "'" << endl;
|
<< "'" << endl;
|
||||||
if (c.first != -1)
|
if (c.first != -1)
|
||||||
return os::internal_path(strip(strip(c.second, '\n'), '\r'));
|
return os::internal_path(strip(strip(c.second, '\n'), '\r'));
|
||||||
else
|
else
|
||||||
return string();
|
return string();
|
||||||
@ -1327,5 +1327,3 @@ void removeAutosaveFile(string const & filename)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ int DestroyLyXTmpDir (string const & tmpdir);
|
|||||||
If path entry begins with $$User/, use user_lyxdir.
|
If path entry begins with $$User/, use user_lyxdir.
|
||||||
Example: "$$User/doc;$$LyX/doc".
|
Example: "$$User/doc;$$LyX/doc".
|
||||||
*/
|
*/
|
||||||
string const FileOpenSearch (string const & path, string const & name,
|
string const FileOpenSearch (string const & path, string const & name,
|
||||||
string const & ext = string());
|
string const & ext = string());
|
||||||
|
|
||||||
/** Returns the real name of file name in directory path, with optional
|
/** Returns the real name of file name in directory path, with optional
|
||||||
@ -45,7 +45,7 @@ string const FileOpenSearch (string const & path, string const & name,
|
|||||||
The file is searched in the given path (unless it is an absolute
|
The file is searched in the given path (unless it is an absolute
|
||||||
file name), first directly, and then with extension .ext (if given).
|
file name), first directly, and then with extension .ext (if given).
|
||||||
*/
|
*/
|
||||||
string const FileSearch(string const & path, string const & name,
|
string const FileSearch(string const & path, string const & name,
|
||||||
string const & ext = string());
|
string const & ext = string());
|
||||||
|
|
||||||
/// Returns a vector of all files in directory dir having extension ext.
|
/// Returns a vector of all files in directory dir having extension ext.
|
||||||
@ -53,7 +53,7 @@ std::vector<string> const DirList(string const & dir,
|
|||||||
string const & ext = string());
|
string const & ext = string());
|
||||||
|
|
||||||
/** Is directory read only?
|
/** Is directory read only?
|
||||||
returns
|
returns
|
||||||
true: dir writeable
|
true: dir writeable
|
||||||
false: not writeable
|
false: not writeable
|
||||||
*/
|
*/
|
||||||
@ -87,15 +87,15 @@ bool IsSGMLFilename(string const & filename);
|
|||||||
\end{enumerate}
|
\end{enumerate}
|
||||||
The third parameter `ext' is optional.
|
The third parameter `ext' is optional.
|
||||||
*/
|
*/
|
||||||
string const LibFileSearch(string const & dir, string const & name,
|
string const LibFileSearch(string const & dir, string const & name,
|
||||||
string const & ext = string());
|
string const & ext = string());
|
||||||
|
|
||||||
/** Same as LibFileSearch(), but tries first to find an
|
/** Same as LibFileSearch(), but tries first to find an
|
||||||
internationalized version of the file by prepending $LANG_ to the
|
internationalized version of the file by prepending $LANG_ to the
|
||||||
name
|
name
|
||||||
*/
|
*/
|
||||||
string const
|
string const
|
||||||
i18nLibFileSearch(string const & dir, string const & name,
|
i18nLibFileSearch(string const & dir, string const & name,
|
||||||
string const & ext = string());
|
string const & ext = string());
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -151,7 +151,7 @@ string const ExpandPath(string const & path);
|
|||||||
If relpath is absolute, just use that.
|
If relpath is absolute, just use that.
|
||||||
If basepath doesn't exist use CWD.
|
If basepath doesn't exist use CWD.
|
||||||
*/
|
*/
|
||||||
string const MakeAbsPath(string const & RelPath = string(),
|
string const MakeAbsPath(string const & RelPath = string(),
|
||||||
string const & BasePath = string());
|
string const & BasePath = string());
|
||||||
|
|
||||||
/** Creates a nice compact path for displaying. The parameter
|
/** Creates a nice compact path for displaying. The parameter
|
||||||
|
@ -26,7 +26,7 @@ using std::va_list;
|
|||||||
glibc returns the needed size.
|
glibc returns the needed size.
|
||||||
One problem can be that vsnprintf is not implemented on all archs,
|
One problem can be that vsnprintf is not implemented on all archs,
|
||||||
but AFAIK it is part of the new ANSI C standard.
|
but AFAIK it is part of the new ANSI C standard.
|
||||||
|
|
||||||
Lgb
|
Lgb
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ int Forkedcall::startscript(Starttype wait, string const & what)
|
|||||||
} else {
|
} else {
|
||||||
retval_ = waitForChild();
|
retval_ = waitForChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval_;
|
return retval_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,13 +197,13 @@ int Forkedcall::waitForChild() {
|
|||||||
wait = false;
|
wait = false;
|
||||||
} else if (WIFSIGNALED(status)) {
|
} else if (WIFSIGNALED(status)) {
|
||||||
lyxerr << "LyX: Child didn't catch signal "
|
lyxerr << "LyX: Child didn't catch signal "
|
||||||
<< WTERMSIG(status)
|
<< WTERMSIG(status)
|
||||||
<< "and died. Too bad." << endl;
|
<< "and died. Too bad." << endl;
|
||||||
wait = false;
|
wait = false;
|
||||||
} else if (WIFSTOPPED(status)) {
|
} else if (WIFSTOPPED(status)) {
|
||||||
lyxerr << "LyX: Child (pid: " << pid_
|
lyxerr << "LyX: Child (pid: " << pid_
|
||||||
<< ") stopped on signal "
|
<< ") stopped on signal "
|
||||||
<< WSTOPSIG(status)
|
<< WSTOPSIG(status)
|
||||||
<< ". Waiting for child to finish." << endl;
|
<< ". Waiting for child to finish." << endl;
|
||||||
} else {
|
} else {
|
||||||
lyxerr << "LyX: Something rotten happened while "
|
lyxerr << "LyX: Something rotten happened while "
|
||||||
@ -219,7 +219,7 @@ int Forkedcall::waitForChild() {
|
|||||||
pid_t Forkedcall::generateChild()
|
pid_t Forkedcall::generateChild()
|
||||||
{
|
{
|
||||||
const int MAX_ARGV = 255;
|
const int MAX_ARGV = 255;
|
||||||
char *syscmd = 0;
|
char *syscmd = 0;
|
||||||
char *argv[MAX_ARGV];
|
char *argv[MAX_ARGV];
|
||||||
|
|
||||||
string childcommand(command_); // copy
|
string childcommand(command_); // copy
|
||||||
@ -243,7 +243,7 @@ pid_t Forkedcall::generateChild()
|
|||||||
|
|
||||||
// reinit
|
// reinit
|
||||||
more = !rest.empty();
|
more = !rest.empty();
|
||||||
if (more)
|
if (more)
|
||||||
rest = split(rest, childcommand, ' ');
|
rest = split(rest, childcommand, ' ');
|
||||||
}
|
}
|
||||||
argv[index] = 0;
|
argv[index] = 0;
|
||||||
|
@ -43,10 +43,10 @@ public:
|
|||||||
///
|
///
|
||||||
DontWait
|
DontWait
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
Forkedcall();
|
Forkedcall();
|
||||||
|
|
||||||
/** Start the child process.
|
/** Start the child process.
|
||||||
*
|
*
|
||||||
* The command "what" is passed to fork() for execution.
|
* The command "what" is passed to fork() for execution.
|
||||||
@ -94,7 +94,7 @@ public:
|
|||||||
* Used by the timer.
|
* Used by the timer.
|
||||||
*/
|
*/
|
||||||
pid_t pid() const { return pid_; }
|
pid_t pid() const { return pid_; }
|
||||||
|
|
||||||
/** Emit the signal.
|
/** Emit the signal.
|
||||||
* Used by the timer.
|
* Used by the timer.
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* \author Asger Alstrup Nielsen
|
* \author Asger Alstrup Nielsen
|
||||||
* \author Angus Leeming
|
* \author Angus Leeming
|
||||||
*
|
*
|
||||||
* A class for the control of child processes launched using
|
* A class for the control of child processes launched using
|
||||||
* fork() and execvp().
|
* fork() and execvp().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ ForkedcallsController & ForkedcallsController::get()
|
|||||||
ForkedcallsController::ForkedcallsController()
|
ForkedcallsController::ForkedcallsController()
|
||||||
{
|
{
|
||||||
timeout_ = new Timeout(100, Timeout::ONETIME);
|
timeout_ = new Timeout(100, Timeout::ONETIME);
|
||||||
|
|
||||||
timeout_->timeout
|
timeout_->timeout
|
||||||
.connect(SigC::slot(this, &ForkedcallsController::timer));
|
.connect(SigC::slot(this, &ForkedcallsController::timer));
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ void ForkedcallsController::timer()
|
|||||||
bool remove_it = false;
|
bool remove_it = false;
|
||||||
|
|
||||||
if (waitrpid == -1) {
|
if (waitrpid == -1) {
|
||||||
lyxerr << "LyX: Error waiting for child: "
|
lyxerr << "LyX: Error waiting for child: "
|
||||||
<< strerror(errno) << endl;
|
<< strerror(errno) << endl;
|
||||||
|
|
||||||
// Child died, so pretend it returned 1
|
// Child died, so pretend it returned 1
|
||||||
@ -116,9 +116,9 @@ void ForkedcallsController::timer()
|
|||||||
remove_it = true;
|
remove_it = true;
|
||||||
|
|
||||||
} else if (WIFSTOPPED(stat_loc)) {
|
} else if (WIFSTOPPED(stat_loc)) {
|
||||||
lyxerr << "LyX: Child (pid: " << pid
|
lyxerr << "LyX: Child (pid: " << pid
|
||||||
<< ") stopped on signal "
|
<< ") stopped on signal "
|
||||||
<< WSTOPSIG(stat_loc)
|
<< WSTOPSIG(stat_loc)
|
||||||
<< ". Waiting for child to finish." << endl;
|
<< ". Waiting for child to finish." << endl;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
~ForkedcallsController();
|
~ForkedcallsController();
|
||||||
|
|
||||||
/// Get hold of the only controller that can exist inside the process.
|
/// Get hold of the only controller that can exist inside the process.
|
||||||
static ForkedcallsController & get();
|
static ForkedcallsController & get();
|
||||||
|
|
||||||
/// Add a new child process to the list of controlled processes.
|
/// Add a new child process to the list of controlled processes.
|
||||||
void addCall(Forkedcall const & newcall);
|
void addCall(Forkedcall const & newcall);
|
||||||
@ -63,7 +63,7 @@ public:
|
|||||||
|
|
||||||
/// Signal emitted when the list of current child processes changes.
|
/// Signal emitted when the list of current child processes changes.
|
||||||
SigC::Signal0<void> childrenChanged;
|
SigC::Signal0<void> childrenChanged;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
ForkedcallsController(ForkedcallsController const &);
|
ForkedcallsController(ForkedcallsController const &);
|
||||||
@ -76,7 +76,7 @@ private:
|
|||||||
/** The timer. Enables us to check the status of the children
|
/** The timer. Enables us to check the status of the children
|
||||||
* every XX ms and to invoke a callback on completion.
|
* every XX ms and to invoke a callback on completion.
|
||||||
*/
|
*/
|
||||||
Timeout * timeout_;
|
Timeout * timeout_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FORKEDCONTR_H
|
#endif // FORKEDCONTR_H
|
||||||
|
@ -23,17 +23,17 @@ char * l_getcwd(char * buffer, size_t size)
|
|||||||
// Returns current working directory
|
// Returns current working directory
|
||||||
string const lyx::getcwd()
|
string const lyx::getcwd()
|
||||||
{
|
{
|
||||||
int n = 256; // Assume path is less than 256 chars
|
int n = 256; // Assume path is less than 256 chars
|
||||||
char * err;
|
char * err;
|
||||||
char * tbuf = new char[n];
|
char * tbuf = new char[n];
|
||||||
|
|
||||||
// Safe. Hopefully all getcwds behave this way!
|
// Safe. Hopefully all getcwds behave this way!
|
||||||
while (((err = l_getcwd(tbuf, n)) == 0) && (errno == ERANGE)) {
|
while (((err = l_getcwd(tbuf, n)) == 0) && (errno == ERANGE)) {
|
||||||
// Buffer too small, double the buffersize and try again
|
// Buffer too small, double the buffersize and try again
|
||||||
delete[] tbuf;
|
delete[] tbuf;
|
||||||
n = 2 * n;
|
n = 2 * n;
|
||||||
tbuf = new char[n];
|
tbuf = new char[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
string result;
|
string result;
|
||||||
if (err) result = tbuf;
|
if (err) result = tbuf;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -114,11 +114,11 @@ int compare_no_case(string const & s, string const & s2, unsigned int len)
|
|||||||
bool isStrInt(string const & str)
|
bool isStrInt(string const & str)
|
||||||
{
|
{
|
||||||
if (str.empty()) return false;
|
if (str.empty()) return false;
|
||||||
|
|
||||||
// Remove leading and trailing white space chars.
|
// Remove leading and trailing white space chars.
|
||||||
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
||||||
if (tmpstr.empty()) return false;
|
if (tmpstr.empty()) return false;
|
||||||
|
|
||||||
string::const_iterator cit = tmpstr.begin();
|
string::const_iterator cit = tmpstr.begin();
|
||||||
if ((*cit) == '-') ++cit;
|
if ((*cit) == '-') ++cit;
|
||||||
string::const_iterator end = tmpstr.end();
|
string::const_iterator end = tmpstr.end();
|
||||||
@ -132,11 +132,11 @@ bool isStrInt(string const & str)
|
|||||||
bool isStrUnsignedInt(string const & str)
|
bool isStrUnsignedInt(string const & str)
|
||||||
{
|
{
|
||||||
if (str.empty()) return false;
|
if (str.empty()) return false;
|
||||||
|
|
||||||
// Remove leading and trailing white space chars.
|
// Remove leading and trailing white space chars.
|
||||||
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
||||||
if (tmpstr.empty()) return false;
|
if (tmpstr.empty()) return false;
|
||||||
|
|
||||||
string::const_iterator cit = tmpstr.begin();
|
string::const_iterator cit = tmpstr.begin();
|
||||||
string::const_iterator end = tmpstr.end();
|
string::const_iterator end = tmpstr.end();
|
||||||
for (; cit != end; ++cit) {
|
for (; cit != end; ++cit) {
|
||||||
@ -175,7 +175,7 @@ unsigned int strToUnsignedInt(string const & str)
|
|||||||
bool isStrDbl(string const & str)
|
bool isStrDbl(string const & str)
|
||||||
{
|
{
|
||||||
if (str.empty()) return false;
|
if (str.empty()) return false;
|
||||||
|
|
||||||
// Remove leading and trailing white space chars.
|
// Remove leading and trailing white space chars.
|
||||||
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
string const tmpstr = frontStrip(strip(str, ' '), ' ');
|
||||||
if (tmpstr.empty()) return false;
|
if (tmpstr.empty()) return false;
|
||||||
@ -215,15 +215,15 @@ double strToDbl(string const & str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char lowercase(char c)
|
char lowercase(char c)
|
||||||
{
|
{
|
||||||
return char(tolower(c));
|
return char(tolower(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char uppercase(char c)
|
char uppercase(char c)
|
||||||
{
|
{
|
||||||
return char(toupper(c));
|
return char(toupper(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ struct local_lowercase {
|
|||||||
return tolower(c);
|
return tolower(c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct local_uppercase {
|
struct local_uppercase {
|
||||||
char operator()(char c) const {
|
char operator()(char c) const {
|
||||||
return toupper(c);
|
return toupper(c);
|
||||||
@ -264,10 +264,10 @@ string const uppercase(string const & a)
|
|||||||
bool prefixIs(string const & a, char const * pre)
|
bool prefixIs(string const & a, char const * pre)
|
||||||
{
|
{
|
||||||
lyx::Assert(pre);
|
lyx::Assert(pre);
|
||||||
|
|
||||||
size_t const l = strlen(pre);
|
size_t const l = strlen(pre);
|
||||||
string::size_type const alen = a.length();
|
string::size_type const alen = a.length();
|
||||||
|
|
||||||
if (l > alen || a.empty())
|
if (l > alen || a.empty())
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
@ -289,7 +289,7 @@ bool prefixIs(string const & a, string const & pre)
|
|||||||
{
|
{
|
||||||
string::size_type const prelen = pre.length();
|
string::size_type const prelen = pre.length();
|
||||||
string::size_type const alen = a.length();
|
string::size_type const alen = a.length();
|
||||||
|
|
||||||
if (prelen > alen || a.empty())
|
if (prelen > alen || a.empty())
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
@ -312,10 +312,10 @@ bool suffixIs(string const & a, char c)
|
|||||||
bool suffixIs(string const & a, char const * suf)
|
bool suffixIs(string const & a, char const * suf)
|
||||||
{
|
{
|
||||||
lyx::Assert(suf);
|
lyx::Assert(suf);
|
||||||
|
|
||||||
size_t const suflen = strlen(suf);
|
size_t const suflen = strlen(suf);
|
||||||
string::size_type const alen = a.length();
|
string::size_type const alen = a.length();
|
||||||
|
|
||||||
if (suflen > alen)
|
if (suflen > alen)
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
@ -338,7 +338,7 @@ bool suffixIs(string const & a, string const & suf)
|
|||||||
{
|
{
|
||||||
string::size_type const suflen = suf.length();
|
string::size_type const suflen = suf.length();
|
||||||
string::size_type const alen = a.length();
|
string::size_type const alen = a.length();
|
||||||
|
|
||||||
if (suflen > alen) {
|
if (suflen > alen) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -396,7 +396,7 @@ bool contains(char const * a, char const * b)
|
|||||||
bool containsOnly(string const & s, char const * cset)
|
bool containsOnly(string const & s, char const * cset)
|
||||||
{
|
{
|
||||||
lyx::Assert(cset);
|
lyx::Assert(cset);
|
||||||
|
|
||||||
return s.find_first_not_of(cset) == string::npos;
|
return s.find_first_not_of(cset) == string::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ bool containsOnly(string const & s, string const & cset)
|
|||||||
bool containsOnly(char const * s, char const * cset)
|
bool containsOnly(char const * s, char const * cset)
|
||||||
{
|
{
|
||||||
lyx::Assert(s && cset);
|
lyx::Assert(s && cset);
|
||||||
|
|
||||||
return string(s).find_first_not_of(cset) == string::npos;
|
return string(s).find_first_not_of(cset) == string::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,7 +418,7 @@ bool containsOnly(char const * s, char const * cset)
|
|||||||
bool containsOnly(char const * s, string const & cset)
|
bool containsOnly(char const * s, string const & cset)
|
||||||
{
|
{
|
||||||
lyx::Assert(s);
|
lyx::Assert(s);
|
||||||
|
|
||||||
return string(s).find_first_not_of(cset) == string::npos;
|
return string(s).find_first_not_of(cset) == string::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ bool containsOnly(char const * s, string const & cset)
|
|||||||
string const token(string const & a, char delim, int n)
|
string const token(string const & a, char delim, int n)
|
||||||
{
|
{
|
||||||
if (a.empty()) return string();
|
if (a.empty()) return string();
|
||||||
|
|
||||||
string::size_type k = 0;
|
string::size_type k = 0;
|
||||||
string::size_type i = 0;
|
string::size_type i = 0;
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ string const subst(string const & a,
|
|||||||
char const * oldstr, string const & newstr)
|
char const * oldstr, string const & newstr)
|
||||||
{
|
{
|
||||||
lyx::Assert(oldstr);
|
lyx::Assert(oldstr);
|
||||||
|
|
||||||
string lstr(a);
|
string lstr(a);
|
||||||
string::size_type i = 0;
|
string::size_type i = 0;
|
||||||
string::size_type olen = strlen(oldstr);
|
string::size_type olen = strlen(oldstr);
|
||||||
@ -530,7 +530,7 @@ string const strip(string const & a, char c)
|
|||||||
string tmp(a);
|
string tmp(a);
|
||||||
string::size_type i = tmp.find_last_not_of(c);
|
string::size_type i = tmp.find_last_not_of(c);
|
||||||
if (i == a.length() - 1) return tmp; // no c's at end of a
|
if (i == a.length() - 1) return tmp; // no c's at end of a
|
||||||
if (i != string::npos)
|
if (i != string::npos)
|
||||||
tmp.erase(i + 1, string::npos);
|
tmp.erase(i + 1, string::npos);
|
||||||
#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
|
#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
|
||||||
/// Needed for broken string::find_last_not_of
|
/// Needed for broken string::find_last_not_of
|
||||||
@ -548,7 +548,7 @@ string const strip(string const & a, char c)
|
|||||||
string const frontStrip(string const & a, char const * p)
|
string const frontStrip(string const & a, char const * p)
|
||||||
{
|
{
|
||||||
lyx::Assert(p);
|
lyx::Assert(p);
|
||||||
|
|
||||||
if (a.empty() || !*p) return a;
|
if (a.empty() || !*p) return a;
|
||||||
string tmp(a);
|
string tmp(a);
|
||||||
string::size_type i = tmp.find_first_not_of(p);
|
string::size_type i = tmp.find_first_not_of(p);
|
||||||
|
@ -41,7 +41,7 @@ int compare(char const * a, char const * b)
|
|||||||
return std::strcmp(a, b);
|
return std::strcmp(a, b);
|
||||||
#else
|
#else
|
||||||
return strcmp(a, b);
|
return strcmp(a, b);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -52,7 +52,7 @@ int compare(char const * a, char const * b, unsigned int len)
|
|||||||
return std::strncmp(a, b, len);
|
return std::strncmp(a, b, len);
|
||||||
#else
|
#else
|
||||||
return strncmp(a, b, len);
|
return strncmp(a, b, len);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -73,10 +73,10 @@ bool isStrDbl(string const & str);
|
|||||||
///
|
///
|
||||||
double strToDbl(string const & str);
|
double strToDbl(string const & str);
|
||||||
|
|
||||||
///
|
///
|
||||||
char lowercase(char c);
|
char lowercase(char c);
|
||||||
|
|
||||||
///
|
///
|
||||||
char uppercase(char c);
|
char uppercase(char c);
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -88,7 +88,7 @@ string const uppercase(string const &);
|
|||||||
/// convert \a T to string
|
/// convert \a T to string
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline
|
inline
|
||||||
string const tostr(T const & t)
|
string const tostr(T const & t)
|
||||||
{
|
{
|
||||||
ostringstream ostr;
|
ostringstream ostr;
|
||||||
ostr << t;
|
ostr << t;
|
||||||
@ -151,7 +151,7 @@ public:
|
|||||||
typedef string first_argument_type;
|
typedef string first_argument_type;
|
||||||
typedef string second_argument_type;
|
typedef string second_argument_type;
|
||||||
typedef bool result_type;
|
typedef bool result_type;
|
||||||
|
|
||||||
bool operator()(string const & haystack, string const & needle) const {
|
bool operator()(string const & haystack, string const & needle) const {
|
||||||
return contains(haystack, needle);
|
return contains(haystack, needle);
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ string const token(string const & a, char delim, int n);
|
|||||||
|
|
||||||
/** Search a token in this string using the delim.
|
/** Search a token in this string using the delim.
|
||||||
Doesn't modify the original string. Returns -1 in case of
|
Doesn't modify the original string. Returns -1 in case of
|
||||||
failure.
|
failure.
|
||||||
Example:
|
Example:
|
||||||
\code
|
\code
|
||||||
"a;bc;d".tokenPos(';', "bc") == 1;
|
"a;bc;d".tokenPos(';', "bc") == 1;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* lxtl.h
|
/* lxtl.h
|
||||||
* LyX eXternalization Template Library
|
* LyX eXternalization Template Library
|
||||||
* This file is part of
|
* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
@ -28,7 +28,7 @@
|
|||||||
typedef GIOP_format<auto_mem_buffer> gui_format;
|
typedef GIOP_format<auto_mem_buffer> gui_format;
|
||||||
|
|
||||||
/* Simplify the use of the XTL. The caller is responsible for creating their
|
/* Simplify the use of the XTL. The caller is responsible for creating their
|
||||||
own memory buffer. The buffer type isn't a template parameter because I
|
own memory buffer. The buffer type isn't a template parameter because I
|
||||||
need/want the forward declared buffer class in some other header files
|
need/want the forward declared buffer class in some other header files
|
||||||
thereby avoiding an extra file dependency.
|
thereby avoiding an extra file dependency.
|
||||||
ARRae 20000423
|
ARRae 20000423
|
||||||
|
@ -46,7 +46,7 @@ struct firster {
|
|||||||
|
|
||||||
template <class InputIter, class OutputIter, class Func>
|
template <class InputIter, class OutputIter, class Func>
|
||||||
OutputIter copy_if(InputIter first, InputIter last,
|
OutputIter copy_if(InputIter first, InputIter last,
|
||||||
OutputIter result, Func func)
|
OutputIter result, Func func)
|
||||||
{
|
{
|
||||||
for (; first != last; ++first) {
|
for (; first != last; ++first) {
|
||||||
if (func(*first)) {
|
if (func(*first)) {
|
||||||
@ -63,10 +63,10 @@ typename std::iterator_traits<Iterator>::difference_type
|
|||||||
count (Iterator first, Iterator last, T const & value)
|
count (Iterator first, Iterator last, T const & value)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_STD_COUNT
|
#ifdef HAVE_STD_COUNT
|
||||||
return std::count(first, last, value);
|
return std::count(first, last, value);
|
||||||
#else
|
#else
|
||||||
std::iterator_traits<Iterator>::difference_type n = 0;
|
std::iterator_traits<Iterator>::difference_type n = 0;
|
||||||
while (first != last)
|
while (first != last)
|
||||||
if (*first++ == value) ++n;
|
if (*first++ == value) ++n;
|
||||||
return n;
|
return n;
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
/** \file lyxfunctional.h
|
/** \file lyxfunctional.h
|
||||||
\brief Convenient function objects for use with LyX
|
\brief Convenient function objects for use with LyX
|
||||||
|
|
||||||
This is currently a small collection of small function objects for use
|
This is currently a small collection of small function objects for use
|
||||||
together with std::algorithms.
|
together with std::algorithms.
|
||||||
**/
|
**/
|
||||||
@ -18,7 +18,7 @@ namespace lyx {
|
|||||||
template<class R, class C, class A>
|
template<class R, class C, class A>
|
||||||
class class_fun_t {
|
class class_fun_t {
|
||||||
public:
|
public:
|
||||||
class_fun_t(C & ct, R(C::*p)(A))
|
class_fun_t(C & ct, R(C::*p)(A))
|
||||||
: c(ct), cmf(p) {}
|
: c(ct), cmf(p) {}
|
||||||
R operator()(A & a) const {
|
R operator()(A & a) const {
|
||||||
return (c.*cmf)(a);
|
return (c.*cmf)(a);
|
||||||
@ -78,7 +78,7 @@ public:
|
|||||||
typedef void difference_type;
|
typedef void difference_type;
|
||||||
typedef void pointer;
|
typedef void pointer;
|
||||||
typedef void reference;
|
typedef void reference;
|
||||||
|
|
||||||
back_insert_fun_iterator(Cont & x, MemRet(Type::*p)())
|
back_insert_fun_iterator(Cont & x, MemRet(Type::*p)())
|
||||||
: container(&x), pmf(p) {}
|
: container(&x), pmf(p) {}
|
||||||
|
|
||||||
@ -118,12 +118,12 @@ public:
|
|||||||
typedef void difference_type;
|
typedef void difference_type;
|
||||||
typedef void pointer;
|
typedef void pointer;
|
||||||
typedef void reference;
|
typedef void reference;
|
||||||
|
|
||||||
const_back_insert_fun_iterator(Cont & x, MemRet(Type::*p)() const)
|
const_back_insert_fun_iterator(Cont & x, MemRet(Type::*p)() const)
|
||||||
: container(&x), pmf(p) {}
|
: container(&x), pmf(p) {}
|
||||||
|
|
||||||
~const_back_insert_fun_iterator() {}
|
~const_back_insert_fun_iterator() {}
|
||||||
|
|
||||||
const_back_insert_fun_iterator &
|
const_back_insert_fun_iterator &
|
||||||
operator=(Type const * val) {
|
operator=(Type const * val) {
|
||||||
container->push_back((val->*pmf)());
|
container->push_back((val->*pmf)());
|
||||||
@ -213,7 +213,7 @@ compare_memfun(R(C::*p)() const, A const & a)
|
|||||||
return const_compare_memfun_t<R, C, A>(p, a);
|
return const_compare_memfun_t<R, C, A>(p, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Functors used in the template.
|
// Functors used in the template.
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2001 The LyX Team.
|
* Copyright 1995-2001 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -32,7 +32,7 @@ bool copy(string const & from, string const & to);
|
|||||||
/// generates a checksum
|
/// generates a checksum
|
||||||
unsigned long sum(string const & file);
|
unsigned long sum(string const & file);
|
||||||
/// returns a date string (not used currently)
|
/// returns a date string (not used currently)
|
||||||
char * date();
|
char * date();
|
||||||
/// returns the name of the user (not used currently)
|
/// returns the name of the user (not used currently)
|
||||||
string const getUserName();
|
string const getUserName();
|
||||||
///
|
///
|
||||||
@ -57,13 +57,13 @@ string const tempName(string const & dir = string(),
|
|||||||
/** Returns true if var is approximately equal to number with allowed error
|
/** Returns true if var is approximately equal to number with allowed error
|
||||||
* of 'error'.
|
* of 'error'.
|
||||||
*
|
*
|
||||||
* Reason: A float can be very close to the number, yet still need not be
|
* Reason: A float can be very close to the number, yet still need not be
|
||||||
* exactly equal, you can have exp(-10) which is very close to zero but not
|
* exactly equal, you can have exp(-10) which is very close to zero but not
|
||||||
* zero. If you only need an approximate equality (you usually do), use this
|
* zero. If you only need an approximate equality (you usually do), use this
|
||||||
* template.
|
* template.
|
||||||
*
|
*
|
||||||
* Usage: if (float_equal(var, number, 0.0001)) { }
|
* Usage: if (float_equal(var, number, 0.0001)) { }
|
||||||
*
|
*
|
||||||
* This will check if 'var' is approx. equal to 'number' with error of 1/1000
|
* This will check if 'var' is approx. equal to 'number' with error of 1/1000
|
||||||
*/
|
*/
|
||||||
inline bool float_equal(float var, float number, float error)
|
inline bool float_equal(float var, float number, float error)
|
||||||
|
@ -52,7 +52,7 @@ typedef unsigned reg_syntax_t;
|
|||||||
#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
|
#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
|
||||||
|
|
||||||
/* If this bit is not set, then + and ? are operators, and \+ and \? are
|
/* If this bit is not set, then + and ? are operators, and \+ and \? are
|
||||||
literals.
|
literals.
|
||||||
If set, then \+ and \? are operators and + and ? are literals. */
|
If set, then \+ and \? are operators and + and ? are literals. */
|
||||||
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
|
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
|
||||||
|
|
||||||
@ -65,10 +65,10 @@ typedef unsigned reg_syntax_t;
|
|||||||
/* If this bit is set, then ^ and $ are always anchors (outside bracket
|
/* If this bit is set, then ^ and $ are always anchors (outside bracket
|
||||||
expressions, of course).
|
expressions, of course).
|
||||||
If this bit is not set, then it depends:
|
If this bit is not set, then it depends:
|
||||||
^ is an anchor if it is at the beginning of a regular
|
^ is an anchor if it is at the beginning of a regular
|
||||||
expression or after an open-group or an alternation operator;
|
expression or after an open-group or an alternation operator;
|
||||||
$ is an anchor if it is at the end of a regular expression, or
|
$ is an anchor if it is at the end of a regular expression, or
|
||||||
before a close-group or an alternation operator.
|
before a close-group or an alternation operator.
|
||||||
|
|
||||||
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
|
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
|
||||||
POSIX draft 11.2 says that * etc. in leading positions is undefined.
|
POSIX draft 11.2 says that * etc. in leading positions is undefined.
|
||||||
@ -79,7 +79,7 @@ typedef unsigned reg_syntax_t;
|
|||||||
/* If this bit is set, then special characters are always special
|
/* If this bit is set, then special characters are always special
|
||||||
regardless of where they are in the pattern.
|
regardless of where they are in the pattern.
|
||||||
If this bit is not set, then special characters are special only in
|
If this bit is not set, then special characters are special only in
|
||||||
some contexts; otherwise they are ordinary. Specifically,
|
some contexts; otherwise they are ordinary. Specifically,
|
||||||
* + ? and intervals are only special when not after the beginning,
|
* + ? and intervals are only special when not after the beginning,
|
||||||
open-group, or alternation operator. */
|
open-group, or alternation operator. */
|
||||||
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
|
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
|
||||||
@ -101,7 +101,7 @@ typedef unsigned reg_syntax_t;
|
|||||||
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
|
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
|
||||||
|
|
||||||
/* If this bit is set, either \{...\} or {...} defines an
|
/* If this bit is set, either \{...\} or {...} defines an
|
||||||
interval, depending on RE_NO_BK_BRACES.
|
interval, depending on RE_NO_BK_BRACES.
|
||||||
If not set, \{, \}, {, and } are literals. */
|
If not set, \{, \}, {, and } are literals. */
|
||||||
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
|
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ typedef unsigned reg_syntax_t;
|
|||||||
If not set, then \<digit> is a back-reference. */
|
If not set, then \<digit> is a back-reference. */
|
||||||
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
|
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
|
||||||
|
|
||||||
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
||||||
If not set, then \| is an alternation operator, and | is literal. */
|
If not set, then \| is an alternation operator, and | is literal. */
|
||||||
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
|
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ extern reg_syntax_t re_syntax_options;
|
|||||||
|
|
||||||
/* Define combinations of the above bits for the standard possibilities.
|
/* Define combinations of the above bits for the standard possibilities.
|
||||||
(The [[[ comments delimit what gets put into the Texinfo file, so
|
(The [[[ comments delimit what gets put into the Texinfo file, so
|
||||||
don't delete them!) */
|
don't delete them!) */
|
||||||
/* [[[begin syntaxes]]] */
|
/* [[[begin syntaxes]]] */
|
||||||
#define RE_SYNTAX_EMACS 0
|
#define RE_SYNTAX_EMACS 0
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ extern reg_syntax_t re_syntax_options;
|
|||||||
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
|
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
|
||||||
| RE_UNMATCHED_RIGHT_PAREN_ORD)
|
| RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||||
|
|
||||||
#define RE_SYNTAX_POSIX_AWK \
|
#define RE_SYNTAX_POSIX_AWK \
|
||||||
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
|
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
|
||||||
|
|
||||||
#define RE_SYNTAX_GREP \
|
#define RE_SYNTAX_GREP \
|
||||||
@ -215,7 +215,7 @@ extern reg_syntax_t re_syntax_options;
|
|||||||
#ifdef RE_DUP_MAX
|
#ifdef RE_DUP_MAX
|
||||||
#undef RE_DUP_MAX
|
#undef RE_DUP_MAX
|
||||||
#endif
|
#endif
|
||||||
#define RE_DUP_MAX ((1 << 15) - 1)
|
#define RE_DUP_MAX ((1 << 15) - 1)
|
||||||
|
|
||||||
|
|
||||||
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
|
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
|
||||||
@ -227,7 +227,7 @@ extern reg_syntax_t re_syntax_options;
|
|||||||
/* If this bit is set, then ignore case when matching.
|
/* If this bit is set, then ignore case when matching.
|
||||||
If not set, then case is significant. */
|
If not set, then case is significant. */
|
||||||
#define REG_ICASE (REG_EXTENDED << 1)
|
#define REG_ICASE (REG_EXTENDED << 1)
|
||||||
|
|
||||||
/* If this bit is set, then anchors do not match at newline
|
/* If this bit is set, then anchors do not match at newline
|
||||||
characters in the string.
|
characters in the string.
|
||||||
If not set, then anchors do match at newlines. */
|
If not set, then anchors do match at newlines. */
|
||||||
@ -266,7 +266,7 @@ typedef enum
|
|||||||
REG_EESCAPE, /* Trailing backslash. */
|
REG_EESCAPE, /* Trailing backslash. */
|
||||||
REG_ESUBREG, /* Invalid back reference. */
|
REG_ESUBREG, /* Invalid back reference. */
|
||||||
REG_EBRACK, /* Unmatched left bracket. */
|
REG_EBRACK, /* Unmatched left bracket. */
|
||||||
REG_EPAREN, /* Parenthesis imbalance. */
|
REG_EPAREN, /* Parenthesis imbalance. */
|
||||||
REG_EBRACE, /* Unmatched \{. */
|
REG_EBRACE, /* Unmatched \{. */
|
||||||
REG_BADBR, /* Invalid contents of \{\}. */
|
REG_BADBR, /* Invalid contents of \{\}. */
|
||||||
REG_ERANGE, /* Invalid range end. */
|
REG_ERANGE, /* Invalid range end. */
|
||||||
@ -289,65 +289,65 @@ struct re_pattern_buffer
|
|||||||
{
|
{
|
||||||
/* [[[begin pattern_buffer]]] */
|
/* [[[begin pattern_buffer]]] */
|
||||||
/* Space that holds the compiled pattern. It is declared as
|
/* Space that holds the compiled pattern. It is declared as
|
||||||
`unsigned char *' because its elements are
|
`unsigned char *' because its elements are
|
||||||
sometimes used as array indexes. */
|
sometimes used as array indexes. */
|
||||||
unsigned char *buffer;
|
unsigned char *buffer;
|
||||||
|
|
||||||
/* Number of bytes to which `buffer' points. */
|
/* Number of bytes to which `buffer' points. */
|
||||||
unsigned long allocated;
|
unsigned long allocated;
|
||||||
|
|
||||||
/* Number of bytes actually used in `buffer'. */
|
/* Number of bytes actually used in `buffer'. */
|
||||||
unsigned long used;
|
unsigned long used;
|
||||||
|
|
||||||
/* Syntax setting with which the pattern was compiled. */
|
/* Syntax setting with which the pattern was compiled. */
|
||||||
reg_syntax_t syntax;
|
reg_syntax_t syntax;
|
||||||
|
|
||||||
/* Pointer to a fastmap, if any, otherwise zero. re_search uses
|
/* Pointer to a fastmap, if any, otherwise zero. re_search uses
|
||||||
the fastmap, if there is one, to skip over impossible
|
the fastmap, if there is one, to skip over impossible
|
||||||
starting points for matches. */
|
starting points for matches. */
|
||||||
char *fastmap;
|
char *fastmap;
|
||||||
|
|
||||||
/* Either a translate table to apply to all characters before
|
/* Either a translate table to apply to all characters before
|
||||||
comparing them, or zero for no translation. The translation
|
comparing them, or zero for no translation. The translation
|
||||||
is applied to a pattern when it is compiled and to a string
|
is applied to a pattern when it is compiled and to a string
|
||||||
when it is matched. */
|
when it is matched. */
|
||||||
char *translate;
|
char *translate;
|
||||||
|
|
||||||
/* Number of subexpressions found by the compiler. */
|
/* Number of subexpressions found by the compiler. */
|
||||||
size_t re_nsub;
|
size_t re_nsub;
|
||||||
|
|
||||||
/* Zero if this pattern cannot match the empty string, one else.
|
/* Zero if this pattern cannot match the empty string, one else.
|
||||||
Well, in truth it's used only in `re_search_2', to see
|
Well, in truth it's used only in `re_search_2', to see
|
||||||
whether or not we should use the fastmap, so we don't set
|
whether or not we should use the fastmap, so we don't set
|
||||||
this absolutely perfectly; see `re_compile_fastmap' (the
|
this absolutely perfectly; see `re_compile_fastmap' (the
|
||||||
`duplicate' case). */
|
`duplicate' case). */
|
||||||
unsigned can_be_null : 1;
|
unsigned can_be_null : 1;
|
||||||
|
|
||||||
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
|
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
|
||||||
for `max (RE_NREGS, re_nsub + 1)' groups.
|
for `max (RE_NREGS, re_nsub + 1)' groups.
|
||||||
If REGS_REALLOCATE, reallocate space if necessary.
|
If REGS_REALLOCATE, reallocate space if necessary.
|
||||||
If REGS_FIXED, use what's there. */
|
If REGS_FIXED, use what's there. */
|
||||||
#define REGS_UNALLOCATED 0
|
#define REGS_UNALLOCATED 0
|
||||||
#define REGS_REALLOCATE 1
|
#define REGS_REALLOCATE 1
|
||||||
#define REGS_FIXED 2
|
#define REGS_FIXED 2
|
||||||
unsigned regs_allocated : 2;
|
unsigned regs_allocated : 2;
|
||||||
|
|
||||||
/* Set to zero when `regex_compile' compiles a pattern; set to one
|
/* Set to zero when `regex_compile' compiles a pattern; set to one
|
||||||
by `re_compile_fastmap' if it updates the fastmap. */
|
by `re_compile_fastmap' if it updates the fastmap. */
|
||||||
unsigned fastmap_accurate : 1;
|
unsigned fastmap_accurate : 1;
|
||||||
|
|
||||||
/* If set, `re_match_2' does not return information about
|
/* If set, `re_match_2' does not return information about
|
||||||
subexpressions. */
|
subexpressions. */
|
||||||
unsigned no_sub : 1;
|
unsigned no_sub : 1;
|
||||||
|
|
||||||
/* If set, a beginning-of-line anchor doesn't match at the
|
/* If set, a beginning-of-line anchor doesn't match at the
|
||||||
beginning of the string. */
|
beginning of the string. */
|
||||||
unsigned not_bol : 1;
|
unsigned not_bol : 1;
|
||||||
|
|
||||||
/* Similarly for an end-of-line anchor. */
|
/* Similarly for an end-of-line anchor. */
|
||||||
unsigned not_eol : 1;
|
unsigned not_eol : 1;
|
||||||
|
|
||||||
/* If true, an anchor at a newline matches. */
|
/* If true, an anchor at a newline matches. */
|
||||||
unsigned newline_anchor : 1;
|
unsigned newline_anchor : 1;
|
||||||
|
|
||||||
/* [[[end pattern_buffer]]] */
|
/* [[[end pattern_buffer]]] */
|
||||||
@ -418,7 +418,7 @@ extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
|
|||||||
BUFFER. Return NULL if successful, and an error string if not. */
|
BUFFER. Return NULL if successful, and an error string if not. */
|
||||||
extern const char *re_compile_pattern
|
extern const char *re_compile_pattern
|
||||||
_RE_ARGS ((const char *pattern, int length,
|
_RE_ARGS ((const char *pattern, int length,
|
||||||
struct re_pattern_buffer *buffer));
|
struct re_pattern_buffer *buffer));
|
||||||
|
|
||||||
|
|
||||||
/* Compile a fastmap for the compiled pattern in BUFFER; used to
|
/* Compile a fastmap for the compiled pattern in BUFFER; used to
|
||||||
@ -434,29 +434,29 @@ extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
|
|||||||
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
|
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
|
||||||
extern int re_search
|
extern int re_search
|
||||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
||||||
int length, int start, int range, struct re_registers *regs));
|
int length, int start, int range, struct re_registers *regs));
|
||||||
|
|
||||||
|
|
||||||
/* Like `re_search', but search in the concatenation of STRING1 and
|
/* Like `re_search', but search in the concatenation of STRING1 and
|
||||||
STRING2. Also, stop searching at index START + STOP. */
|
STRING2. Also, stop searching at index START + STOP. */
|
||||||
extern int re_search_2
|
extern int re_search_2
|
||||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||||
int length1, const char *string2, int length2,
|
int length1, const char *string2, int length2,
|
||||||
int start, int range, struct re_registers *regs, int stop));
|
int start, int range, struct re_registers *regs, int stop));
|
||||||
|
|
||||||
|
|
||||||
/* Like `re_search', but return how many characters in STRING the regexp
|
/* Like `re_search', but return how many characters in STRING the regexp
|
||||||
in BUFFER matched, starting at position START. */
|
in BUFFER matched, starting at position START. */
|
||||||
extern int re_match
|
extern int re_match
|
||||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
||||||
int length, int start, struct re_registers *regs));
|
int length, int start, struct re_registers *regs));
|
||||||
|
|
||||||
|
|
||||||
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
|
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
|
||||||
extern int re_match_2
|
extern int re_match_2
|
||||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||||
int length1, const char *string2, int length2,
|
int length1, const char *string2, int length2,
|
||||||
int start, struct re_registers *regs, int stop));
|
int start, struct re_registers *regs, int stop));
|
||||||
|
|
||||||
|
|
||||||
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
|
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
|
||||||
@ -473,7 +473,7 @@ extern int re_match_2
|
|||||||
freeing the old data. */
|
freeing the old data. */
|
||||||
extern void re_set_registers
|
extern void re_set_registers
|
||||||
_RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
|
_RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
|
||||||
unsigned num_regs, regoff_t *starts, regoff_t *ends));
|
unsigned num_regs, regoff_t *starts, regoff_t *ends));
|
||||||
|
|
||||||
/* 4.2 bsd compatibility. */
|
/* 4.2 bsd compatibility. */
|
||||||
extern char *re_comp _RE_ARGS ((const char *));
|
extern char *re_comp _RE_ARGS ((const char *));
|
||||||
@ -483,10 +483,10 @@ extern int re_exec _RE_ARGS ((const char *));
|
|||||||
extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
|
extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
|
||||||
extern int regexec
|
extern int regexec
|
||||||
_RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch,
|
_RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch,
|
||||||
regmatch_t pmatch[], int eflags));
|
regmatch_t pmatch[], int eflags));
|
||||||
extern size_t regerror
|
extern size_t regerror
|
||||||
_RE_ARGS ((int errcode, const regex_t *preg, char *errbuf,
|
_RE_ARGS ((int errcode, const regex_t *preg, char *errbuf,
|
||||||
size_t errbuf_size));
|
size_t errbuf_size));
|
||||||
extern void regfree _RE_ARGS ((regex_t *preg));
|
extern void regfree _RE_ARGS ((regex_t *preg));
|
||||||
|
|
||||||
/* LyX added. */
|
/* LyX added. */
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-2000 The LyX Team.
|
* Copyright 1995-2000 The LyX Team.
|
||||||
*
|
*
|
||||||
@ -77,7 +77,7 @@ struct lyxstring::Srep {
|
|||||||
size_t res;
|
size_t res;
|
||||||
/// Data. At least 1 char for trailing null.
|
/// Data. At least 1 char for trailing null.
|
||||||
lyxstring::value_type * s;
|
lyxstring::value_type * s;
|
||||||
|
|
||||||
///
|
///
|
||||||
Srep(lyxstring::size_type nsz, const lyxstring::value_type * p);
|
Srep(lyxstring::size_type nsz, const lyxstring::value_type * p);
|
||||||
///
|
///
|
||||||
@ -90,7 +90,7 @@ struct lyxstring::Srep {
|
|||||||
--ref;
|
--ref;
|
||||||
return new Srep(sz, s);
|
return new Srep(sz, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
void assign(lyxstring::size_type nsz, const lyxstring::value_type * p);
|
void assign(lyxstring::size_type nsz, const lyxstring::value_type * p);
|
||||||
///
|
///
|
||||||
@ -149,7 +149,7 @@ lyxstring::Srep::Srep(lyxstring::size_type nsz, value_type ch)
|
|||||||
sz = 0;
|
sz = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lyxstring::Srep::assign(lyxstring::size_type nsz, const value_type * p)
|
void lyxstring::Srep::assign(lyxstring::size_type nsz, const value_type * p)
|
||||||
{
|
{
|
||||||
@ -296,7 +296,7 @@ void lyxstring::Srep::replace(lyxstring::size_type i, lyxstring::size_type n,
|
|||||||
memcpy(tmp + i + n2, &s[i + n], sz - i);
|
memcpy(tmp + i + n2, &s[i + n], sz - i);
|
||||||
delete[] s;
|
delete[] s;
|
||||||
s = tmp;
|
s = tmp;
|
||||||
sz += n2;
|
sz += n2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ void lyxstring::Srep::replace(lyxstring::size_type i, lyxstring::size_type n,
|
|||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
// The lyxstring Invariant tester
|
// The lyxstring Invariant tester
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
// There are no know bugs in lyxstring now, and it have been
|
// There are no know bugs in lyxstring now, and it have been
|
||||||
// tested for a long time. so we disable the invariant checker. (Lgb)
|
// tested for a long time. so we disable the invariant checker. (Lgb)
|
||||||
#undef ENABLE_ASSERTIONS
|
#undef ENABLE_ASSERTIONS
|
||||||
@ -313,7 +313,7 @@ void lyxstring::Srep::replace(lyxstring::size_type i, lyxstring::size_type n,
|
|||||||
/** Testing of the lyxstring invariant
|
/** Testing of the lyxstring invariant
|
||||||
* By creating an object that tests the lyxstring invariant during its
|
* By creating an object that tests the lyxstring invariant during its
|
||||||
* construction *and* its deconstruction we greatly simplify our code.
|
* construction *and* its deconstruction we greatly simplify our code.
|
||||||
* Calling TestlyxstringInvariant() upon entry to an lyxstring method
|
* Calling TestlyxstringInvariant() upon entry to an lyxstring method
|
||||||
* will test the invariant upon entry to the code. If the Asserts fail
|
* will test the invariant upon entry to the code. If the Asserts fail
|
||||||
* then we know from the stack trace that the corruption occurred *before*
|
* then we know from the stack trace that the corruption occurred *before*
|
||||||
* entry to this method. We can also be sure it didn't happen in any of
|
* entry to this method. We can also be sure it didn't happen in any of
|
||||||
@ -523,7 +523,7 @@ const_reverse_iterator lyxstring::rend() const
|
|||||||
///////////////////////
|
///////////////////////
|
||||||
|
|
||||||
lyxstring::size_type lyxstring::size() const
|
lyxstring::size_type lyxstring::size() const
|
||||||
{
|
{
|
||||||
return rep->sz;
|
return rep->sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ lyxstring & lyxstring::assign(lyxstring const & x)
|
|||||||
rep = x.rep; // share representation
|
rep = x.rep; // share representation
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lyxstring & lyxstring::assign(lyxstring const & x, size_type pos, size_type n)
|
lyxstring & lyxstring::assign(lyxstring const & x, size_type pos, size_type n)
|
||||||
{
|
{
|
||||||
@ -610,7 +610,7 @@ lyxstring & lyxstring::assign(lyxstring const & x, size_type pos, size_type n)
|
|||||||
|
|
||||||
return assign(x.substr(pos, n));
|
return assign(x.substr(pos, n));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lyxstring & lyxstring::assign(value_type const * s, size_type n)
|
lyxstring & lyxstring::assign(value_type const * s, size_type n)
|
||||||
{
|
{
|
||||||
@ -625,7 +625,7 @@ lyxstring & lyxstring::assign(value_type const * s, size_type n)
|
|||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lyxstring & lyxstring::assign(value_type const * s)
|
lyxstring & lyxstring::assign(value_type const * s)
|
||||||
{
|
{
|
||||||
@ -881,21 +881,21 @@ void lyxstring::insert(iterator p, iterator first, iterator last)
|
|||||||
|
|
||||||
insert(p - begin(), first, last - first);
|
insert(p - begin(), first, last - first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
// Find
|
// Find
|
||||||
////////////////
|
////////////////
|
||||||
|
|
||||||
// All the below find functions should be verified,
|
// All the below find functions should be verified,
|
||||||
// it is very likely that I have mixed up or interpreted
|
// it is very likely that I have mixed up or interpreted
|
||||||
// some of the parameters wrong, also some of the funcs can surely
|
// some of the parameters wrong, also some of the funcs can surely
|
||||||
// be written more effectively.
|
// be written more effectively.
|
||||||
|
|
||||||
lyxstring::size_type lyxstring::find(lyxstring const & a, size_type i) const
|
lyxstring::size_type lyxstring::find(lyxstring const & a, size_type i) const
|
||||||
{
|
{
|
||||||
if (!rep->sz || i >= rep->sz) return npos;
|
if (!rep->sz || i >= rep->sz) return npos;
|
||||||
|
|
||||||
TestlyxstringInvariant(this);
|
TestlyxstringInvariant(this);
|
||||||
|
|
||||||
size_type n = a.length();
|
size_type n = a.length();
|
||||||
@ -923,7 +923,7 @@ lyxstring::size_type lyxstring::find(value_type const * ptr, size_type i,
|
|||||||
{
|
{
|
||||||
lyx::Assert(ptr); // OURS!
|
lyx::Assert(ptr); // OURS!
|
||||||
if (!rep->sz || !*ptr || i >= rep->sz) return npos;
|
if (!rep->sz || !*ptr || i >= rep->sz) return npos;
|
||||||
|
|
||||||
TestlyxstringInvariant(this);
|
TestlyxstringInvariant(this);
|
||||||
|
|
||||||
// What is "n" here? is it the number of value_types to use in ptr
|
// What is "n" here? is it the number of value_types to use in ptr
|
||||||
@ -954,7 +954,7 @@ lyxstring::size_type lyxstring::find(value_type const * s, size_type i) const
|
|||||||
{
|
{
|
||||||
lyx::Assert(s); // OURS!
|
lyx::Assert(s); // OURS!
|
||||||
if (!rep->sz || i >= rep->sz) return npos;
|
if (!rep->sz || i >= rep->sz) return npos;
|
||||||
|
|
||||||
TestlyxstringInvariant(this);
|
TestlyxstringInvariant(this);
|
||||||
|
|
||||||
if (!s || !*s) return npos;
|
if (!s || !*s) return npos;
|
||||||
@ -968,10 +968,10 @@ lyxstring::size_type lyxstring::find(value_type c, size_type i) const
|
|||||||
|
|
||||||
TestlyxstringInvariant(this);
|
TestlyxstringInvariant(this);
|
||||||
|
|
||||||
for (size_type t = 0; t + i < rep->sz; ++t) {
|
for (size_type t = 0; t + i < rep->sz; ++t) {
|
||||||
if (rep->s[t + i] == c) return t + i;
|
if (rep->s[t + i] == c) return t + i;
|
||||||
}
|
}
|
||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1347,7 +1347,7 @@ lyxstring & lyxstring::replace(iterator i, iterator i2, const lyxstring & str)
|
|||||||
{
|
{
|
||||||
TestlyxstringInvariant(this);
|
TestlyxstringInvariant(this);
|
||||||
|
|
||||||
return replace(i - begin(), i2 - i, str);
|
return replace(i - begin(), i2 - i, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1377,7 +1377,7 @@ lyxstring & lyxstring::replace(iterator i, iterator i2,
|
|||||||
|
|
||||||
return replace(i - begin(), i2 - i, n, c);
|
return replace(i - begin(), i2 - i, n, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lyxstring & lyxstring::replace(iterator i, iterator i2,
|
lyxstring & lyxstring::replace(iterator i, iterator i2,
|
||||||
iterator j, iterator j2)
|
iterator j, iterator j2)
|
||||||
@ -1478,11 +1478,11 @@ int lyxstring::internal_compare(size_type pos, size_type n,
|
|||||||
if (!*s) return 1;
|
if (!*s) return 1;
|
||||||
// since n > n2, min(n, n2) == 0, c == 0 (stops segfault also)
|
// since n > n2, min(n, n2) == 0, c == 0 (stops segfault also)
|
||||||
|
|
||||||
// remember that n can very well be a lot larger than rep->sz
|
// remember that n can very well be a lot larger than rep->sz
|
||||||
// so we have to ensure that n is no larger than rep->sz
|
// so we have to ensure that n is no larger than rep->sz
|
||||||
n = min(n, rep->sz);
|
n = min(n, rep->sz);
|
||||||
n2 = min(n2, slen);
|
n2 = min(n2, slen);
|
||||||
if (n == n2)
|
if (n == n2)
|
||||||
return memcmp(&(rep->s[pos]), s, n);
|
return memcmp(&(rep->s[pos]), s, n);
|
||||||
int c = memcmp(&(rep->s[pos]), s, min(n, n2));
|
int c = memcmp(&(rep->s[pos]), s, min(n, n2));
|
||||||
if (c)
|
if (c)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user