ws cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3802 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-03-21 17:09:55 +00:00
parent 0fde5a4c78
commit a654de29ea
117 changed files with 1446 additions and 1462 deletions

View File

@ -1,5 +1,7 @@
2002-03-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
* all files: ws cleanup
* Makefile.am: remove ld -r stuff
2002-03-21 Juergen Vigna <jug@sad.it>

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -52,11 +52,11 @@ ExternalTemplateManager::ExternalTemplateManager()
class dumpTemplate {
public:
dumpTemplate(ostream & o)
dumpTemplate(ostream & o)
: ost(o) {}
void operator()(ExternalTemplateManager::Templates::value_type const & vt) {
ExternalTemplate const & et = vt.second;
ost << "Template " << et.lyxName << "\n"
<< "\tGuiName " << et.guiName << "\n"
<< "\tHelpText\n"
@ -68,7 +68,7 @@ public:
<< "\tAutomaticProduction " << et.automaticProduction << "\n";
et.dumpFormats(ost);
ost << "TemplateEnd" << endl;
}
private:
@ -77,7 +77,7 @@ private:
class dumpFormat {
public:
dumpFormat(ostream & o)
dumpFormat(ostream & o)
: ost(o) {}
void operator()(ExternalTemplate::Formats::value_type const & vt) const{
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));
}
void ExternalTemplateManager::dumpTemplates() const
void ExternalTemplateManager::dumpTemplates() const
{
for_each(templates.begin(), templates.end(), dumpTemplate(lyxerr));
}
@ -134,8 +134,8 @@ ExternalTemplate const & ExternalTemplateManager::getTemplateByName(string const
return templates[name];
}
void ExternalTemplateManager::readTemplates(string const & path)
void ExternalTemplateManager::readTemplates(string const & path)
{
Path p(path);
@ -143,7 +143,7 @@ void ExternalTemplateManager::readTemplates(string const & path)
TM_TEMPLATE = 1,
TM_END
};
keyword_item templatetags[] = {
{ "template", TM_TEMPLATE },
{ "templateend", TM_END }
@ -162,7 +162,7 @@ void ExternalTemplateManager::readTemplates(string const & path)
"No template file" << endl;
return;
}
while (lex.isOK()) {
switch (lex.lex()) {
case TM_TEMPLATE: {
@ -173,7 +173,7 @@ void ExternalTemplateManager::readTemplates(string const & path)
tmp.readTemplate(lex);
}
break;
case TM_END:
lex.printError("Warning: End outside Template.");
break;
@ -207,46 +207,46 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
};
pushpophelper pph(lex, templateoptiontags, TO_END);
while (lex.isOK()) {
switch (lex.lex()) {
case TO_GUINAME:
lex.next(true);
guiName = lex.getString();
break;
case TO_HELPTEXT:
helpText = lex.getLongString("HelpTextEnd");
break;
case TO_FILTER:
lex.next(true);
fileRegExp = lex.getString();
break;
case TO_VIEWCMD:
lex.next(true);
viewCommand = lex.getString();
break;
case TO_EDITCMD:
lex.next(true);
editCommand = lex.getString();
break;
case TO_AUTOMATIC:
lex.next();
automaticProduction = lex.getBool();
break;
case TO_FORMAT:
lex.next(true);
formats[lex.getString()].readFormat(lex);
break;
case TO_END:
return;
default:
lex.printError("ExternalTemplate::readTemplate: "
"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 {
FO_PRODUCT = 1,
@ -267,7 +267,7 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
FO_PREAMBLE,
FO_END
};
keyword_item formattags[] = {
{ "formatend", FO_END },
{ "preamble", FO_PREAMBLE },
@ -278,14 +278,14 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
};
pushpophelper pph(lex, formattags, FO_END);
while (lex.isOK()) {
switch (lex.lex()) {
case FO_PRODUCT:
lex.next(true);
product = lex.getString();
break;
case FO_UPDATECMD:
lex.next(true);
updateCommand = lex.getString();
@ -295,16 +295,16 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
lex.next(true);
updateResult = lex.getString();
break;
case FO_REQUIREMENT:
lex.next(true);
requirement = lex.getString();
break;
case FO_PREAMBLE:
preamble = lex.getLongString("preambleend");
break;
case FO_END:
if (lyxerr.debugging())
lex.printError("FormatEnd");
@ -312,4 +312,3 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
}
}
}

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -64,10 +64,10 @@ struct ExternalTemplate {
Formats formats;
///
void dumpFormats(std::ostream &) const;
/// We have to have default commands for safety reasons!
ExternalTemplate();
};
@ -82,7 +82,7 @@ public:
static ExternalTemplateManager & get();
Templates & getTemplates();
Templates const & getTemplates() const;
/// return the template by LyX name
/// return the template by LyX name
ExternalTemplate const & getTemplateByName(const string & name);
private:
ExternalTemplateManager();

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -99,7 +99,7 @@ LyXFont const Inset::convertFont(LyXFont const & font) const
#endif
string const Inset::editMessage() const
string const Inset::editMessage() const
{
return _("Opened inset");
}
@ -251,7 +251,7 @@ void UpdatableInset::draw(BufferView *, LyXFont const &,
void UpdatableInset::scroll(BufferView * bv, float s) const
{
LyXFont font;
if (!s) {
scx = 0;
return;
@ -259,8 +259,8 @@ void UpdatableInset::scroll(BufferView * bv, float s) const
int const workW = bv->workWidth();
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)
return;
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 const save_scx = scx;
scx = int(s * workW / 2);
// if (!display())
// scx += 20;
@ -295,7 +295,7 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
if (!scx && (top_x + width(bv, font)) < (bv->workWidth() - 20))
return;
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 {
scx += offset;
}
@ -306,8 +306,8 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
/// An updatable inset could handle lyx editing commands
UpdatableInset::RESULT
UpdatableInset::localDispatch(BufferView * bv,
kb_action action, string const & arg)
UpdatableInset::localDispatch(BufferView * bv,
kb_action action, string const & arg)
{
if (!arg.empty() && (action==LFUN_SCROLL_INSET)) {
if (arg.find('.') != arg.npos) {
@ -318,10 +318,10 @@ UpdatableInset::localDispatch(BufferView * bv,
scroll(bv, xx);
}
bv->updateInset(this, false);
return DISPATCHED;
}
return UNDISPATCHED;
return UNDISPATCHED;
}
@ -375,7 +375,7 @@ string const UpdatableInset::selectNextWordToSpellcheck(BufferView *bv,
bool UpdatableInset::searchForward(BufferView * bv, string const &,
bool, bool)
bool, bool)
{
// we have to unlock ourself in this function by default!
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, bool)
bool, bool)
{
// we have to unlock ourself in this function by default!
bv->unlockInset(const_cast<UpdatableInset *>(this));

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995-2001 the LyX Team.
*
* ====================================================== */
@ -129,7 +129,7 @@ public:
///
HIGHLY_EDITABLE
};
///
Inset();
///
@ -190,7 +190,7 @@ public:
bool free_spc) const = 0;
///
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;
///
@ -199,17 +199,17 @@ public:
virtual void validate(LaTeXFeatures & features) const;
///
virtual bool deletable() const;
/// returns LyX code associated with the inset. Used for TOC, ...)
virtual Inset::Code lyxCode() const { return NO_CODE; }
virtual std::vector<string> const getLabelList() const {
return std::vector<string>();
}
///
virtual Inset * clone(Buffer const &, bool same_ids = false) const = 0;
/// returns true to override begin and end inset in file
virtual bool directWrite() const;
@ -298,7 +298,7 @@ public:
virtual bool checkInsertChar(LyXFont &);
/// we need this here because collapsed insets are only EDITABLE
virtual void setFont(BufferView *, LyXFont const &,
bool toggleall = false, bool selectall = false);
bool toggleall = false, bool selectall = false);
///
// needed for spellchecking text
///
@ -352,8 +352,8 @@ private:
inline
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
// directly user interaction. Currently used only for mathed.
// Note that all pure methods from Inset class are pure here too.
// [Alejandro 080596]
// [Alejandro 080596]
/** 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.
*
* 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
*
* During the lock, all button and keyboard events will be modified
* and send to the inset through the following inset-features. Note that
* Inset::insetUnlock will be called from inside UnlockInset. It is meant
* 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
* updateInset(this).
*
*
* 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
* are checked first, so no performance problem should occur.
*/
@ -394,22 +394,22 @@ public:
/** Dispatch result codes
Now that nested updatable insets are allowed, the local dispatch
becomes a bit complex, just two possible results (boolean)
are not enough.
are not enough.
DISPATCHED = the inset catched the action
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
of the action
of the action
FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of
the inset.
the inset.
FINISHED_UP = FINISHED, but put the cursor UP of
the inset.
the inset.
FINISHED_DOWN = FINISHED, but put the cursor DOWN of
the inset.
the inset.
UNDISPATCHED = the action was not catched, it should be
dispatched by lower level insets
*/
dispatched by lower level insets
*/
enum RESULT {
UNDISPATCHED = 0,
DISPATCHED,
@ -419,7 +419,7 @@ public:
FINISHED_UP,
FINISHED_DOWN
};
/// To convert old binary dispatch results
RESULT DISPATCH_RESULT(bool b) {
return b ? DISPATCHED : FINISHED;
@ -435,7 +435,7 @@ public:
virtual bool checkInsertChar(LyXFont &);
///
virtual EDITABLE editable() const;
///
virtual void toggleInsetCursor(BufferView *);
///
@ -454,7 +454,7 @@ public:
// if that one has one!
///
virtual bool insetButtonRelease(BufferView *,
int x, int y, int button);
int x, int y, int button);
///
virtual void insetKeyPress(XKeyEvent * ev);
///
@ -487,7 +487,7 @@ public:
{ return false; }
///
virtual bool unlockInsetInInset(BufferView *, UpdatableInset *,
bool /*lr*/ = false)
bool /*lr*/ = false)
{ return false; }
/// An updatable inset could handle lyx editing commands
virtual RESULT localDispatch(BufferView *, kb_action, string const &);
@ -526,11 +526,11 @@ public:
// needed for search/replace functionality
///
virtual bool searchForward(BufferView *, string const &,
bool = true, bool = false);
bool = true, bool = false);
///
virtual bool searchBackward(BufferView *, string const &,
bool = true, bool = false);
bool = true, bool = false);
protected:
///
void toggleCursorVisible() const {
@ -564,9 +564,9 @@ bool UpdatableInset::checkInsertChar(LyXFont &)
*/
inline bool isEditableInset(Inset * i)
{
return i && i->editable();
return i && i->editable();
}
/**
* returns true if pointer argument is valid
* and points to a highly editable inset

View File

@ -12,7 +12,7 @@
#include "lyxtext.h"
#include "lyxrc.h"
#include "font.h"
#include "LyXView.h"
#include "LyXView.h"
#include "lyxtextclasslist.h"
#include "frontends/Dialogs.h"
@ -58,15 +58,15 @@ Inset * InsetBibKey::clone(Buffer const &, bool) const
}
void InsetBibKey::setCounter(int c)
{
counter = c;
void InsetBibKey::setCounter(int c)
{
counter = c;
}
// 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
// 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)
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)
{
{
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")) {
style = MakeAbsPath(style, buffer->filePath());
}
@ -169,7 +169,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
}
// bibtotoc-Option
if (!bibtotoc.empty()) {
if (!bibtotoc.empty()) {
// maybe a problem when a textclass has no "art" as
// part of its name, because it's than book.
// For the "official" lyx-layouts it's no problem to support
@ -189,7 +189,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
} else {
// 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;
while (!adb.empty()) {
if (!buffer->niceFile &&
IsFileReadable(MakeAbsPath(adb, buffer->filePath())+".bib"))
adb = os::external_path(MakeAbsPath(adb, buffer->filePath()));
IsFileReadable(MakeAbsPath(adb, buffer->filePath())+".bib"))
adb = os::external_path(MakeAbsPath(adb, buffer->filePath()));
db_out += adb;
db_out += ',';
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 (!file.empty())
vec.push_back(file);
// Get next file name
bibfiles = split(bibfiles, tmp, ',');
bibfiles = split(bibfiles, tmp, ',');
}
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());
if (!contains(contents, db)) {
if (!contents.empty())
if (!contents.empty())
contents += ",";
setContents(contents + db);
return true;
@ -314,7 +314,7 @@ bool InsetBibtex::delDatabase(string const & db)
setContents(subst(getContents(), tmp, ", "));
} else if (n == 0)
setContents(split(getContents(), bd, ','));
else
else
return false;
}
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)
// Does look like a hack? It is! (but will change at 0.13)
Paragraph * par = bv->buffer()->paragraph;
while (par) {
if (par->bibkey) {
int const wx = par->bibkey->width(bv, font);
@ -348,7 +348,7 @@ string const bibitemWidest(Buffer const * buffer)
Paragraph * par = buffer->paragraph;
InsetBibKey * bkey = 0;
LyXFont font;
while (par) {
if (par->bibkey) {
int const wx =
@ -361,9 +361,9 @@ string const bibitemWidest(Buffer const * buffer)
}
par = par->next();
}
if (bkey && !bkey->getBibLabel().empty())
return bkey->getBibLabel();
return "99";
}

View File

@ -1,12 +1,12 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
*
* ====================================================== */
#ifndef INSET_BIB_H
@ -22,9 +22,9 @@
class Buffer;
/** Used to insert bibitem's information (key and label)
Must be automatically inserted as the first object in a
bibliography paragraph.
bibliography paragraph.
*/
class InsetBibKey : public InsetCommand {
public:
@ -47,7 +47,7 @@ public:
///
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
bool deletable() const {
return false;
@ -63,7 +63,7 @@ public:
InsetBibKey * inset;
BufferView * view;
};
private:
///
int counter;
@ -74,7 +74,7 @@ private:
};
/** Used to insert BibTeX's information
/** Used to insert BibTeX's information
*/
class InsetBibtex : public InsetCommand {
public:
@ -96,9 +96,9 @@ public:
void edit(BufferView *, int x, int y, unsigned int button);
///
void edit(BufferView * bv, bool front = true);
///
///
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;
///
@ -108,9 +108,9 @@ public:
///
bool delDatabase(string const &);
///
bool display() const { return true; }
bool display() const { return true; }
///
struct Holder {
struct Holder {
InsetBibtex * inset;
BufferView * view;
};

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 2000-2001 The LyX Team.
*
@ -29,16 +29,16 @@ using std::endl;
int InsetButton::ascent(BufferView * bv, LyXFont const &) const
{
lyx::Assert(bv);
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
int width;
int ascent;
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);
} else {
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
{
lyx::Assert(bv);
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
int width;
int ascent;
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);
} else {
lyxfont::rectText(s, font, width, ascent, descent);
@ -76,13 +76,13 @@ int InsetButton::width(BufferView * bv, LyXFont const &) const
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
int width;
int ascent;
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);
} else {
lyxfont::rectText(s, font, width, ascent, descent);
@ -96,7 +96,7 @@ void InsetButton::draw(BufferView * bv, LyXFont const &,
int baseline, float & x, bool) const
{
lyx::Assert(bv);
Painter & pain = bv->painter();
// Draw it as a box with the LaTeX text
LyXFont font(LyXFont::ALL_SANE);

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 2000-2001 The LyX Team.
*

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* 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");
}
@ -87,7 +87,7 @@ void InsetCaption::draw(BufferView * bv, LyXFont const & f,
// Generate the label
string const label = _(fl) + " " + num + ":";
Painter & pain = bv->painter();
int const w = lyxfont::width(label, f);
pain.text(int(x), baseline, label, f);

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 2000-2001 The LyX Team.
@ -68,14 +68,14 @@ bool InsetCaption::display() const
inline
bool InsetCaption::needFullRow() const
bool InsetCaption::needFullRow() const
{
return true;
}
inline
Inset::Code InsetCaption::lyxCode() const
Inset::Code InsetCaption::lyxCode() const
{
return CAPTION_CODE;
}

View File

@ -1,10 +1,10 @@
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 2000-2001 The LyX Team.
*
*
* ====================================================== */
#include <config.h>
@ -76,8 +76,8 @@ void InsetCitation::edit(BufferView * bv, bool)
int InsetCitation::ascii(Buffer const *, ostream & os, int) const
{
os << "[" << getContents() << "]";
return 0;
os << "[" << getContents() << "]";
return 0;
}
// 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) {
if (*it != ' ') content += *it;
}
os << "{" << content << "}";
return 0;

View File

@ -1,11 +1,11 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 2000-2001 The LyX Team.
*
*
* ====================================================== */
#ifndef INSET_CITE_H
@ -17,7 +17,7 @@
#include "insetcommand.h"
/** Used to insert citations
/** Used to insert citations
*/
class InsetCitation : public InsetCommand {
public:
@ -39,7 +39,7 @@ public:
void edit(BufferView * bv, bool front = true);
///
int ascii(Buffer const *, std::ostream &, int linelen) const;
///
///
int latex(Buffer const *, std::ostream &, bool, bool) const;
///
void validate(LaTeXFeatures &) const;

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* 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
{
if (collapsed_)
if (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
{
if (collapsed_)
if (collapsed_)
return width_collapsed();
int widthCollapsed = width_collapsed();
@ -178,8 +178,8 @@ void InsetCollapsable::draw_collapsed(Painter & pain,
}
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const
{
if (need_update != NONE) {
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());
if (!cleared && (inset.need_update == InsetText::FULL ||
inset.need_update == InsetText::INIT ||
top_x != int(x) ||
top_baseline != baseline))
inset.need_update == InsetText::INIT ||
top_x != int(x) ||
top_baseline != baseline))
{
// we don't need anymore to clear here we just have to tell
// the underlying LyXText that it should do the RowClear!
@ -224,9 +224,9 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
top_baseline = baseline;
int const bl = baseline - ascent(bv, f) + ascent_collapsed();
draw_collapsed(pain, bl, old_x);
inset.draw(bv, f,
inset.draw(bv, f,
bl + descent_collapsed() + inset.ascent(bv, f),
x, cleared);
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,
unsigned int button)
unsigned int button)
{
UpdatableInset::edit(bv, xp, yp, button);
@ -313,7 +313,7 @@ void InsetCollapsable::insetUnlock(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)) {
LyXFont font(LyXFont::ALL_SANE);
@ -327,7 +327,7 @@ void InsetCollapsable::insetButtonPress(BufferView * bv,
bool InsetCollapsable::insetButtonRelease(BufferView * bv,
int x, int y, int button)
int x, int y, int button)
{
bool ret = false;
if ((button != 3) && (x >= 0) && (x < button_length) &&
@ -360,7 +360,7 @@ bool InsetCollapsable::insetButtonRelease(BufferView * bv,
void InsetCollapsable::insetMotionNotify(BufferView * bv,
int x, int y, int state)
int x, int y, int state)
{
if (y > button_bottom_y) {
LyXFont font(LyXFont::ALL_SANE);
@ -380,7 +380,7 @@ void InsetCollapsable::insetKeyPress(XKeyEvent * xke)
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);
}
@ -405,7 +405,7 @@ int InsetCollapsable::docbook(Buffer const * buf, ostream & os) const
#if 0
int InsetCollapsable::getMaxWidth(BufferView * bv,
UpdatableInset const * in) const
UpdatableInset const * in) const
{
#if 0
int const w = UpdatableInset::getMaxWidth(bv, in);
@ -425,7 +425,7 @@ int InsetCollapsable::getMaxWidth(BufferView * bv,
void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
bool reinit)
bool reinit)
{
if (in_update) {
if (reinit && owner()) {
@ -444,7 +444,7 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
UpdatableInset::RESULT
InsetCollapsable::localDispatch(BufferView * bv, kb_action action,
string const & arg)
string const & arg)
{
UpdatableInset::RESULT result = inset.localDispatch(bv, action, arg);
if (result >= FINISHED)
@ -463,7 +463,7 @@ bool InsetCollapsable::lockInsetInInset(BufferView * bv, UpdatableInset * in)
bool InsetCollapsable::unlockInsetInInset(BufferView * bv, UpdatableInset * in,
bool lr)
bool lr)
{
if (&inset == in) {
bv->unlockInset(this);
@ -535,7 +535,7 @@ UpdatableInset * InsetCollapsable::getFirstLockingInsetOfType(Inset::Code c)
void InsetCollapsable::setFont(BufferView * bv, LyXFont const & font,
bool toggleall, bool selectall)
bool toggleall, bool selectall)
{
inset.setFont(bv, font, toggleall, selectall);
}
@ -579,7 +579,7 @@ bool InsetCollapsable::nodraw() const
return inset.nodraw();
}
int InsetCollapsable::scroll(bool recursive) const
{
int sx = UpdatableInset::scroll(false);
@ -627,7 +627,7 @@ Inset * InsetCollapsable::getInsetFromID(int id_arg) const
void InsetCollapsable::open(BufferView * bv)
{
if (!collapsed_) return;
collapsed_ = false;
bv->updateInset(this, false);
}
@ -637,7 +637,7 @@ void InsetCollapsable::close(BufferView * bv) const
{
if (collapsed_)
return;
collapsed_ = true;
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 cs, bool mw)
bool cs, bool mw)
{
bool found = inset.searchForward(bv, str, cs, mw);
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 cs, bool mw)
bool cs, bool mw)
{
bool found = inset.searchBackward(bv, str, cs, mw);
if (first_after_edit && !found)

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 2000-2001 The LyX Team.
@ -28,7 +28,7 @@ class Paragraph;
class LyXCursor;
/** A collapsable text inset
*/
class InsetCollapsable : public UpdatableInset {
public:
@ -58,7 +58,7 @@ public:
///
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);
///
@ -83,7 +83,7 @@ public:
bool lockInsetInInset(BufferView *, UpdatableInset *);
///
bool unlockInsetInInset(BufferView *, UpdatableInset *,
bool lr = false);
bool lr = false);
///
bool updateInsetInInset(BufferView *, Inset *);
///
@ -98,7 +98,7 @@ public:
void insetKeyPress(XKeyEvent *);
///
UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
string const &);
string const &);
///
int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const;
@ -127,7 +127,7 @@ public:
UpdatableInset * getFirstLockingInsetOfType(Inset::Code);
///
void setFont(BufferView *, LyXFont const &, bool toggleall = false,
bool selectall = false);
bool selectall = false);
///
void setLabel(string const & l) const;
///
@ -188,9 +188,9 @@ public:
}
///
bool searchForward(BufferView * bv, string const & str,
bool = true, bool = false);
bool = true, bool = false);
bool searchBackward(BufferView * bv, string const & str,
bool = true, bool = false);
bool = true, bool = false);
protected:
///
@ -203,7 +203,7 @@ protected:
void draw_collapsed(Painter & pain, int , float &) const;
///
int getMaxTextWidth(Painter & pain, UpdatableInset const *) const;
///
mutable bool collapsed_;
///

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -84,7 +84,7 @@ void InsetCommandParams::scanCommand(string const & cmd)
if (cmd.empty()) return;
enum { WS, CMDNAME, OPTION, CONTENT } state = WS;
// Used to handle things like \command[foo[bar]]{foo{bar}}
int nestdepth = 0;
@ -105,11 +105,11 @@ void InsetCommandParams::scanCommand(string const & cmd)
}
if ((state == OPTION && c == '[') ||
(state == CONTENT && c == '{')) {
++nestdepth;
++nestdepth;
}
switch (state) {
case CMDNAME: tcmdname += c; break;
case OPTION: toptions += c; break;
case OPTION: toptions += c; break;
case CONTENT: tcontents += c; break;
case WS:
if (c == '\\') {
@ -128,7 +128,7 @@ void InsetCommandParams::scanCommand(string const & cmd)
// Don't mess with this.
if (!tcmdname.empty()) setCmdName(tcmdname);
if (!toptions.empty()) setOptions(toptions);
if (!tcontents.empty()) setContents(tcontents);
if (!tcontents.empty()) setContents(tcontents);
if (lyxerr.debugging(Debug::PARSER))
lyxerr << "Command <" << cmd
@ -141,7 +141,7 @@ void InsetCommandParams::scanCommand(string const & cmd)
// This function will not be necessary when lyx3
void InsetCommandParams::read(LyXLex & lex)
{
{
string token;
if (lex.eatLine()) {
@ -150,7 +150,7 @@ void InsetCommandParams::read(LyXLex & lex)
} else {
lex.printError("InsetCommand: Parse error: `$$Token'");
}
while (lex.isOK()) {
lex.nextToken();
token = lex.getString();
@ -171,7 +171,7 @@ void InsetCommandParams::write(ostream & os) const
string const InsetCommandParams::getCommand() const
{
{
string s;
if (!getCmdName().empty()) s += "\\"+getCmdName();
if (!getOptions().empty()) s += "["+getOptions()+']';

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -24,7 +24,7 @@
/** Used to insert a LaTeX command automatically
*
* Similar to InsetLaTeX but having control of the basic structure of a
* LaTeX command: \name[options]{contents}.
* LaTeX command: \name[options]{contents}.
*/
class InsetCommandParams {
public:
@ -64,11 +64,11 @@ public:
///
void setFromString(string const &);
private:
///
///
string cmdname;
///
///
string contents;
///
///
string options;
};
@ -89,7 +89,7 @@ public:
{ p_.read(lex); }
/// Can remove one InsetBibKey is modified
void scanCommand(string const & c) { p_.scanCommand(c); };
///
///
virtual int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const;
///
@ -100,7 +100,7 @@ public:
virtual int docbook(Buffer const *, std::ostream &) const;
///
Inset::Code lyxCode() const { return Inset::NO_CODE; }
///
string const getCommand() const { return p_.getCommand(); }
///

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -63,7 +63,7 @@ void InsetError::draw(BufferView * bv, LyXFont const & font,
LyXFont efont;
efont.setSize(font.size()).decSize();
efont.setColor(LColor::error);
// Draw as "Error" in a framed box
x += 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");
}

View File

@ -1,11 +1,11 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* 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>
/** Used for error messages from LaTeX runs.
The edit-operation opens a
dialog with the text of the error-message. The inset is displayed as
The edit-operation opens a
dialog with the text of the error-message. The inset is displayed as
"Error" in a box, and automatically deleted. */
class InsetError : public Inset {
public:

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1998 The LyX Team.
*
*======================================================*/
@ -89,7 +89,7 @@ InsetERT::InsetERT(BufferParams const & bp,
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
font.setColor(LColor::latex);
#endif
string::const_iterator cit = contents.begin();
string::const_iterator end = contents.end();
pos_type pos = 0;
@ -117,7 +117,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
if (token == "status") {
lex.next();
string const tmp_token = lex.getString();
if (tmp_token == "Inlined") {
status(0, Inlined);
} else if (tmp_token == "Collapsed") {
@ -126,7 +126,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
// leave this as default!
status(0, Open);
}
token_found = true;
} else {
lyxerr << "InsetERT::Read: Missing 'status'-tag!"
@ -155,7 +155,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
#ifdef SET_HARD_FONT
#ifndef INHERIT_LANG
LyXFont font(LyXFont::ALL_INHERIT, latex_language);
#else
#else
LyXFont font(LyXFont::ALL_INHERIT);
#endif
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
@ -169,7 +169,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
par = par->next();
}
#endif
if (!token_found) {
if (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;
switch (status_) {
case Open:
case Open:
st = "Open";
break;
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");
}
@ -247,8 +247,8 @@ void InsetERT::setFont(BufferView *, LyXFont const &, bool, bool selectall)
// fontchange and this messages is not needed
if (!selectall)
Alert::alert(_("Impossible Operation!"),
_("Not permitted to change font-types inside ERT-insets!"),
_("Sorry."));
_("Not permitted to change font-types inside ERT-insets!"),
_("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)
{
if (button == 3)
@ -300,7 +300,7 @@ void InsetERT::edit(BufferView * bv, bool front)
void InsetERT::insetButtonPress(BufferView * bv,
int x, int y, int button)
int x, int y, int button)
{
if (status_ == Inlined) {
inset.insetButtonPress(bv, x, y, button);
@ -316,15 +316,15 @@ bool InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
showInsetDialog(bv);
return true;
}
if (status_ != Inlined && (x >= 0) && (x < button_length) &&
(y >= button_top_y) && (y <= button_bottom_y)) {
updateStatus(bv, true);
} else {
LyXFont font(LyXFont::ALL_SANE);
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
if (status_ == Inlined) {
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,
int x, int y, int state)
int x, int y, int state)
{
if (status_ == Inlined) {
inset.insetMotionNotify(bv, x, y, state);
@ -373,13 +373,13 @@ int InsetERT::latex(Buffer const *, ostream & os, bool /*fragile*/,
lines += 2;
}
}
return lines;
}
int InsetERT::ascii(Buffer const *,
ostream &, int /*linelen*/) const
ostream &, int /*linelen*/) const
{
return 0;
}
@ -409,7 +409,7 @@ int InsetERT::linuxdoc(Buffer const *, ostream & os) const
lines ++;
}
}
return lines;
}
@ -438,7 +438,7 @@ int InsetERT::docbook(Buffer const *, ostream & os) const
lines ++;
}
}
return lines;
}
@ -470,7 +470,7 @@ InsetERT::localDispatch(BufferView * bv, kb_action action, string const & arg)
case LFUN_CUT:
set_latex_font(bv);
break;
default:
break;
}
@ -517,7 +517,7 @@ bool InsetERT::checkInsertChar(LyXFont & /* font */)
#ifdef SET_HARD_FONT
#ifndef INHERIT_LANG
LyXFont f(LyXFont::ALL_INHERIT, latex_language);
#else
#else
LyXFont f(LyXFont::ALL_INHERIT);
#endif
font = f;
@ -555,8 +555,8 @@ int InsetERT::width(BufferView * bv, LyXFont const & font) const
}
void InsetERT::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const
void InsetERT::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const
{
Painter & pain = bv->painter();
@ -577,9 +577,9 @@ void InsetERT::draw(BufferView * bv, LyXFont const & f,
x += static_cast<float>(scroll());
if (!cleared && (inset.need_update == InsetText::FULL ||
inset.need_update == InsetText::INIT ||
top_x != int(x) ||
top_baseline != baseline))
inset.need_update == InsetText::INIT ||
top_x != int(x) ||
top_baseline != baseline))
{
// we don't need anymore to clear here we just have to tell
// 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);
} else {
draw_collapsed(pain, bl, old_x);
inset.draw(bv, f,
inset.draw(bv, f,
bl + descent_collapsed() + inset.ascent(bv, f),
x, cleared);
}
@ -611,7 +611,7 @@ void InsetERT::set_latex_font(BufferView * /* bv */)
#ifdef SET_HARD_FONT
#ifndef INHERIT_LANG
LyXFont font(LyXFont::ALL_INHERIT, latex_language);
#else
#else
LyXFont font(LyXFont::ALL_INHERIT);
#endif
@ -675,7 +675,7 @@ void InsetERT::close(BufferView * bv) const
string const InsetERT::selectNextWordToSpellcheck(BufferView * bv,
float &) const
float &) const
{
bv->unlockInset(const_cast<InsetERT *>(this));
return string();
@ -686,7 +686,7 @@ void InsetERT::getDrawFont(LyXFont & font) const
{
#ifndef INHERIT_LANG
LyXFont f(LyXFont::ALL_INHERIT, latex_language);
#else
#else
LyXFont f(LyXFont::ALL_INHERIT);
#endif
font = f;

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
@ -22,12 +22,12 @@
#include <sigc++/signal_system.h>
/** A collapsable text inset for LaTeX insertions.
To write full ert (including styles and other insets) in a given
space.
Note that collapsed_ encompasses both the inline and collapsed button
versions of this inset.
versions of this inset.
*/
class Language;
@ -65,7 +65,7 @@ public:
bool insetAllowed(Inset::Code) const { return false; }
///
void setFont(BufferView *, LyXFont const &,
bool toggleall = false, bool selectall = false);
bool toggleall = false, bool selectall = false);
///
void edit(BufferView *, int, int, unsigned int);
///
@ -85,7 +85,7 @@ public:
bool free_spc) const;
///
int ascii(Buffer const *,
std::ostream &, int linelen = 0) const;
std::ostream &, int linelen = 0) const;
///
int linuxdoc(Buffer const *, std::ostream &) const;
///
@ -94,7 +94,7 @@ public:
void validate(LaTeXFeatures &) const {}
///
UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
string const &);
string const &);
///
bool checkInsertChar(LyXFont &);
///

View File

@ -2,7 +2,7 @@
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -40,7 +40,7 @@ using std::ostream;
using std::endl;
InsetExternal::InsetExternal()
InsetExternal::InsetExternal()
: view_(0)
{
tempname_ = lyx::tempName(string(), "lyxext");
@ -60,14 +60,14 @@ InsetExternal::Params InsetExternal::params() const
{
return params_;
}
void InsetExternal::setFromParams(Params const & p)
{
params_.filename = p.filename;
params_.parameters = p.parameters;
params_.templ = p.templ;
}
}
string const InsetExternal::editMessage() const
@ -108,7 +108,7 @@ void InsetExternal::read(Buffer const *, LyXLex & lex)
} else {
lex.printError("InsetExternal: Parse error: `$$Token'");
}
while (lex.isOK()) {
lex.nextToken();
token = lex.getString();
@ -145,7 +145,7 @@ int InsetExternal::write(string const & format,
<< params_.templ.lyxName << endl;
return 0;
}
updateExternal(format, buf);
os << doSubstitution(buf, cit->second.product);
return 0; // CHECK (FIXME check what ? - jbl)
@ -185,7 +185,7 @@ void InsetExternal::validate(LaTeXFeatures & features) const
if (cit == et.formats.end())
return;
if (!cit->second.requirement.empty()) {
features.require(cit->second.requirement);
}
@ -245,7 +245,7 @@ string const InsetExternal::doSubstitution(Buffer const * buffer,
result = ReplaceEnvironmentPath(result);
result = subst(result, "$$Tempname", tempname_);
result = subst(result, "$$Sysdir", system_lyxdir);
// Handle the $$Contents(filename) syntax
if (contains(result, "$$Contents(\"")) {
@ -271,7 +271,7 @@ string const InsetExternal::doSubstitution(Buffer const * buffer,
void InsetExternal::updateExternal() const
{
updateExternal("LaTeX", view_->buffer());
updateExternal("LaTeX", view_->buffer());
}
void InsetExternal::updateExternal(string const & format,
@ -285,7 +285,7 @@ void InsetExternal::updateExternal(string const & format,
cit->second.updateCommand.empty() ||
!et.automaticProduction)
return;
if (!cit->second.updateResult.empty()) {
string const resultfile = doSubstitution(buf,
cit->second.updateResult);
@ -294,7 +294,7 @@ void InsetExternal::updateExternal(string const & format,
if (fi2.exist() && fi.exist() &&
::difftime(fi2.getModificationTime(),
fi.getModificationTime()) >= 0) {
lyxerr[Debug::FILES] << resultfile
lyxerr[Debug::FILES] << resultfile
<< " is up to date" << endl;
return;
}
@ -342,6 +342,5 @@ bool operator==(InsetExternal::Params const & left,
bool operator!=(InsetExternal::Params const & left,
InsetExternal::Params const & right)
{
return !(left == right);
return !(left == right);
}

View File

@ -3,7 +3,7 @@
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -26,8 +26,8 @@ class InsetExternal : public InsetButton {
public:
/// hold parameters settable from the GUI
struct Params {
Params(string const & f = string(),
string const & p = string(),
Params(string const & f = string(),
string const & p = string(),
ExternalTemplate const & t = ExternalTemplate())
: filename(f), parameters(p), templ(t) {}
/// the filename
@ -61,7 +61,7 @@ public:
is in a free-spacing paragraph.
*/
virtual int latex(Buffer const *, std::ostream &, bool fragile,
bool free_spc) const;
bool free_spc) const;
/// write ASCII output to the ostream
virtual int ascii(Buffer const *, std::ostream &, int linelen) const;
/// write LinuxDoc output to the ostream
@ -74,7 +74,7 @@ public:
/// returns LyX code associated with the inset. Used for TOC, ...)
virtual Inset::Code lyxCode() const { return EXTERNAL_CODE; }
///
virtual Inset * clone(Buffer const &, bool same_id = false) const;

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1998-2001 The LyX Team.
*
* ====================================================== */
@ -61,7 +61,7 @@ using std::endl;
// within - This (optional) argument determines whether floats of this
// class will be numbered within some sectional unit of 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}
// style - plain, boxed, ruled
// \floatname{float}{floatname}
@ -143,7 +143,7 @@ void InsetFloat::write(Buffer const * buf, ostream & os) const
} else {
os << "wide false\n";
}
InsetCollapsable::write(buf, os);
}
@ -187,7 +187,7 @@ void InsetFloat::validate(LaTeXFeatures & features) const
if (contains(placement(), "H")) {
features.require("float");
}
features.useFloat(floatType_);
InsetCollapsable::validate(features);
}
@ -224,18 +224,18 @@ int InsetFloat::latex(Buffer const * buf,
&& buf_placement != def_placement) {
placement = buf_placement;
}
os << "\\begin{" << tmptype << "}";
// We only output placement if different from the def_placement.
if (!placement.empty()) {
os << "[" << placement << "]";
}
os << "%\n";
int const i = inset.latex(buf, os, fragile, fp);
os << "\\end{" << tmptype << "}%\n";
return i + 2;
}
@ -265,13 +265,13 @@ bool InsetFloat::insetAllowed(Inset::Code code) const
bool InsetFloat::showInsetDialog(BufferView * bv) const
{
if (!inset.showInsetDialog(bv)) {
bv->owner()->getDialogs()->showFloat(const_cast<InsetFloat *>(this));
bv->owner()->getDialogs()->showFloat(const_cast<InsetFloat *>(this));
}
return true;
}
string const & InsetFloat::type() const
string const & InsetFloat::type() const
{
return floatType_;
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
@ -22,7 +22,7 @@
class Painter;
/** The float inset
*/
class InsetFloat : public InsetCollapsable {
public:

View File

@ -23,7 +23,7 @@ InsetFloatList::InsetFloatList()
{
}
InsetFloatList::InsetFloatList(string const & type)
: 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();
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;

View File

@ -3,10 +3,10 @@
* ======================================================
*
* LyX, The Document Word Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1996-2001 The LyX Team.
*
*
* ====================================================== */
#ifndef INSET_FLOATLIST_H

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1998 The LyX Team.
*
* ======================================================
@ -59,9 +59,9 @@ int InsetFoot::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
{
os << "%\n\\footnote{";
int const i = inset.latex(buf, os, fragile, fp);
os << "%\n}";
return i + 2;
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
@ -22,7 +22,7 @@
#include "insetfootlike.h"
/** The footnote inset
*/
class InsetFoot : public InsetFootlike {
public:
@ -41,6 +41,3 @@ public:
};
#endif

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* 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";
InsetCollapsable::write(buf, os);

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
@ -23,7 +23,7 @@
// To have this class is probably a bit overkill... (Lgb)
/** The footnote inset
*/
class InsetFootlike : public InsetCollapsable {
public:
@ -38,8 +38,3 @@ public:
};
#endif

View File

@ -1,35 +1,35 @@
/* This file is part of
* ======================================================
*
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995-2002 the LyX Team.
*
*
* \author Baruch Even
* \author Herbert Voss <voss@lyx.org>
* ====================================================== */
/*
Known BUGS:
* 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.
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
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.
Note that browseRelFile in helper_funcs.* provides a file name
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
`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
done know for include insets. Feel free to ask me -- JMarc
14/01/2002
TODO Before initial production release:
* What advanced features the users want to do?
Implement them in a non latex dependent way, but a logical way.
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.
* 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.
*
*
*
* Conversions:
* Postscript output means EPS figures.
*
* PDF output is best done with PDF figures if it's a direct conversion
* or PNG figures otherwise.
* Image format
* from to
* EPS epstopdf
* PS ps2pdf
* JPG/PNG direct
* PDF direct
* others PNG
* Image format
* from to
* EPS epstopdf
* PS ps2pdf
* JPG/PNG direct
* PDF direct
* others PNG
*/
#include <config.h>
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#endif
#include "insets/insetgraphics.h"
#include "insets/insetgraphicsParams.h"
@ -120,7 +120,7 @@ string const RemoveExtension(string const & filename)
{
return ChangeExtension(filename, string());
}
} // namespace anon
@ -143,7 +143,7 @@ string const unique_id()
InsetGraphics::InsetGraphics()
: graphic_label(unique_id()),
cached_status_(grfx::ErrorUnknown), cache_filled_(false), old_asc(0)
{}
@ -230,7 +230,7 @@ bool InsetGraphics::drawImage() const
return pixmap != 0;
}
int InsetGraphics::ascent(BufferView *, LyXFont const &) const
{
old_asc = 50;
@ -268,18 +268,18 @@ int InsetGraphics::width(BufferView *, LyXFont const & font) const
int const msg_width = lyxfont::width(msg, msgFont);
font_width = std::max(font_width, msg_width);
}
return std::max(50, font_width + 15);
}
}
void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
int baseline, float & x, bool) const
int baseline, float & x, bool) const
{
int oasc = old_asc;
grfx::ImageStatus old_status_ = cached_status_;
int ldescent = descent(bv, font);
int lascent = ascent(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,
// we draw just a rectangle.
Painter & paint = bv->painter();
if (drawImage()) {
// lyxerr << "IG(" << this << "): " << old_x << endl;
paint.image(old_x + 2, baseline - lascent,
lwidth - 4, lascent + ldescent,
lwidth - 4, lascent + ldescent,
*cached_image_.get());
} else {
paint.rectangle(old_x + 2, baseline - lascent,
lwidth - 4,
lascent + ldescent);
lwidth - 4,
lascent + ldescent);
// Print the file name.
LyXFont msgFont(font);
@ -326,7 +326,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
string const justname = OnlyFilename (params().filename);
if (!justname.empty()) {
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
paint.text(old_x + 8,
paint.text(old_x + 8,
baseline - lyxfont::maxAscent(msgFont) - 4,
justname, msgFont);
}
@ -344,7 +344,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
if (old_status_ != grfx::ErrorUnknown && old_status_ != cached_status_) {
bv->getLyXText()->status(bv, LyXText::CHANGED_IN_DRAW);
}
// Reset the cache, ready for the next draw request
cached_status_ = grfx::ErrorUnknown;
cached_image_.reset(0);
@ -409,7 +409,7 @@ void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex)
lex.next();
string const token = lex.getString();
lyxerr[Debug::GRAPHICS] << "Token: '" << token << '\''
lyxerr[Debug::GRAPHICS] << "Token: '" << token << '\''
<< std::endl;
if (token.empty()) {
@ -429,7 +429,7 @@ void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex)
}
else {
if (! params_.Read(buf, lex, token))
lyxerr << "Unknown token, " << token << ", skipping."
lyxerr << "Unknown token, " << token << ", skipping."
<< std::endl;
}
}
@ -441,12 +441,12 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
std::vector<string> const oldUnits =
getVectorFromString("pt,cm,in,p%,c%");
bool finished = false;
// set the display default
if (lyxrc.display_graphics == "mono")
// set the display default
if (lyxrc.display_graphics == "mono")
params_.display = InsetGraphicsParams::MONOCHROME;
else if (lyxrc.display_graphics == "gray")
else if (lyxrc.display_graphics == "gray")
params_.display = InsetGraphicsParams::GRAYSCALE;
else if (lyxrc.display_graphics == "color")
else if (lyxrc.display_graphics == "color")
params_.display = InsetGraphicsParams::COLOR;
else
params_.display = InsetGraphicsParams::NONE;
@ -455,7 +455,7 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
string const token = lex.getString();
lyxerr[Debug::GRAPHICS] << "Token: " << token << endl;
if (token.empty())
continue;
else if (token == "\\end_inset") {
@ -488,11 +488,11 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
} else if (token == "flags") {
if (lex.next())
switch (lex.getInteger()) {
case 1: params_.display = InsetGraphicsParams::MONOCHROME;
case 1: params_.display = InsetGraphicsParams::MONOCHROME;
break;
case 2: params_.display = InsetGraphicsParams::GRAYSCALE;
case 2: params_.display = InsetGraphicsParams::GRAYSCALE;
break;
case 3: params_.display = InsetGraphicsParams::COLOR;
case 3: params_.display = InsetGraphicsParams::COLOR;
break;
}
} else if (token == "subfigure") {
@ -571,7 +571,7 @@ string findTargetFormat(string const & suffix)
{
// lyxrc.pdf_mode means:
// 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 = "
<< lyxrc.pdf_mode << std::endl;
if (lyxrc.pdf_mode) {
@ -612,7 +612,7 @@ string const InsetGraphics::prepareFile(Buffer const *buf) const
bool const zipped = zippedFile(filename_);
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;
return filename_;
}
@ -676,9 +676,9 @@ int InsetGraphics::latex(Buffer const *buf, ostream & os,
// Return how many newlines we issued.
int const newlines =
int(lyx::count(latex_str.begin(), latex_str.end(),'\n') + 1);
// lyxerr << "includegraphics: " << newlines << " lines of text"
// << endl;
// << endl;
return newlines;
}
@ -707,8 +707,8 @@ int InsetGraphics::linuxdoc(Buffer const *, ostream &) const
// See also the docbook guide at http://www.docbook.org/
int InsetGraphics::docbook(Buffer const *, ostream & os) const
{
// 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
// 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
// easier to use.
os << "<graphic fileref=\"&" << graphic_label << ";\">";
return 0;

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 the LyX Team.
*
@ -17,7 +17,7 @@
#ifdef __GNUG__
#pragma interface
#endif
#endif
#include "graphics/GraphicsTypes.h"
#include "insets/inset.h"
@ -61,7 +61,7 @@ public:
fragile commands by adding a #\protect# before.
*/
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;
///
@ -103,7 +103,7 @@ private:
void readInsetGraphics(Buffer const * buf, LyXLex & lex);
/// Read the FigInset file format
void readFigInset(Buffer const * buf, LyXLex & lex);
/// Update the inset after parameter change.
void updateInset() const;
/// Get the status message, depends on the image loading status.
@ -129,4 +129,4 @@ private:
mutable int old_asc;
};
#endif
#endif

View File

@ -1,6 +1,6 @@
/* This file is part of
* =================================================
*
*
* LyX, The Document Processor
* Copyright 1995 Matthias Ettrich.
* Copyright 1995-2001 The LyX Team.
@ -10,11 +10,11 @@
*
* ================================================= */
#include <config.h>
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#endif
#include "insetgraphicsParams.h"
@ -43,7 +43,7 @@ displayTranslator(InsetGraphicsParams::DEFAULT, "default");
// it is obselete until 1.3
LyXLength convertResizeValue(string const token, LyXLex & lex) {
lex.next();
string value = lex.getString(); // "width" or "height"
string value = lex.getString(); // "width" or "height"
lex.next(); // anyway not interesting
value = lex.getString();
if (token == "default")
@ -114,7 +114,7 @@ void InsetGraphicsParams::init()
size_type = DEFAULT_SIZE; // do nothing
lyxsize_type = DEFAULT_SIZE; // do nothing
keepAspectRatio = false; // only for latex
rotate = false; // Rotating
rotate = false; // Rotating
rotateOrigin = "center"; // Origin
rotateAngle = 0.0; // in degrees
special = string(); // userdefined stuff
@ -146,29 +146,29 @@ void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
}
bool operator==(InsetGraphicsParams const & left,
InsetGraphicsParams const & right)
InsetGraphicsParams const & right)
{
if (left.filename == right.filename &&
left.bb == right.bb &&
left.draft == right.draft &&
left.clip == right.clip &&
left.display == right.display &&
left.subcaption == right.subcaption &&
left.bb == right.bb &&
left.draft == right.draft &&
left.clip == right.clip &&
left.display == right.display &&
left.subcaption == right.subcaption &&
left.noUnzip == right.noUnzip &&
left.subcaptionText == right.subcaptionText &&
left.keepAspectRatio == right.keepAspectRatio &&
left.width == right.width &&
left.height == right.height &&
left.scale == right.scale &&
left.size_type == right.size_type &&
left.lyxsize_type == right.lyxsize_type &&
left.lyxwidth == right.lyxwidth &&
left.lyxheight == right.lyxheight &&
left.lyxscale == right.lyxscale &&
left.rotate == right.rotate &&
left.rotateOrigin == right.rotateOrigin &&
lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
left.special == right.special)
left.subcaptionText == right.subcaptionText &&
left.keepAspectRatio == right.keepAspectRatio &&
left.width == right.width &&
left.height == right.height &&
left.scale == right.scale &&
left.size_type == right.size_type &&
left.lyxsize_type == right.lyxsize_type &&
left.lyxwidth == right.lyxwidth &&
left.lyxheight == right.lyxheight &&
left.lyxscale == right.lyxscale &&
left.rotate == right.rotate &&
left.rotateOrigin == right.rotateOrigin &&
lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
left.special == right.special)
)
return true;
@ -176,9 +176,9 @@ 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,
string const& token)
string const& token)
{
if (token == "filename") {
lex.next();

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* =================================================
*
*
* LyX, The Document Processor
* Copyright 1995 Matthias Ettrich.
* Copyright 1995-2002 The LyX Team.
@ -15,7 +15,7 @@
#ifdef __GNUG__
#pragma interface
#endif
#endif
#include "LString.h"
@ -51,7 +51,7 @@ struct InsetGraphicsParams
string rotateOrigin;
/// Rotation angle.
float rotateAngle;
/// clip image
/// clip image
bool clip;
/// draft mode
bool draft;
@ -59,7 +59,7 @@ struct InsetGraphicsParams
bool noUnzip;
/// The bounding box with "xLB yLB yRT yRT ", divided by a space!
string bb;
/// Type of rescaling
/// Type of rescaling
sizeType size_type;
/// three possible values for rescaling (latex)
LyXLength width;
@ -104,4 +104,4 @@ bool operator==(InsetGraphicsParams const &, InsetGraphicsParams const &);
///
bool operator!=(InsetGraphicsParams const &, InsetGraphicsParams const &);
#endif
#endif

View File

@ -77,7 +77,7 @@ bool InsetInclude::Params::operator==(Params const & o) const
if (cparams == o.cparams && flag == o.flag &&
noload == o.noload && masterFilename_ == o.masterFilename_)
return true;
return false;
}
@ -94,22 +94,22 @@ void InsetInclude::set(Params const & p)
// Just to be safe...
string command;
switch (params_.flag) {
case INCLUDE:
command="include";
break;
case VERB:
command="verbatiminput";
break;
case INPUT:
command="input";
break;
case VERBAST:
command="verbatiminput*";
break;
case INCLUDE:
command="include";
break;
case VERB:
command="verbatiminput";
break;
case INPUT:
command="input";
break;
case VERBAST:
command="verbatiminput*";
break;
}
params_.cparams.setCmdName(command);
}
@ -144,7 +144,7 @@ void InsetInclude::write(Buffer const *, ostream & os) const
void InsetInclude::read(Buffer const *, LyXLex & lex)
{
params_.cparams.read(lex);
if (params_.cparams.getCmdName() == "include")
params_.flag = INCLUDE;
else if (params_.cparams.getCmdName() == "input")
@ -176,7 +176,7 @@ string const InsetInclude::getScreenLabel(Buffer const *) const
}
temp += ": ";
if (params_.cparams.getContents().empty())
temp += "???";
else
@ -191,7 +191,7 @@ string const InsetInclude::getRelFileBaseName() const
return OnlyFilename(ChangeExtension(params_.cparams.getContents(), string()));
}
string const InsetInclude::getFileName() const
{
return MakeAbsPath(params_.cparams.getContents(),
@ -212,15 +212,15 @@ bool InsetInclude::loadIfNeeded() const
if (!IsLyXFilename(getFileName()))
return false;
if (bufferlist.exists(getFileName()))
return true;
// the readonly flag can/will be wrong, not anymore I think.
FileInfo finfo(getFileName());
if (!finfo.isOK())
return false;
return bufferlist.readFile(getFileName(), !finfo.writable()) != 0;
}
@ -229,11 +229,11 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os,
bool /*fragile*/, bool /*fs*/) const
{
string incfile(params_.cparams.getContents());
// Do nothing if no file name has been specified
if (incfile.empty())
return 0;
if (loadIfNeeded()) {
Buffer * tmp = bufferlist.getBuffer(getFileName());
@ -248,7 +248,7 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os,
<< "'." << endl;
//return 0;
}
// write it to a file (so far the complete file)
string writefile = ChangeExtension(getFileName(), ".tex");
@ -264,9 +264,9 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os,
writefile = ChangeExtension(writefile, ".tex");
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
tmp->markDepClean(buffer->tmppath);
tmp->makeLaTeXFile(writefile,
OnlyPath(getMasterFilename()),
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
{
string incfile(params_.cparams.getContents());
// Do nothing if no file name has been specified
if (incfile.empty())
return 0;
if (loadIfNeeded()) {
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] << "writefile:" << writefile << endl;
tmp->makeLinuxDocFile(writefile, buffer->niceFile, true);
}
@ -337,7 +337,7 @@ int InsetInclude::linuxdoc(Buffer const * buffer, ostream & os) const
<< "]]>";
} else
os << '&' << include_label << ';';
return 0;
}
@ -349,7 +349,7 @@ int InsetInclude::docbook(Buffer const * buffer, ostream & os) const
// Do nothing if no file name has been specified
if (incfile.empty())
return 0;
if (loadIfNeeded()) {
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] << "writefile:" << writefile << endl;
tmp->makeDocBookFile(writefile, buffer->niceFile, true);
}
@ -375,7 +375,7 @@ int InsetInclude::docbook(Buffer const * buffer, ostream & os) const
<< "\" format=\"linespecific\">";
} else
os << '&' << include_label << ';';
return 0;
}
@ -435,13 +435,13 @@ vector<string> const InsetInclude::getLabelList() const
vector<pair<string,string> > const InsetInclude::getKeys() const
{
vector<pair<string,string> > keys;
if (loadIfNeeded()) {
Buffer * tmp = bufferlist.getBuffer(getFileName());
tmp->setParentName("");
keys = tmp->getBibkeyList();
tmp->setParentName(getMasterFilename());
}
return keys;
}

View File

@ -3,7 +3,7 @@
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1997 LyX Team (this file was created this year)
*
* ====================================================== */
@ -26,8 +26,8 @@ struct LaTeXFeatures;
*/
class InsetInclude: public InsetButton, boost::noncopyable {
public:
/// the type of inclusion
enum Flags {
/// the type of inclusion
enum Flags {
///
INCLUDE = 0,
///
@ -91,7 +91,7 @@ public:
void read(Buffer const *, LyXLex &);
///
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;
///
@ -100,36 +100,36 @@ public:
int docbook(Buffer const *, std::ostream &) const;
///
void validate(LaTeXFeatures &) const;
/** Input inserts anything inside a paragraph.
/** Input inserts anything inside a paragraph.
Display can give some visual feedback
*/
bool display() const;
/// return the filename stub of the included file
/// return the filename stub of the included file
string const getRelFileBaseName() const;
/// return true if the included file is not loaded
bool isIncludeOnly() const;
/// return true if the file is or got loaded.
bool loadIfNeeded() const;
/// hide a dialog if about
/// hide a dialog if about
SigC::Signal0<void> hideDialog;
private:
/// get the text displayed on the button
string const getScreenLabel(Buffer const *) const;
/// is this a verbatim include ?
bool isVerbatim() const;
/// get the filename of the master buffer
string const getMasterFilename() const;
/// get the included file name
string const getFileName() const;
/// get the filename of the master buffer
string const getMasterFilename() const;
/// get the included file name
string const getFileName() const;
/// the parameters
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;
};

View File

@ -46,7 +46,7 @@ int InsetIndex::docbook(Buffer const *, ostream & os) 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
{
return Inset::INDEX_PRINT_CODE;
return Inset::INDEX_PRINT_CODE;
}

View File

@ -1,12 +1,12 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1996-2001 the LyX Team.
*
*
* ====================================================== */
#ifndef INSET_INDEX_H
@ -20,7 +20,7 @@
struct LaTeXFeatures;
/** Used to insert index labels
/** Used to insert index labels
*/
class InsetIndex : public InsetCommand {
public:

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*

View File

@ -3,7 +3,7 @@
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team
*
@ -40,7 +40,7 @@ public:
std::vector<string> const getLabelList() const;
///
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;
///

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -43,9 +43,9 @@ InsetLatexAccent::InsetLatexAccent(string const & str)
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) {
lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl;
@ -90,80 +90,80 @@ void InsetLatexAccent::checkContents()
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;
return;
}
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
modtype = ACUTE; // acute
plusasc = true; // at the top of character
break;
modtype = ACUTE; // acute
plusasc = true; // at the top of character
break;
case '`': // grave
modtype = GRAVE; // grave
plusasc = true; // at the top
break;
modtype = GRAVE; // grave
plusasc = true; // at the top
break;
case '=': // macron
modtype = MACRON; // macron
plusasc = true; // at the top
break;
modtype = MACRON; // macron
plusasc = true; // at the top
break;
case '~': // tilde
modtype = TILDE; // tilde
plusasc = true; // at the top
break;
modtype = TILDE; // tilde
plusasc = true; // at the top
break;
case 'b': // underbar
modtype = UNDERBAR; // underbar
plusdesc = true; // at the bottom
break;
modtype = UNDERBAR; // underbar
plusdesc = true; // at the bottom
break;
case 'c': // cedilla
modtype = CEDILLA; // cedilla
plusdesc = true; // at the bottom
break;
modtype = CEDILLA; // cedilla
plusdesc = true; // at the bottom
break;
case 'd': // underdot
modtype = UNDERDOT; // underdot
plusdesc = true; // at the bottom
break;
modtype = UNDERDOT; // underdot
plusdesc = true; // at the bottom
break;
case 'r': // circle
modtype = CIRCLE; // circle
plusasc = true; // at the top
break;
modtype = CIRCLE; // circle
plusasc = true; // at the top
break;
case 't': // tie
modtype = TIE; // tie
plusasc = true; // at the top
break;
modtype = TIE; // tie
plusasc = true; // at the top
break;
case 'u': // breve
modtype = BREVE; // breve
plusasc = true; // at the top
break;
modtype = BREVE; // breve
plusasc = true; // at the top
break;
case 'v': // caron
modtype = CARON; // caron
plusasc = true; // at the top
break;
modtype = CARON; // caron
plusasc = true; // at the top
break;
case 'q': // special caron
modtype = SPECIAL_CARON; // special caron
plusasc = true; // at the top
break;
modtype = SPECIAL_CARON; // special caron
plusasc = true; // at the top
break;
case 'H': // hungarian umlaut
modtype = HUNGARIAN_UMLAUT; // hungarian umlaut
plusasc = true; // at the top
break;
modtype = HUNGARIAN_UMLAUT; // hungarian umlaut
plusasc = true; // at the top
break;
case '"': // umlaut
modtype = UMLAUT; // umlaut
plusasc = true; // at the top
break;
modtype = UMLAUT; // umlaut
plusasc = true; // at the top
break;
case '.': // dot
modtype = DOT; // dot
plusasc = true; // at the top
break;
modtype = DOT; // dot
plusasc = true; // at the top
break;
case '^': // circumflex
modtype = CIRCUMFLEX; // circumflex
plusasc = true; // at the top
break;
modtype = CIRCUMFLEX; // circumflex
plusasc = true; // at the top
break;
case 'k': // ogonek
modtype = OGONEK; // ogonek
plusdesc = true;
@ -178,19 +178,19 @@ void InsetLatexAccent::checkContents()
plusasc = true; // at the top (not really needed)
remdot = true;
break;
case 'l': // lslash
modtype = lSLASH;
plusasc = true; // at the top (not really needed)
break;
case 'L': // lslash
modtype = LSLASH;
plusasc = true; // at the top (not really needed)
break;
case 'l': // lslash
modtype = lSLASH;
plusasc = true; // at the top (not really needed)
break;
case 'L': // lslash
modtype = LSLASH;
plusasc = true; // at the top (not really needed)
break;
default:
lyxerr[Debug::KEY] << "Default" << endl;
// unknow accent (or something else)
return;
}
return;
}
// we demand that third char is a '{' (Lgb)
if (contents[2] != '{') return;
@ -211,17 +211,17 @@ void InsetLatexAccent::checkContents()
}
//ic = (modtype == DOT_LESS_J ? 'j' : 'i');
lyxerr[Debug::KEY] << "Contents: [" << contents << "]"
<< ", ic: " << ic
<< ", top: " << plusasc
<< ", bot: " << plusdesc
<< ", dot: " << remdot
<< ", ic: " << ic
<< ", top: " << plusasc
<< ", bot: " << plusdesc
<< ", dot: " << remdot
<< ", mod: " << modtype << endl;
// Special case for space
} else if (contents[3] == '}') {
ic = ' ';
} else {
int i = 3;
// now get the char
ic = contents[3]; // i will always be 3 here
@ -244,20 +244,20 @@ void InsetLatexAccent::checkContents()
contents= temp;
++i;
remdot = true;
}
}
// demand a '}' at the end
if (contents[++i] != '}' && contents[++i]) return;
// fine, the char is properly decoded now (hopefully)
lyxerr[Debug::KEY] << "Contents: [" << contents << "]"
<< ", ic: " << ic
<< ", top: " << plusasc
<< ", bot: " << plusdesc
<< ", top: " << plusasc
<< ", bot: " << plusdesc
<< ", dot: " << remdot
<< ", mod: " << modtype << endl;
}
candisp = true;
candisp = true;
}
@ -273,7 +273,7 @@ int InsetLatexAccent::ascent(BufferView *, LyXFont const & font) const
max = lyxfont::ascent('a', font);
else
max = lyxfont::ascent(ic, font);
if (plusasc)
if (plusasc)
max += (lyxfont::maxAscent(font) + 3) / 3;
} else
max = lyxfont::maxAscent(font) + 4;
@ -285,12 +285,12 @@ int InsetLatexAccent::descent(BufferView *, LyXFont const & font) const
{
int max;
if (candisp) {
if (ic == ' ')
if (ic == ' ')
max = lyxfont::descent('a', font);
else
max = lyxfont::descent(ic, font);
if (plusdesc)
max += 3;
else
max = lyxfont::descent(ic, font);
if (plusdesc)
max += 3;
} else
max = lyxfont::maxDescent(font) + 4;
return max;
@ -301,8 +301,8 @@ int InsetLatexAccent::width(BufferView *, LyXFont const & font) const
{
if (candisp)
return lyxfont::width(ic, font);
else
return lyxfont::width(contents, font) + 4;
else
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,
int baseline,
int baseline,
float & x) const
{
unsigned char tmpic = ic;
switch (modtype) {
case CEDILLA:
{
@ -346,7 +346,7 @@ bool InsetLatexAccent::displayISO8859_9(BufferView * bv, LyXFont const & font,
if (ic == 'U') tmpic = 0xdc;
break;
}
case DOT: if (ic == 'I') tmpic = 0xdd; break;
case DOT: if (ic == 'I') tmpic = 0xdd; break;
case DOT_LESS_I: tmpic = 0xfd; break;
default: return false;
}
@ -367,10 +367,10 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
Painter & pain = bv->painter();
if (lyxrc.font_norm_type == LyXRC::ISO_8859_9)
if (displayISO8859_9(bv, font0, baseline, x))
if (displayISO8859_9(bv, font0, baseline, x))
return;
/* draw it! */
/* draw it! */
// All the manually drawn accents in this function could use an
// overhaul. Different ways of drawing (what metrics to use)
// should also be considered.
@ -378,7 +378,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
LyXFont font(font0);
if (lyxrc.font_norm_type == LyXRC::ISO_10646_1)
font.setLanguage(english_language);
if (candisp) {
int asc = ascent(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)
switch (modtype) {
case ACUTE: // acute 0xB4
{
{
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,
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,
char(0xB8), font);
break;
}
case UNDERDOT: // underdot
@ -509,7 +509,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
case CARON: // caron
{
int xp[3], yp[3];
xp[0] = int(x2 - hg35); yp[0] = int(y + hg35);
xp[1] = int(x2); yp[1] = int(y + hg);
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];
xp[0] = int(x + wid);
yp[0] = int(y + hg35 + hg);
xp[1] = int(x + wid + (hg35 / 2.0));
yp[1] = int(y + hg + (hg35 / 2.0));
xp[2] = int(x + wid + (hg35 / 2.0));
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
// it should certainly be refined
int xp[4], yp[4];
xp[0] = int(x2);
yp[0] = y;
xp[1] = int(x2);
yp[1] = y + int(hg35);
xp[2] = int(x2 - hg35);
yp[2] = y + int(hg / 2.0);
xp[3] = int(x2 + hg / 4.0);
yp[3] = y + int(hg);
@ -586,15 +586,15 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
case LSLASH:
{
int xp[2], yp[2];
xp[0] = int(x);
xp[0] = int(x);
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);
pain.lines(xp, yp, 2);
break;
pain.lines(xp, yp, 2);
break;
}
case DOT_LESS_I: // dotless-i
case DOT_LESS_J: // dotless-j

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
*
* ====================================================== */
@ -20,7 +20,7 @@
#include "lyxlex.h"
/** Insertion of accents
Proper handling of accented characters.
This is class is supposed to handle all LaTeX accents, it
is also possible that the class will change a bit so that
@ -74,7 +74,7 @@ public:
inline bool canDisplay();
// should this inset be handled like a normal charater
bool isChar() const { return true; }
/// all the accent types
enum ACCENT_TYPES{
///
@ -114,11 +114,11 @@ public:
///
DOT_LESS_I,
///
DOT_LESS_J, // 18
DOT_LESS_J, // 18
///
lSLASH,
lSLASH,
///
LSLASH
LSLASH
};
private:
friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);
@ -130,7 +130,7 @@ private:
bool candisp;
/// modifier type
ACCENT_TYPES modtype;
/// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
bool remdot;
/// add something to ascent - accent at the top
@ -138,7 +138,7 @@ private:
/// add something to descent - underlined char
bool plusdesc;
/// international char
mutable char ic;
mutable char ic;
};

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1998 The LyX Team.
*
* ====================================================== */
@ -69,9 +69,9 @@ int InsetList::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
{
os << "\\footnote{%\n";
int i = inset.latex(buf, os, fragile, fp);
os << "}%\n";
return i + 2;
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
@ -19,7 +19,7 @@
#include "insetcollapsable.h"
/** The list inset
*/
class InsetList : public InsetCollapsable {
public:

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1998 The LyX Team.
*
* ======================================================
@ -59,9 +59,9 @@ int InsetMarginal::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
{
os << "%\n\\marginpar{";
int const i = inset.latex(buf, os, fragile, fp);
os << "%\n}";
return i + 2;
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
@ -19,7 +19,7 @@
#include "insetfootlike.h"
/** The marginal note inset
*/
class InsetMarginal : public InsetFootlike {
public:

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1998 The LyX Team.
*
*======================================================*/
@ -80,7 +80,7 @@ InsetMinipage::InsetMinipage(BufferParams const & bp)
// just for experimentation :)
setBackgroundColor(LColor::green);
#endif
inset.setFrameColor(0, LColor::blue);
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"
<< "position " << pos_ << "\n"
@ -245,7 +245,7 @@ int InsetMinipage::latex(Buffer const * buf,
}
os << "\\begin{minipage}[" << s_pos << "]{"
<< width_.asLatexString() << "}%\n";
int i = inset.latex(buf, os, fragile, fp);
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_;
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 2001 The LyX Team.
@ -21,7 +21,7 @@
#include <sigc++/signal_system.h>
/** The minipage inset
*/
class InsetMinipage : public InsetCollapsable {
public:

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* 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
InsetNote::InsetNote(Buffer const * buf, string const & contents,
InsetNote::InsetNote(Buffer const * buf, string const & contents,
bool 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");
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 2001 The LyX Team.
@ -19,11 +19,11 @@
#include "insetcollapsable.h"
/** The PostIt note inset
*/
class InsetNote : public InsetCollapsable {
public:
///
///
InsetNote(BufferParams const &);
///
InsetNote(InsetNote const &, bool same_id = false);

View File

@ -1,10 +1,10 @@
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* 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();
}
void InsetParent::edit(BufferView * bv, int, int, unsigned int)
{
{
bv->owner()->getLyXFunc()->
dispatch(LFUN_CHILDOPEN, getContents());
}

View File

@ -1,11 +1,11 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1997-2001 LyX Team
*
*
* ====================================================== */
#ifndef INSET_PARENT_H
@ -22,7 +22,7 @@ class Buffer;
/** Reference to the parent document.
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 {
public:
@ -42,9 +42,9 @@ public:
void edit(BufferView *, int, int, unsigned int);
///
void edit(BufferView * bv, bool front = true);
///
///
int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const;
bool fragile, bool free_spc) const;
///
void setParent(string fn) { setContents(fn); }
};

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* 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]
int quote_index[2][6] = {
{ 2, 1, 0, 0, 3, 4 }, // "'',,<>"
{ 2, 1, 0, 0, 3, 4 }, // "'',,<>"
{ 1, 1, 2, 1, 4, 3 } }; // "`'`'><"
// Corresponding LaTeX code, for double and single quotes.
char const * const latex_quote_t1[2][5] =
{ { "\\quotesinglbase{}", "'", "`",
"\\guilsinglleft{}", "\\guilsinglright{}" },
char const * const latex_quote_t1[2][5] =
{ { "\\quotesinglbase{}", "'", "`",
"\\guilsinglleft{}", "\\guilsinglright{}" },
{ ",,", "''", "``", "<<", ">>" } };
char const * const latex_quote_ot1[2][5] =
{ { "\\quotesinglbase{}", "'", "`",
"\\guilsinglleft{}", "\\guilsinglright{}" },
char const * const latex_quote_ot1[2][5] =
{ { "\\quotesinglbase{}", "'", "`",
"\\guilsinglleft{}", "\\guilsinglright{}" },
{ "\\quotedblbase{}", "''", "``",
"\\guillemotleft{}", "\\guillemotright{}" } };
char const * const latex_quote_babel[2][5] =
char const * const latex_quote_babel[2][5] =
{ { "\\glq{}", "'", "`", "\\flq{}", "\\frq{}" },
{ "\\glqq{}", "''", "``", "\\flqq{}", "\\frqq{}" } };
@ -85,12 +85,12 @@ InsetQuotes::InsetQuotes(quote_language l,
InsetQuotes::InsetQuotes(char c, BufferParams const & params)
: language_(params.quotes_language), times_(params.quotes_times)
{
// Decide whether left or right
// Decide whether left or right
switch (c) {
case ' ': case '(':
case ' ': case '(':
case Paragraph::META_HFILL:
case Paragraph::META_NEWLINE:
side_ = LeftQ; // left quote
case Paragraph::META_NEWLINE:
side_ = LeftQ; // left quote
break;
default:
side_ = RightQ; // right quote
@ -108,7 +108,7 @@ void InsetQuotes::parseString(string const & s)
}
int i;
for (i = 0; i < 6; ++i) {
if (str[0] == language_char[i]) {
language_ = quote_language(i);
@ -118,7 +118,7 @@ void InsetQuotes::parseString(string const & s)
if (i >= 6) {
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
" bad language specification." << endl;
language_ = EnglishQ;
language_ = EnglishQ;
}
for (i = 0; i < 2; ++i) {
@ -130,7 +130,7 @@ void InsetQuotes::parseString(string const & s)
if (i >= 2) {
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
" bad side specification." << endl;
side_ = LeftQ;
side_ = LeftQ;
}
for (i = 0; i < 2; ++i) {
@ -142,30 +142,30 @@ void InsetQuotes::parseString(string const & s)
if (i >= 2) {
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
" bad times specification." << endl;
times_ = DoubleQ;
times_ = DoubleQ;
}
}
string const InsetQuotes::dispString(Language const * loclang) const
{
string disp;
string disp;
disp += quote_char[quote_index[side_][language_]];
if (times_ == DoubleQ)
disp += disp;
if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
|| lyxrc.font_norm_type == LyXRC::ISO_8859_3
|| lyxrc.font_norm_type == LyXRC::ISO_8859_4
|| lyxrc.font_norm_type == LyXRC::ISO_8859_9) {
if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
|| lyxrc.font_norm_type == LyXRC::ISO_8859_3
|| lyxrc.font_norm_type == LyXRC::ISO_8859_4
|| lyxrc.font_norm_type == LyXRC::ISO_8859_9) {
if (disp == "'")
disp = "´";
else if (disp == "''")
disp = "´´";
}
if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
|| lyxrc.font_norm_type == LyXRC::ISO_8859_9
|| lyxrc.font_norm_type == LyXRC::ISO_8859_15) {
if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
|| lyxrc.font_norm_type == LyXRC::ISO_8859_9
|| lyxrc.font_norm_type == LyXRC::ISO_8859_15) {
if (disp == "<<")
disp = '«';
else if (disp == ">>")
@ -179,8 +179,8 @@ string const InsetQuotes::dispString(Language const * loclang) const
else
disp = " " + disp;
}
return disp;
return disp;
}
@ -242,7 +242,7 @@ void InsetQuotes::write(Buffer const *, ostream & os) const
string text;
text += language_char[language_];
text += side_char[side_];
text += times_char[times_];
text += times_char[times_];
os << "Quotes " << text;
}
@ -272,18 +272,18 @@ int InsetQuotes::latex(Buffer const * buf, ostream & os,
const int quoteind = quote_index[side_][language_];
string qstr;
if (language_ == FrenchQ && times_ == DoubleQ
&& curr_lang == "frenchb") {
if (side_ == LeftQ)
if (side_ == LeftQ)
qstr = "\\og "; //the spaces are important here
else
else
qstr = " \\fg{}"; //and here
} else if (language_ == FrenchQ && times_ == DoubleQ
&& curr_lang == "french") {
if (side_ == LeftQ)
if (side_ == LeftQ)
qstr = "<< "; //the spaces are important here
else
else
qstr = " >>"; //and here
} else if (lyxrc.fontenc == "T1") {
qstr = latex_quote_t1[times_][quoteind];
@ -293,7 +293,7 @@ int InsetQuotes::latex(Buffer const * buf, ostream & os,
} else if (!use_babel) {
#endif
qstr = latex_quote_ot1[times_][quoteind];
} else {
} else {
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_]];
#ifdef DO_USE_DEFAULT_LANGUAGE
if (features.bufferParams().language->lang() == "default"
if (features.bufferParams().language->lang() == "default"
#else
if (!use_babel
#endif
&& lyxrc.fontenc != "T1") {
if (times_ == SingleQ)
if (times_ == SingleQ)
switch (type) {
case ',': features.require("quotesinglbase"); break;
case '<': features.require("guilsinglleft"); break;
case '>': features.require("guilsinglright"); break;
default: break;
}
else
else
switch (type) {
case ',': features.require("quotedblbase"); break;
case '<': features.require("guillemotleft"); break;

View File

@ -3,7 +3,7 @@
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team
*
@ -27,7 +27,7 @@ struct LaTeXFeatures;
/** Quotes.
Used for the various quotes. German, English, French, all either
double or single **/
double or single **/
class InsetQuotes : public Inset {
public:
///
@ -50,20 +50,20 @@ public:
///
LeftQ,
///
RightQ
RightQ
};
///
enum quote_times {
///
SingleQ,
///
DoubleQ
DoubleQ
};
/** The constructor works like this:
\begin{itemize}
\item fls <- french single quote left
\item grd <- german double quote right
\item fls <- french single quote left
\item grd <- german double quote right
\item etc.
\end{itemize}
*/
@ -105,7 +105,7 @@ public:
Inset::Code lyxCode() const;
// should this inset be handled like a normal charater
bool isChar() const { return true; }
private:
///
quote_language language_;
@ -124,4 +124,3 @@ private:
string const dispString(Language const *) const;
};
#endif

View File

@ -26,7 +26,7 @@ void InsetRef::edit(BufferView * bv, int, int, unsigned int button)
{
// Eventually trigger dialog with button 3 not 1
if (button == 3)
bv->owner()->getLyXFunc()->
bv->owner()->getLyXFunc()->
dispatch(LFUN_REF_GOTO, getContents());
else if (button == 1)
bv->owner()->getDialogs()->showRef(this);

View File

@ -3,9 +3,9 @@
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1997 LyX Team (this file was created this year)
*
*
* ====================================================== */
#ifndef INSET_REF_H
@ -19,7 +19,7 @@
struct LaTeXFeatures;
/** The reference inset
/** The reference inset
*/
class InsetRef : public InsetCommand {
public:
@ -57,7 +57,7 @@ public:
bool display() const { return false; }
///
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;
///

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 2000-2001 The LyX Team.
*
* ======================================================

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 2000-2001 The LyX Team.

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1997 Asger Alstrup
*
* ====================================================== */
@ -53,7 +53,7 @@ int InsetSpecialChar::width(BufferView *, LyXFont const & font) const
case HYPHENATION:
{
int w = lyxfont::width('-', font);
if (w > 5)
if (w > 5)
w -= 2; // to make it look shorter
return w;
}
@ -77,7 +77,7 @@ int InsetSpecialChar::width(BufferView *, LyXFont const & font) const
{
return lyxfont::width('x', font);
}
}
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 h = lyxfont::ascent('x', font);
int xp[4], yp[4];
xp[0] = ox; yp[0] = baseline;
xp[1] = ox; yp[1] = baseline - h;
xp[2] = ox + w; yp[2] = baseline - h/2;
xp[3] = ox; yp[3] = baseline;
pain.lines(xp, yp, 4, LColor::special);
x += width(bv, font);
break;
@ -140,7 +140,7 @@ void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f,
float w = width(bv, font);
int h = lyxfont::ascent('x', font);
int xp[4], yp[4];
xp[0] = int(x);
yp[0] = baseline - max(h / 4, 1);
@ -152,7 +152,7 @@ void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f,
xp[3] = int(x + w);
yp[3] = baseline - max(h / 4, 1);
pain.lines(xp, yp, 4, LColor::special);
x += w;
break;
@ -166,20 +166,20 @@ void InsetSpecialChar::write(Buffer const *, ostream & os) const
{
string command;
switch (kind_) {
case HYPHENATION:
command = "\\-";
case HYPHENATION:
command = "\\-";
break;
case LIGATURE_BREAK:
command = "\\textcompwordmark{}";
case LIGATURE_BREAK:
command = "\\textcompwordmark{}";
break;
case END_OF_SENTENCE:
case END_OF_SENTENCE:
command = "\\@.";
break;
case LDOTS:
command = "\\ldots{}";
command = "\\ldots{}";
break;
case MENU_SEPARATOR:
command = "\\menuseparator";
command = "\\menuseparator";
break;
case 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
void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
{
{
lex.nextToken();
string const command = lex.getString();
@ -205,7 +205,7 @@ void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
else if (command == "\\ldots{}")
kind_ = LDOTS;
else if (command == "\\menuseparator")
kind_ = MENU_SEPARATOR;
kind_ = MENU_SEPARATOR;
else if (command == "\\protected_separator"
|| command == "~")
kind_ = PROTECTED_SEPARATOR;
@ -218,23 +218,23 @@ int InsetSpecialChar::latex(Buffer const *, ostream & os, bool /*fragile*/,
bool free_space) const
{
switch (kind_) {
case HYPHENATION:
os << "\\-";
case HYPHENATION:
os << "\\-";
break;
case LIGATURE_BREAK:
os << "\\textcompwordmark{}";
break;
case END_OF_SENTENCE:
os << "\\@.";
case END_OF_SENTENCE:
os << "\\@.";
break;
case LDOTS:
os << "\\ldots{}";
case LDOTS:
os << "\\ldots{}";
break;
case MENU_SEPARATOR:
os << "\\lyxarrow{}";
case MENU_SEPARATOR:
os << "\\lyxarrow{}";
break;
case PROTECTED_SEPARATOR:
os << (free_space ? " " : "~");
case PROTECTED_SEPARATOR:
os << (free_space ? " " : "~");
break;
}
return 0;
@ -247,16 +247,16 @@ int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const
case HYPHENATION:
case LIGATURE_BREAK:
break;
case END_OF_SENTENCE:
os << ".";
case END_OF_SENTENCE:
os << ".";
break;
case LDOTS:
os << "...";
case LDOTS:
os << "...";
break;
case MENU_SEPARATOR:
os << "->";
case MENU_SEPARATOR:
os << "->";
break;
case PROTECTED_SEPARATOR:
case PROTECTED_SEPARATOR:
os << " ";
break;
}
@ -274,10 +274,10 @@ int InsetSpecialChar::linuxdoc(Buffer const *, ostream & os) const
os << ".";
break;
case LDOTS:
os << "...";
os << "...";
break;
case MENU_SEPARATOR:
os << "&lyxarrow;";
case MENU_SEPARATOR:
os << "&lyxarrow;";
break;
case PROTECTED_SEPARATOR:
os << "&nbsp;";
@ -297,7 +297,7 @@ int InsetSpecialChar::docbook(Buffer const *, ostream & os) const
os << ".";
break;
case LDOTS:
os << "...";
os << "...";
break;
case MENU_SEPARATOR:
os << "&lyxarrow;";

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1997 Asger Alstrup
*
* ====================================================== */
@ -59,7 +59,7 @@ public:
void write(Buffer const *, std::ostream &) const;
/// Will not be used when lyxf3
void read(Buffer const *, LyXLex & lex);
///
///
int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const;
///
@ -70,19 +70,19 @@ public:
int docbook(Buffer const *, std::ostream &) const;
///
virtual Inset * clone(Buffer const &, bool same_id = false) const;
///
///
Inset::Code lyxCode() const
{
return Inset::SPECIALCHAR_CODE;
}
/// We don't need \begin_inset and \end_inset
bool directWrite() const
bool directWrite() const
{
return true;
};
///
void validate(LaTeXFeatures &) const;
// should this inset be handled like a normal charater
bool isChar() const;
/// is this equivalent to a letter?

View File

@ -1,6 +1,6 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 2001 The LyX Team.
@ -261,13 +261,13 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
x += static_cast<float>(scroll());
#endif
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 const tx = display() || !owner() ? 0 : top_x;
int w = tx ? width(bv, font) : pain.paperWidth();
int ty = baseline - ascent(bv, font);
if (ty < 0)
ty = 0;
if ((ty + h) > pain.paperHeight())
@ -308,7 +308,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
if (hasSelection()) {
drawCellSelection(pain, nx, baseline, i, j, cell);
}
tabular->GetCellInset(cell)->draw(bv, font, baseline, cx, cleared);
drawCellLines(pain, nx, baseline, i, 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
// | A |------------| B | below, origin top left (tx, ty),
// | A |------------| B | below, origin top left (tx, ty),
// | | inset box | | dimensions w(idth), h(eight).
// +---+------------+---+ x grows rightward, y downward
// | D |
@ -388,10 +388,10 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
#endif
// clear before the inset
int tx, ty, w, h;
tx = nx + 1;
tx = nx + 1;
ty = baseline - tabular->GetAscentOfRow(i) + 1;
w = int(cx - nx - 1);
h = tabular->GetAscentOfRow(i) +
h = tabular->GetAscentOfRow(i) +
tabular->GetDescentOfRow(i) - 1;
pain.fillRectangle(tx, ty, w, h, backgroundColor());
// 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,
int row, int cell) const
int row, int cell) const
{
int x2 = x + tabular->GetWidthOfColumn(cell);
bool on_off;
if (!tabular->TopAlreadyDrawed(cell)) {
on_off = !tabular->TopLine(cell);
pain.line(x, baseline - tabular->GetAscentOfRow(row),
@ -483,12 +483,12 @@ void InsetTabular::drawCellSelection(Painter & pain, int x, int baseline,
} else {
ce = tabular->right_column_of_cell(sel_cell_end);
}
int rs = tabular->row_of_cell(sel_cell_start);
int re = tabular->row_of_cell(sel_cell_end);
if (rs > re)
swap(rs, re);
if ((column >= cs) && (column <= ce) && (row >= rs) && (row <= re)) {
int w = tabular->GetWidthOfColumn(cell);
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)
{
UpdatableInset::edit(bv, x, y, button);
if (!bv->lockInset(this)) {
lyxerr[Debug::INSETTEXT] << "InsetTabular::Cannot lock inset" << endl;
return;
@ -573,7 +573,7 @@ void InsetTabular::edit(BufferView * bv, int x, int y, unsigned int button)
void InsetTabular::edit(BufferView * bv, bool front)
{
UpdatableInset::edit(bv, front);
if (!bv->lockInset(this)) {
lyxerr[Debug::INSETTEXT] << "InsetTabular::Cannot lock inset" << endl;
return;
@ -612,7 +612,7 @@ void InsetTabular::insetUnlock(BufferView * bv)
void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what,
bool mark_dirty) const
bool mark_dirty) const
{
if (what == INIT) {
LyXFont font;
@ -821,7 +821,7 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
bool InsetTabular::insetButtonRelease(BufferView * bv,
int x, int y, int button)
int x, int y, int button)
{
bool ret = false;
if (the_locking_inset)
@ -844,10 +844,10 @@ void InsetTabular::insetMotionNotify(BufferView * bv, int x, int y, int button)
button);
return;
}
hideInsetCursor(bv);
// int const old_cell = actcell;
setPos(bv, x, y);
if (!hasSelection()) {
setSelection(actcell, actcell);
@ -870,9 +870,9 @@ void InsetTabular::insetKeyPress(XKeyEvent * xke)
UpdatableInset::RESULT
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.
old_locking_inset = the_locking_inset;
UpdatableInset::RESULT result =
@ -949,7 +949,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
setSelection(start, actcell);
break;
}
int end = actcell;
// if we are starting a selection, only select
// the current cell at the beginning
@ -973,11 +973,11 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
setSelection(start, actcell);
break;
}
int end = actcell;
// if we are starting a selection, only select
// the current cell at the beginning
if (hasSelection()) {
if (hasSelection()) {
moveLeft(bv, false);
end = actcell;
}
@ -1090,7 +1090,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
case LFUN_NEXTSEL:
case LFUN_WORDLEFT:
case LFUN_WORDLEFTSEL:
case LFUN_WORDRIGHT:
case LFUN_WORDRIGHT:
case LFUN_WORDRIGHTSEL:
case LFUN_DOWN_PARAGRAPH:
case LFUN_DOWN_PARAGRAPHSEL:
@ -1103,7 +1103,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
case LFUN_END:
case LFUN_ENDSEL:
case LFUN_BEGINNINGBUF:
case LFUN_BEGINNINGBUFSEL:
case LFUN_BEGINNINGBUFSEL:
case LFUN_ENDBUF:
case LFUN_ENDBUFSEL:
break;
@ -1116,7 +1116,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
break;
// insert file functions
case LFUN_FILE_INSERT_ASCII_PARA:
case LFUN_FILE_INSERT_ASCII:
case LFUN_FILE_INSERT_ASCII:
{
string tmpstr = getContentsOfAsciiFile(bv, arg, false);
if (tmpstr.empty())
@ -1132,8 +1132,8 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
if (!copySelection(bv))
break;
setUndo(bv, Undo::DELETE,
bv->text->cursor.par(),
bv->text->cursor.par()->next());
bv->text->cursor.par(),
bv->text->cursor.par()->next());
cutSelection();
updateLocal(bv, INIT, true);
break;
@ -1217,8 +1217,8 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
case LFUN_PASTE:
if (hasPasteBuffer()) {
setUndo(bv, Undo::INSERT,
bv->text->cursor.par(),
bv->text->cursor.par()->next());
bv->text->cursor.par(),
bv->text->cursor.par()->next());
pasteSelection(bv);
updateLocal(bv, INIT, true);
break;
@ -1285,7 +1285,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
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);
}
@ -1295,7 +1295,7 @@ int InsetTabular::ascii(Buffer const * buf, ostream & os, int ll) const
{
if (ll > 0)
return tabular->ascii(buf, os, (int)parOwner()->params().depth(),
false,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,
LyXFont const & font,
bool reinit) const
LyXFont const & font,
bool reinit) const
{
int cell = -1;
int maxAsc = 0;
int maxDesc = 0;
InsetText * inset;
bool changed = false;
// 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 ;)
if ((need_update != INIT) &&
@ -1411,12 +1411,12 @@ void InsetTabular::toggleInsetCursor(BufferView * bv)
the_locking_inset->toggleInsetCursor(bv);
return;
}
LyXFont font; // = the_locking_inset->GetFont(par, cursor.pos);
int const asc = lyxfont::maxAscent(font);
int const desc = lyxfont::maxDescent(font);
if (isCursorVisible())
bv->hideLockedInsetCursor();
else
@ -1431,7 +1431,7 @@ void InsetTabular::showInsetCursor(BufferView * bv, bool show)
return;
if (!isCursorVisible()) {
LyXFont font; // = GetFont(par, cursor.pos);
int const asc = lyxfont::maxAscent(font);
int const desc = lyxfont::maxDescent(font);
bv->fitLockedInsetCursor(cursor_.x(), cursor_.y(), asc, desc);
@ -1458,7 +1458,7 @@ void InsetTabular::fitInsetCursor(BufferView * bv) const
return;
}
LyXFont font;
int const asc = lyxfont::maxAscent(font);
int const desc = lyxfont::maxDescent(font);
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
{
cursor_.y(0);
actcell = actrow = actcol = 0;
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 c = cell;
for (; !tabular->IsFirstCellInRow(c); --c)
;
int lx = tabular->GetWidthOfColumn(cell);
@ -1729,15 +1729,15 @@ bool InsetTabular::deletable() const
void InsetTabular::setFont(BufferView * bv, LyXFont const & font, bool tall,
bool selectall)
bool selectall)
{
if (selectall) {
setSelection(0, tabular->GetNumberOfCells() - 1);
}
if (hasSelection()) {
setUndo(bv, Undo::EDIT,
bv->text->cursor.par(),
bv->text->cursor.par()->next());
bv->text->cursor.par(),
bv->text->cursor.par()->next());
bool frozen = undo_frozen;
if (!frozen)
freezeUndo();
@ -1764,11 +1764,11 @@ void InsetTabular::setFont(BufferView * bv, LyXFont const & font, bool tall,
bool InsetTabular::tabularFeatures(BufferView * bv, string const & what)
{
LyXTabular::Feature action = LyXTabular::LAST_ACTION;
int i = 0;
for (; tabularFeature[i].action != LyXTabular::LAST_ACTION; ++i) {
string const tmp = tabularFeature[i].feature;
if (tmp == what.substr(0, tmp.length())) {
//if (!compare(tabularFeatures[i].feature.c_str(), what.c_str(),
//tabularFeatures[i].feature.length())) {
@ -1786,7 +1786,7 @@ bool InsetTabular::tabularFeatures(BufferView * bv, string const & what)
}
static void checkLongtableSpecial(LyXTabular::ltType & ltt,
string const & special, bool & flag)
string const & special, bool & flag)
{
if (special == "dl_above") {
ltt.topDL = flag;
@ -1805,8 +1805,8 @@ static void checkLongtableSpecial(LyXTabular::ltType & ltt,
void InsetTabular::tabularFeatures(BufferView * bv,
LyXTabular::Feature feature,
string const & value)
LyXTabular::Feature feature,
string const & value)
{
int sel_col_start;
int sel_col_end;
@ -1851,20 +1851,20 @@ void InsetTabular::tabularFeatures(BufferView * bv,
sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
}
setUndo(bv, Undo::FINISH,
bv->text->cursor.par(),
bv->text->cursor.par()->next());
bv->text->cursor.par(),
bv->text->cursor.par()->next());
int row = tabular->row_of_cell(actcell);
int column = tabular->column_of_cell(actcell);
bool flag = true;
LyXTabular::ltType ltt;
switch (feature) {
case LyXTabular::SET_PWIDTH:
{
LyXLength const vallen(value);
LyXLength const & tmplen = tabular->GetColumnPWidth(actcell);
bool const update = (tmplen != vallen);
tabular->SetColumnPWidth(actcell, vallen);
if (update) {
@ -1881,7 +1881,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
{
LyXLength const vallen(value);
LyXLength const & tmplen = tabular->GetPWidth(actcell);
bool const update = (tmplen != vallen);
tabular->SetMColumnPWidth(actcell, vallen);
if (update) {
@ -1946,12 +1946,12 @@ void InsetTabular::tabularFeatures(BufferView * bv,
updateLocal(bv, INIT, true);
break;
}
case LyXTabular::M_TOGGLE_LINE_BOTTOM:
flag = false;
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 j = sel_col_start; j <= sel_col_end; ++j)
tabular->SetBottomLine(
@ -1961,7 +1961,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
updateLocal(bv, INIT, true);
break;
}
case LyXTabular::M_TOGGLE_LINE_LEFT:
flag = false;
case LyXTabular::TOGGLE_LINE_LEFT:
@ -1976,7 +1976,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
updateLocal(bv, INIT, true);
break;
}
case LyXTabular::M_TOGGLE_LINE_RIGHT:
flag = false;
case LyXTabular::TOGGLE_LINE_RIGHT:
@ -1991,7 +1991,7 @@ void InsetTabular::tabularFeatures(BufferView * bv,
updateLocal(bv, INIT, true);
break;
}
case LyXTabular::M_ALIGN_LEFT:
case LyXTabular::M_ALIGN_RIGHT:
case LyXTabular::M_ALIGN_CENTER:
@ -2024,8 +2024,8 @@ void InsetTabular::tabularFeatures(BufferView * bv,
case LyXTabular::MULTICOLUMN:
{
if (sel_row_start != sel_row_end) {
Alert::alert(_("Impossible Operation!"),
_("Multicolumns can only be horizontally."),
Alert::alert(_("Impossible Operation!"),
_("Multicolumns can only be horizontally."),
_("Sorry."));
return;
}
@ -2189,7 +2189,7 @@ bool InsetTabular::insetHit(BufferView *, int x, int) const
int InsetTabular::getMaxWidthOfCell(BufferView * bv, int cell) const
{
LyXLength const len = tabular->GetPWidth(cell);
if (len.zero())
return -1;
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,
UpdatableInset const * inset) const
UpdatableInset const * inset) const
{
int cell = tabular->GetCellFromInset(inset, actcell);
@ -2206,13 +2206,13 @@ int InsetTabular::getMaxWidth(BufferView * bv,
<< endl;
return -1;
}
int w = getMaxWidthOfCell(bv, cell);
if (w > 0) {
// because the inset then subtracts it's top_x and owner->x()
w += (inset->x() - top_x);
}
return w;
}
@ -2237,7 +2237,7 @@ void InsetTabular::resizeLyXText(BufferView * bv, bool force) const
LyXText * InsetTabular::getLyXText(BufferView const * bv,
bool const recursive) const
bool const recursive) const
{
if (the_locking_inset)
return the_locking_inset->getLyXText(bv, recursive);
@ -2286,11 +2286,11 @@ FuncStatus InsetTabular::getStatus(string const & what) const
{
int action = LyXTabular::LAST_ACTION;
FuncStatus status;
int i = 0;
for (; tabularFeature[i].action != LyXTabular::LAST_ACTION; ++i) {
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(),
// tabularFeatures[i].feature.length())) {
action = tabularFeature[i].action;
@ -2301,7 +2301,7 @@ FuncStatus InsetTabular::getStatus(string const & what) const
status.clear();
return status.unknown(true);
}
string const argument = frontStrip(what.substr(tabularFeature[i].feature.length()));
int sel_row_start;
@ -2477,7 +2477,7 @@ bool InsetTabular::copySelection(BufferView * bv)
ostringstream 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());
return true;
}
@ -2582,7 +2582,7 @@ void InsetTabular::getSelection(int & srow, int & erow,
{
int const start = hasSelection() ? sel_cell_start : actcell;
int const end = hasSelection() ? sel_cell_end : actcell;
srow = tabular->row_of_cell(start);
erow = tabular->row_of_cell(end);
if (srow > erow) {
@ -2694,7 +2694,7 @@ string InsetTabular::selectNextWordInt(BufferView * bv, float & value) const
bv->unlockInset(const_cast<InsetTabular *>(this));
return string();
}
// otherwise we have to lock the next inset and ask for it's selecttion
UpdatableInset * inset =
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 cs, bool mw)
bool cs, bool mw)
{
nodraw(true);
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 cs, bool mw)
bool cs, bool mw)
{
nodraw(true);
if (the_locking_inset) {
@ -2800,11 +2800,11 @@ bool InsetTabular::forceDefaultParagraphs(Inset const * in) const
}
bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
bool usePaste)
bool usePaste)
{
if (buf.find('\t') == string::npos)
return false;
int cols = 1;
int rows = 1;
int maxCols = 1;
@ -2835,7 +2835,7 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
if (usePaste) {
delete paste_tabular;
paste_tabular = new LyXTabular(bv->buffer()->params,
this, rows, maxCols);
this, rows, maxCols);
loctab = paste_tabular;
cols = 0;
} else {
@ -2880,6 +2880,6 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
// check for the last cell if there is no trailing '\n'
if ((cell < cells) && (op < len))
loctab->GetCellInset(cell)->setText(buf.substr(op, len-op));
return true;
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 1995-2001 The LyX Team.
@ -166,7 +166,7 @@ public:
int getActCell() const { return actcell; }
///
void setFont(BufferView *, LyXFont const &, bool toggleall = false,
bool selectall = false);
bool selectall = false);
///
int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
@ -218,14 +218,14 @@ public:
void toggleSelection(BufferView *, bool kill_selection);
///
bool searchForward(BufferView *, string const &,
bool = true, bool = false);
bool = true, bool = false);
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.
// "normal" means without width set!
bool forceDefaultParagraphs(Inset const * in) const;
//
// Public structures and variables
///
@ -313,7 +313,7 @@ private:
string selectNextWordInt(BufferView *, float & value) const;
///
bool insertAsciiString(BufferView *, string const & buf, bool usePaste);
//
// Private structures and variables
///

View File

@ -1,6 +1,6 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 1998-2001 The LyX Team.
@ -82,7 +82,7 @@ void InsetText::saveLyXTextState(LyXText * t) const
break;
p = p->next();
}
if (p && t->cursor.pos() <= p->size()) {
sstate.lpar = t->cursor.par();
sstate.pos = t->cursor.pos();
@ -110,10 +110,10 @@ void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
t->selection.mark(sstate.mark_set);
if (sstate.selection) {
t->setCursor(bv, sstate.selstartpar, sstate.selstartpos,
true, sstate.selstartboundary);
true, sstate.selstartboundary);
t->selection.cursor = t->cursor;
t->setCursor(bv, sstate.selendpar, sstate.selendpos,
true, sstate.selendboundary);
true, sstate.selendboundary);
t->setSelection(bv);
t->setCursor(bv, sstate.lpar, sstate.pos);
} else {
@ -140,7 +140,7 @@ InsetText::InsetText(BufferParams const & bp)
{
par = new Paragraph;
par->layout(textclasslist[bp.textclass].defaultLayoutName());
init();
}
@ -206,7 +206,7 @@ InsetText::~InsetText()
cached_bview = 0;
// NOTE
while (par) {
Paragraph * tmp = par->next();
delete par;
@ -219,7 +219,7 @@ void InsetText::clear()
{
// This is a gross hack...
string old_layout = par->layout();
while (par) {
Paragraph * tmp = par->next();
delete par;
@ -228,7 +228,7 @@ void InsetText::clear()
par = new Paragraph;
par->setInsetOwner(this);
par->layout(old_layout);
reinitLyXText();
need_update = INIT;
}
@ -258,11 +258,11 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
string token;
int pos = 0;
Paragraph * return_par = 0;
Paragraph::depth_type depth = 0;
Paragraph::depth_type depth = 0;
LyXFont font(LyXFont::ALL_INHERIT);
clear();
while (lex.isOK()) {
lex.nextToken();
token = lex.getString();
@ -274,7 +274,7 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
#endif
break;
}
if (const_cast<Buffer*>(buf)->
parseSingleLyXformat2Token(lex, par, return_par,
token, pos, depth, font)) {
@ -290,7 +290,7 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
return_par->setInsetOwner(this);
return_par = return_par->next();
}
if (token != "\\end_inset") {
lex.printError("Missing \\end_inset at this point. "
"Read: `$$Token'");
@ -335,7 +335,7 @@ int InsetText::textWidth(BufferView * bv, bool fordraw) const
}
if (fordraw) {
return max(w - (2 * TEXT_TO_INSET_OFFSET),
(int)getLyXText(bv)->width);
(int)getLyXText(bv)->width);
} else if (w < 0) {
return -1;
}
@ -344,13 +344,13 @@ int InsetText::textWidth(BufferView * bv, bool fordraw) const
void InsetText::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const
int baseline, float & x, bool cleared) const
{
if (nodraw())
return;
Painter & pain = bv->painter();
// 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
// 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
// insetDescent have the right values.
// insetDescent have the right values.
width(bv, f);
ascent(bv, f);
descent(bv, f);
@ -415,7 +415,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
top_y = baseline - insetAscent;
if (last_drawn_width != insetWidth) {
if (!cleared)
if (!cleared)
clearInset(bv, baseline, cleared);
need_update |= FULL;
last_drawn_width = insetWidth;
@ -429,7 +429,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
if (!cleared && (need_update == CURSOR)
&& !getLyXText(bv)->selection.set()) {
drawFrame(pain, cleared);
x += insetWidth;
x += insetWidth;
need_update = NONE;
return;
}
@ -458,7 +458,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
y = 0;
while ((row != 0) && (yf < ph)) {
lt->getVisibleRow(bv, y+y_offset, int(x), row,
y+first, cleared);
y+first, cleared);
y += row->height();
yf += row->height();
row = row->next();
@ -493,9 +493,9 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
} else if (need_update & CLEAR_FRAME) {
clearFrame(pain, cleared);
}
x += insetWidth - TEXT_TO_INSET_OFFSET;
if (bv->text->status() == LyXText::CHANGED_IN_DRAW) {
need_update |= FULL;
} 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_h = insetAscent + insetDescent - TEXT_TO_INSET_OFFSET;
pain.rectangle(frame_x, frame_y, frame_w, frame_h,
frame_color);
frame_color);
frame_is_visible = true;
}
}
@ -526,7 +526,7 @@ void InsetText::clearFrame(Painter & pain, bool cleared) const
if (frame_is_visible) {
if (!cleared) {
pain.rectangle(frame_x, frame_y, frame_w, frame_h,
backgroundColor());
backgroundColor());
}
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
LyXText * llt = getLyXText(bv);
need_update |= what;
// 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!
@ -614,7 +614,7 @@ void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty) const
lt->fullRebreak(bv);
setUpdateStatus(bv, what);
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())
lt->selection.cursor = lt->cursor;
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);
else
bv->fitCursor();
if (need_update == CURSOR)
need_update = NONE;
bv->owner()->showState();
@ -645,7 +645,7 @@ string const InsetText::editMessage() const
void InsetText::edit(BufferView * bv, int x, int y, unsigned int button)
{
UpdatableInset::edit(bv, x, y, button);
if (!bv->lockInset(this)) {
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
return;
@ -664,7 +664,7 @@ void InsetText::edit(BufferView * bv, int x, int y, unsigned int button)
}
if (!checkAndActivateInset(bv, x, tmp_y, button))
lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
y + insetAscent);
y + insetAscent);
lt->clearSelection();
finishUndo();
// 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);
if (clear)
lt = 0;
int code = CURSOR;
if (drawFrame_ == LOCKED)
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)
{
UpdatableInset::edit(bv, front);
if (!bv->lockInset(this)) {
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
return;
@ -747,7 +747,7 @@ void InsetText::insetUnlock(BufferView * bv)
int code;
if (drawFrame_ == LOCKED)
code = CURSOR|CLEAR_FRAME;
else
else
code = CURSOR;
bool clear = false;
if (!lt) {
@ -759,7 +759,7 @@ void InsetText::insetUnlock(BufferView * bv)
code = FULL;
} else if (owner()) {
bv->owner()->setLayout(owner()->getLyXText(bv)
->cursor.par()->layout());
->cursor.par()->layout());
} else
bv->owner()->setLayout(bv->text->cursor.par()->layout());
// hack for deleteEmptyParMech
@ -837,7 +837,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
bool lr)
bool lr)
{
if (!the_locking_inset)
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 == inset) {
the_locking_inset->insetButtonPress(bv,
x - inset_x,
y - inset_y,
button);
x - inset_x,
y - inset_y,
button);
no_selection = false;
return;
} else if (inset) {
@ -936,7 +936,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
inset_y = cy(bv) + drawTextYOffset;
the_locking_inset = 0;
inset->insetButtonPress(bv, x - inset_x,
y - inset_y, button);
y - inset_y, button);
// inset->edit(bv, x - inset_x, y - inset_y, button);
if (the_locking_inset)
updateLocal(bv, CURSOR, false);
@ -957,7 +957,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
inset_boundary = cboundary(bv);
the_locking_inset = uinset;
uinset->insetButtonPress(bv, x - inset_x, y - inset_y,
button);
button);
uinset->edit(bv, x - inset_x, y - inset_y, 0);
if (the_locking_inset)
updateLocal(bv, CURSOR, false);
@ -978,7 +978,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
}
lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
y + insetAscent);
y + insetAscent);
// set the selection cursor!
lt->selection.cursor = lt->cursor;
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, "");
else
localDispatch(bv, LFUN_PASTESELECTION,
"paragraph");
"paragraph");
}
} else {
getLyXText(bv)->clearSelection();
@ -1018,8 +1018,8 @@ bool InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
{
if (the_locking_inset) {
return the_locking_inset->insetButtonRelease(bv,
x - inset_x, y - inset_y,
button);
x - inset_x, y - inset_y,
button);
}
int tmp_x = x - drawTextXOffset;
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 (isHighlyEditableInset(inset)) {
ret = inset->insetButtonRelease(bv, x - inset_x,
y - inset_y, button);
y - inset_y, button);
} else {
inset_x = cx(bv) - top_x + drawTextXOffset;
inset_y = cy(bv) + drawTextYOffset;
ret = inset->insetButtonRelease(bv, x - inset_x,
y - inset_y, button);
y - inset_y, button);
inset->edit(bv, x - inset_x,
y - inset_y, button);
y - inset_y, button);
}
updateLocal(bv, CURSOR_PAR, false);
}
@ -1049,7 +1049,7 @@ void InsetText::insetMotionNotify(BufferView * bv, int x, int y, int state)
return;
if (the_locking_inset) {
the_locking_inset->insetMotionNotify(bv, x - inset_x,
y - inset_y,state);
y - inset_y,state);
return;
}
bool clear = false;
@ -1088,7 +1088,7 @@ void InsetText::insetKeyPress(XKeyEvent * xke)
UpdatableInset::RESULT
InsetText::localDispatch(BufferView * bv,
kb_action action, string const & arg)
kb_action action, string const & arg)
{
bool was_empty = par->size() == 0 && !par->next();
no_selection = false;
@ -1161,7 +1161,7 @@ InsetText::localDispatch(BufferView * bv,
* true (on). */
setUndo(bv, Undo::INSERT,
lt->cursor.par(), lt->cursor.par()->next());
lt->cursor.par(), lt->cursor.par()->next());
bv->setState();
if (lyxrc.auto_region_delete) {
if (lt->selection.set()) {
@ -1234,7 +1234,7 @@ InsetText::localDispatch(BufferView * bv,
break;
case LFUN_BACKSPACE: {
setUndo(bv, Undo::DELETE,
lt->cursor.par(), lt->cursor.par()->next());
lt->cursor.par(), lt->cursor.par()->next());
if (lt->selection.set())
lt->cutSelection(bv);
else
@ -1243,10 +1243,10 @@ InsetText::localDispatch(BufferView * bv,
updflag = true;
}
break;
case LFUN_DELETE: {
setUndo(bv, Undo::DELETE,
lt->cursor.par(), lt->cursor.par()->next());
lt->cursor.par(), lt->cursor.par()->next());
if (lt->selection.set()) {
lt->cutSelection(bv);
} else {
@ -1256,10 +1256,10 @@ InsetText::localDispatch(BufferView * bv,
updflag = true;
}
break;
case LFUN_CUT: {
setUndo(bv, Undo::DELETE,
lt->cursor.par(), lt->cursor.par()->next());
lt->cursor.par(), lt->cursor.par()->next());
lt->cutSelection(bv);
updwhat = CURSOR_PAR;
updflag = true;
@ -1274,7 +1274,7 @@ InsetText::localDispatch(BufferView * bv,
case LFUN_PASTESELECTION:
{
string const clip(bv->getClipboard());
if (clip.empty())
break;
if (arg == "paragraph") {
@ -1297,7 +1297,7 @@ InsetText::localDispatch(BufferView * bv,
}
}
setUndo(bv, Undo::INSERT,
lt->cursor.par(), lt->cursor.par()->next());
lt->cursor.par(), lt->cursor.par()->next());
lt->pasteSelection(bv);
updwhat = CURSOR_PAR;
updflag = true;
@ -1329,7 +1329,7 @@ InsetText::localDispatch(BufferView * bv,
break;
}
setUndo(bv, Undo::INSERT,
lt->cursor.par(), lt->cursor.par()->next());
lt->cursor.par(), lt->cursor.par()->next());
lt->insertChar(bv, Paragraph::META_NEWLINE);
updwhat = CURSOR_PAR;
updflag = true;
@ -1340,9 +1340,9 @@ InsetText::localDispatch(BufferView * bv,
// do not set layouts on non breakable textinsets
if (autoBreakRows) {
string cur_layout = cpar(bv)->layout();
// 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;
string layout = arg;
bool hasLayout = textclasslist[tclass].hasLayout(layout);
@ -1352,7 +1352,7 @@ InsetText::localDispatch(BufferView * bv,
string const & obs =
textclasslist[tclass][layout].
obsoleted_by();
if (!obs.empty())
if (!obs.empty())
layout = obs;
}
@ -1386,7 +1386,7 @@ InsetText::localDispatch(BufferView * bv,
if (cur_spacing == Spacing::Other) {
cur_value = par->params().spacing().getValue();
}
istringstream istr(arg.c_str());
string tmp;
istr >> tmp;
@ -1421,7 +1421,7 @@ InsetText::localDispatch(BufferView * bv,
}
}
break;
default:
if (!bv->Dispatch(action, arg))
result = UNDISPATCHED;
@ -1458,7 +1458,7 @@ int InsetText::ascii(Buffer const * buf, ostream & os, int linelen) const
{
Paragraph * p = par;
unsigned int lines = 0;
while (p) {
string const tmp = buf->asciiParagraph(p, linelen, p->previous()==0);
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_inner(10);
int const command_depth = 0;
string item_name;
Paragraph::depth_type depth = 0; // paragraph depth
while (p) {
@ -1517,13 +1517,13 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
depth + command_depth,
environment_inner[depth]);
}
buf->sgmlCloseTag(os, depth + command_depth,
environment_stack[depth]);
environment_stack[depth].erase();
environment_inner[depth].erase();
}
}
// Write opening SGML tags.
switch (style.latextype) {
@ -1566,7 +1566,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
environment_inner[depth]);
}
}
if (style.latextype == LATEX_ENVIRONMENT) {
if (!style.latexparam().empty()) {
if (style.latexparam() == "CDATA")
@ -1641,16 +1641,16 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
item_name = "listitem";
buf->sgmlCloseTag(os, command_depth + depth,
item_name);
if (environment_inner[depth] == "varlistentry")
if (environment_inner[depth] == "varlistentry")
buf->sgmlCloseTag(os, depth + command_depth,
environment_inner[depth]);
}
buf->sgmlCloseTag(os, depth + command_depth,
environment_stack[depth]);
}
}
return lines;
}
@ -1706,7 +1706,7 @@ void InsetText::toggleInsetCursor(BufferView * bv)
int const asc = lyxfont::maxAscent(font);
int const desc = lyxfont::maxDescent(font);
if (isCursorVisible())
bv->hideLockedInsetCursor();
else
@ -1724,7 +1724,7 @@ void InsetText::showInsetCursor(BufferView * bv, bool show)
if (!isCursorVisible()) {
LyXFont const font =
getLyXText(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv));
int const asc = lyxfont::maxAscent(font);
int const desc = lyxfont::maxDescent(font);
@ -1755,7 +1755,7 @@ void InsetText::fitInsetCursor(BufferView * bv) const
}
LyXFont const font =
getLyXText(bv)->getFont(bv->buffer(), cpar(bv), cpos(bv));
int const asc = lyxfont::maxAscent(font);
int const desc = lyxfont::maxDescent(font);
@ -1784,8 +1784,8 @@ InsetText::moveLeft(BufferView * bv, bool activate_inset, bool selecting)
UpdatableInset::RESULT
InsetText::moveRightIntern(BufferView * bv, bool behind,
bool activate_inset, bool selecting)
InsetText::moveRightIntern(BufferView * bv, bool behind,
bool activate_inset, bool selecting)
{
if (!cpar(bv)->next() && (cpos(bv) >= cpar(bv)->size()))
return FINISHED_RIGHT;
@ -1800,7 +1800,7 @@ InsetText::moveRightIntern(BufferView * bv, bool behind,
UpdatableInset::RESULT
InsetText::moveLeftIntern(BufferView * bv, bool behind,
bool activate_inset, bool selecting)
bool activate_inset, bool selecting)
{
if (!cpar(bv)->previous() && (cpos(bv) <= 0))
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;
@ -1922,7 +1922,7 @@ vector<string> const InsetText::getLabelList() const
void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
bool selectall)
bool selectall)
{
if (the_locking_inset) {
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;
if (the_locking_inset) {
LyXFont font = llt->getFont(bv->buffer(), llt->cursor.par(),
llt->cursor.pos());
llt->cursor.pos());
if (font.isVisibleRightToLeft())
x -= the_locking_inset->width(bv, font);
}
@ -2142,7 +2142,7 @@ Row * InsetText::crow(BufferView * bv) const
LyXText * InsetText::getLyXText(BufferView const * lbv,
bool const recursive) const
bool const recursive) const
{
if (cached_bview == lbv) {
if (recursive && the_locking_inset)
@ -2153,7 +2153,7 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
}
// Super UGLY! (Lgb)
BufferView * bv = const_cast<BufferView *>(lbv);
cached_bview = bv;
Cache::iterator it = cache.find(bv);
@ -2198,7 +2198,7 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
restoreLyXTextState(bv, cached_text.get());
cache.insert(make_pair(bv, cached_text));
if (the_locking_inset && recursive) {
return the_locking_inset->getLyXText(bv);
}
@ -2211,7 +2211,7 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
cached_bview = 0;
Cache::iterator it = cache.find(bv);
if (it == cache.end()) {
return;
}
@ -2274,7 +2274,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
}
if (!owner()) {
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();
} else {
need_update |= FULL;
@ -2314,7 +2314,7 @@ void InsetText::reinitLyXText() const
}
if (!owner()) {
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();
} else {
need_update = FULL;
@ -2326,7 +2326,7 @@ void InsetText::reinitLyXText() const
void InsetText::removeNewlines()
{
bool changed = false;
for (Paragraph * p = par; p; p = p->next()) {
for (int i = 0; i < p->size(); ++i) {
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 h = insetAscent + insetDescent;
int ty = baseline - insetAscent;
if (ty < 0) {
h += ty;
ty = 0;
@ -2569,7 +2569,7 @@ void InsetText::toggleSelection(BufferView * bv, bool kill_selection)
}
if (y_offset < 0)
y_offset = y;
if (need_update & SELECTION)
need_update = NONE;
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 cs, bool mw)
bool cs, bool mw)
{
if (the_locking_inset) {
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 cs, bool mw)
bool cs, bool mw)
{
if (the_locking_inset)
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,
Paragraph * newpar)
Paragraph * newpar)
{
Paragraph * buf;
Paragraph * tmpbuf = newpar;
Paragraph * lastbuffer = buf = new Paragraph(*tmpbuf, false);
while (tmpbuf->next()) {
tmpbuf = tmpbuf->next();
lastbuffer->next(new Paragraph(*tmpbuf, false));
@ -2679,7 +2679,7 @@ void InsetText::appendParagraphs(BufferParams const & bparams,
{
lastbuffer->insertChar(lastbuffer->size(), ' ');
}
// make the buf exactly the same layout than our last paragraph
buf->makeSameLayout(lastbuffer);

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
@ -38,7 +38,7 @@ class Row;
/**
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
*/
class InsetText : public UpdatableInset {
@ -170,7 +170,7 @@ public:
///
void setFont(BufferView *, LyXFont const &,
bool toggleall = false,
bool selectall = false);
bool selectall = false);
///
int getMaxWidth(BufferView *, UpdatableInset const *) const;
///
@ -240,10 +240,10 @@ public:
void toggleSelection(BufferView *, bool kill_selection);
///
bool searchForward(BufferView *, string const &,
bool = true, bool = false);
bool = true, bool = false);
///
bool searchBackward(BufferView *, string const &,
bool = true, bool = false);
bool = true, bool = false);
///
bool checkInsertChar(LyXFont &);
///
@ -301,7 +301,7 @@ private:
bool activate_inset = true,
bool selecting = false);
///
UpdatableInset::RESULT moveLeftIntern(BufferView *, bool behind,
UpdatableInset::RESULT moveLeftIntern(BufferView *, bool behind,
bool activate_inset = true,
bool selecting = false);
@ -315,7 +315,7 @@ private:
bool checkAndActivateInset(BufferView * bv, bool behind);
///
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
int button = 0);
int button = 0);
///
void removeNewlines();
///
@ -344,7 +344,7 @@ private:
void reinitLyXText() const;
///
void collapseParagraphs(BufferParams const & bparams) const;
/* Private structures and variables */
///
Paragraph * par;
@ -405,7 +405,7 @@ private:
};
///
mutable save_state sstate;
///
// this is needed globally so we know that we're using it actually and
// so the LyXText-Cache is not erased until used!

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* 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";
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)
#endif
InsetTheorem * result = new InsetTheorem;
result->collapsed_ = collapsed_;
return result;
}
@ -78,9 +78,9 @@ int InsetTheorem::latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
{
os << "\\begin{theorem}%\n";
int i = inset.latex(buf, os, fragile, fp);
os << "\\end{theorem}%\n";
return i + 2;
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
* Copyright 1998 The LyX Team.
@ -19,7 +19,7 @@
#include "insetcollapsable.h"
/** The theorem inset
*/
class InsetTheorem : public InsetCollapsable {
public:

View File

@ -17,10 +17,10 @@ using std::vector;
using std::ostream;
string const InsetTOC::getScreenLabel(Buffer const *) const
string const InsetTOC::getScreenLabel(Buffer const *) const
{
string const cmdname(getCmdName());
if (cmdname == "tableofcontents")
return _("Table of Contents");
return _("Unknown toc list");

View File

@ -3,10 +3,10 @@
* ======================================================
*
* LyX, The Document Word Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1996-2001 The LyX Team.
*
*
* ====================================================== */
#ifndef INSET_TOC_H

View File

@ -38,7 +38,7 @@ string const InsetUrl::getScreenLabel(Buffer const *) const
string temp;
if (getCmdName() == "url")
temp = _("Url: ");
else
else
temp = _("HtmlUrl: ");
if (!getOptions().empty())

View File

@ -1,11 +1,11 @@
// -*- C++ -*-
/* This file is part of*
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1997-2001 The LyX Team.
*
*
* ====================================================== */
#ifndef INSET_URL_H
@ -19,7 +19,7 @@
struct LaTeXFeatures;
/** The url inset
/** The url inset
*/
class InsetUrl : public InsetCommand {
public:
@ -46,7 +46,7 @@ public:
bool display() const { return false; }
///
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;
///

View File

@ -1,5 +1,7 @@
2002-03-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
* most files: ws cleanup
* Makefile.am: remove ld -r stuff
2002-03-20 Lars Gullik Bjønnes <larsbj@birdstep.com>

View File

@ -49,7 +49,7 @@ protected:
///
virtual int sync() { return 0; }
#endif
///
///
virtual streamsize xsputn(char_type const *, streamsize n) {
// fakes a purge of the buffer by returning n
return n;
@ -174,7 +174,7 @@ DebugStream::DebugStream(Debug::type t)
: ostream(new debugbuf(cerr.rdbuf())),
dt(t), nullstream(new nullbuf), internal(0) {}
/// Constructor, sets the log file to f, and the debug level to t.
DebugStream::DebugStream(char const * f, Debug::type t)
: 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
this kind of permanent debug code has. My conclusion is: not
much. In all, but the most time critical code, this will have
this kind of permanent debug code has. My conclusion is: not
much. In all, but the most time critical code, this will have
close to no impact at all.
In the tests that I have run the use of
if (debugstream.debugging(DebugStream::INFO))
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.
The overhead for
debugstream.debug(DebugStream::INFO) << "some debug\n";
is also very small when the debug level is not
DebugStream::INFO. However the overhead for this will increase
if complex debugging information is output.
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.
Why should we use this instead of the class Error that we already
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
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.
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
parameter. And there should be less need for temporary objects.
And one nice bonus is that we get a log file almost for
free.
Some of the names are of course open to modifications. I will try
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::INFO) << "even more debug(INFO)\n";
debugstream.debug(Debug::CRIT) << "even more debug(CRIT)\n";
debugstream.addLevel(Debug::type(Debug::CRIT |
debugstream.addLevel(Debug::type(Debug::CRIT |
Debug::WARN));
debugstream << "Adding Debug::CRIT and 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
// support partial specialization. In egcs this should not be
// needed.
debugstream << "automatic " << &i
debugstream << "automatic " << &i
<< ", free store " << p << endl;
delete p;
/*

View File

@ -53,12 +53,12 @@ struct Debug {
INFO
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:
if (debug.debugging(Debug::INFO)) {
debug << "...debug output...\n";
debug << "...debug output...\n";
}
To give debug info even if no debug (NONE) is requested:
debug << "... always output ...\n";
@ -80,7 +80,7 @@ class DebugStream : public std::ostream
public:
/// Constructor, sets the debug level to t.
explicit DebugStream(Debug::type t = Debug::NONE);
/// Constructor, sets the log file to f, and the debug level to t.
explicit
DebugStream(char const * f, Debug::type t = Debug::NONE);
@ -110,7 +110,7 @@ public:
/// Sets the debugstreams' logfile to f.
void logFile(char const * f);
/// Returns true if t is part of the current debug level.
bool debugging(Debug::type t = Debug::ANY) const
{
@ -118,7 +118,7 @@ public:
return false;
}
/** Returns the no-op stream if t is not part of the
current debug level otherwise the real debug stream
is used.
@ -128,7 +128,7 @@ public:
return nullstream;
}
/** This is an operator to give a more convenient use:
dbgstream[Debug::INFO] << "Info!\n";
*/
@ -147,5 +147,3 @@ private:
};
#endif

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -56,7 +56,7 @@
#undef S_ISNWK
#undef S_ISREG
#undef S_ISSOCK
#endif
#endif
#if !defined(S_ISBLK) && defined(S_IFBLK)
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
@ -87,7 +87,7 @@
#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
#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
#ifdef MAJOR_IN_MKDEV
#include <sys/mkdev.h>
@ -97,7 +97,7 @@
#include <sys/sysmacros.h>
#define HAVE_MAJOR
#endif
#ifdef major
#ifdef major
#define HAVE_MAJOR
#endif
@ -152,7 +152,7 @@ void FileInfo::dostat(bool link)
FileInfo & FileInfo::newFile(string const & path, bool link)
{
fname = path;
status = 0;
err = NoErr;
@ -176,7 +176,7 @@ FileInfo & FileInfo::newFile(int fildes)
char const * FileInfo::typeIndicator() const
{
lyx::Assert(isOK());
if (S_ISDIR(buf.st_mode)) return ("/");
#ifdef S_ISLNK
if (S_ISLNK(buf.st_mode)) return ("@");
@ -196,7 +196,7 @@ char const * FileInfo::typeIndicator() const
mode_t FileInfo::getMode() const
{
lyx::Assert(isOK());
return buf.st_mode;
}
@ -217,7 +217,7 @@ void FileInfo::modeString(char * szString) const
char FileInfo::typeLetter() const
{
lyx::Assert(isOK());
#ifdef S_ISBLK
if (S_ISBLK(buf.st_mode)) return 'b';
#endif
@ -256,7 +256,7 @@ void FileInfo::flagRWX(mode_t i, char * szString) const
void FileInfo::setSticky(char * szString) const
{
lyx::Assert(isOK());
#ifdef S_ISUID
if (buf.st_mode & S_ISUID) {
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 (fname.empty()) return false;
if (::access(fname.c_str(), p) == 0)
return true;
else {

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -33,7 +33,7 @@ class FileInfo : boost::noncopyable {
public:
///
FileInfo();
/** Get information about file.
If link is true, the information is about the link itself, not
the file that is obtained by tracing the links. */
@ -46,52 +46,52 @@ public:
/// Query a new file
FileInfo & newFile(string const & path, bool link = false);
/// Query a new file descriptor
FileInfo & newFile(int fildes);
FileInfo & newFile(int fildes);
/// Returns a character describing file type (ls -F)
char const * typeIndicator() const;
/// File protection mode
mode_t getMode() const;
/// Constructs standard mode string (ls style)
void modeString(char * szString) const;
/// returns a letter describing a file type (ls style)
char typeLetter() const;
/// builds 'rwx' string describing file access rights
void flagRWX(mode_t i, char * szString) const;
/// updates mode string to match suid/sgid/sticky bits
void setSticky(char * szString) const;
///
time_t getModificationTime() const;
///
time_t getAccessTime() const;
///
time_t getStatusChangeTime() const;
/// Total file size in bytes
off_t getSize() const;
/// Number of hard links
nlink_t getNumberOfLinks() const;
/// User ID of owner
uid_t getUid() const;
/// Group ID of owner
gid_t getGid() const;
/// Is the file information correct? Did the query succeed?
bool isOK() const;
/// Permission flags
enum perm_test {
/// test for read permission

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -11,11 +11,11 @@
#ifndef LISTREAM_H
#define LISTREAM_H
#define LISTREAM_H
#ifdef HAVE_ISTREAM
#include <istream>
#else
#else
#include <iostream>
#endif

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -11,11 +11,11 @@
#ifndef LOSTREAM_H
#define LOSTREAM_H
#define LOSTREAM_H
#ifdef HAVE_OSTREAM
#include <ostream>
#else
#else
#include <iostream>
#endif

View File

@ -20,40 +20,40 @@ using std::make_pair;
struct LRegex::Impl {
///
regex_t * preg;
///
int error_code;
///
mutable LRegex::SubMatches matches;
///
Impl(string const & regex)
Impl(string const & regex)
: preg(new regex_t), error_code(0)
{
error_code = regcomp(preg, regex.c_str(), REG_EXTENDED);
}
///
~Impl()
{
regfree(preg);
delete preg;
}
///
bool exact_match(string const & str) const
{
regmatch_t tmp;
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()))
return true;
}
// no match
return false;
}
///
LRegex::MatchPair const first_match(string const & str) const
{
@ -65,7 +65,7 @@ struct LRegex::Impl {
tmp.rm_eo : string::npos;
return make_pair(first, second - first);
}
///
string const getError() const
{
@ -76,7 +76,7 @@ struct LRegex::Impl {
delete [] tmp;
return ret;
}
///
LRegex::SubMatches const & exec(string const & str) const
{

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -13,7 +13,7 @@
// Programming Language by Bjarne Stroustrup
#ifndef LSUBSTRING_H
#define LSUBSTRING_H
#define LSUBSTRING_H
#ifdef __GNUG__
#pragma interface

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 2000-2001 Jean-Marc Lasgouttes
*
* ======================================================*/
@ -17,10 +17,10 @@
StrPool::~StrPool()
{
for (Pool::const_iterator cit = pool_.begin();
for (Pool::const_iterator cit = pool_.begin();
cit != pool_.end() ; ++cit) {
delete[] (*cit);
}
delete[] (*cit);
}
}
/* 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)
{
string::size_type s = str.length();
char * buf = new char [s + 1];
str.copy(buf, s);
buf[s] = '\0';
pool_.push_back(buf);
return buf;
char * buf = new char [s + 1];
str.copy(buf, s);
buf[s] = '\0';
pool_.push_back(buf);
return buf;
}
//StrPool strPool;

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
*
* LyX, The Document Processor
*
*
* Copyright 2000-2001 Jean-Marc Lasgouttes
*
* ======================================================*/
@ -22,16 +22,16 @@
///
class StrPool {
public:
/// delete all the strings that have been allocated by add()
~StrPool();
/// Make a copy of the string, and remember it in the pool
char const * add(string const & str);
/// delete all the strings that have been allocated by add()
~StrPool();
/// Make a copy of the string, and remember it in the pool
char const * add(string const & str);
private:
///
typedef std::vector<char const *> Pool;
///
Pool pool_;
Pool pool_;
};
//extern StrPool strPool;

View File

@ -1,11 +1,11 @@
/*
filetools.C (former paths.C) - part of LyX project
General path-mangling functions
General path-mangling functions
Copyright 1996 Ivan Schreter
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
See also filetools.h.
lyx-filetool.C : tools functions for file/path handling
@ -28,7 +28,7 @@
#endif
#include <cstdlib>
#include <cstdio>
#include <cstdio>
#include <fcntl.h>
#include <cerrno>
#include "debug.h"
@ -92,7 +92,7 @@ string const MakeLatexName(string const & file)
{
string name = OnlyFilename(file);
string const path = OnlyPath(file);
for (string::size_type i = 0; i < name.length(); ++i) {
name[i] &= 0x7f; // set 8th bit to 0
};
@ -101,7 +101,7 @@ string const MakeLatexName(string const & file)
string const keep("abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"@!\"'()*+,-./0123456789:;<=>?[]`|");
string::size_type pos = 0;
while ((pos = name.find_first_not_of(keep, pos)) != string::npos) {
name[pos++] = '_';
@ -133,11 +133,11 @@ bool IsFileReadable (string const & path)
// Is a file read_only?
// return 1 read-write
// 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)
{
FileInfo fi(path);
if (fi.access(FileInfo::wperm|FileInfo::rperm)) // read-write
return 1;
if (fi.readable()) // read-only
@ -151,12 +151,12 @@ int IsFileWriteable (string const & path)
bool IsDirWriteable (string const & path)
{
lyxerr[Debug::FILES] << "IsDirWriteable: " << path << endl;
string const tmpfl(lyx::tempName(path, "lyxwritetest"));
if (tmpfl.empty())
return false;
lyx::unlink(tmpfl);
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 $$User/, use user_lyxdir
// 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 real_file, path_element;
bool notfound = true;
string tmppath = split(path, path_element, ';');
while (notfound && !path_element.empty()) {
path_element = os::slashify_path(path_element);
if (!suffixIs(path_element, '/'))
path_element+= '/';
path_element = subst(path_element, "$$LyX", system_lyxdir);
path_element = subst(path_element, "$$User", user_lyxdir);
real_file = FileSearch(path_element, name, ext);
if (real_file.empty()) {
do {
tmppath = split(tmppath, path_element, ';');
@ -211,12 +211,12 @@ vector<string> const DirList(string const & dir, string const & ext)
vector<string> dirlist;
DIR * dirp = ::opendir(dir.c_str());
if (!dirp) {
lyxerr[Debug::FILES]
lyxerr[Debug::FILES]
<< "Directory \"" << dir
<< "\" does not exist to DirList." << endl;
return dirlist;
}
dirent * dire;
while ((dire = ::readdir(dirp))) {
string const fil = dire->d_name;
@ -238,9 +238,9 @@ vector<string> const DirList(string const & dir, string const & ext)
vector<string> dirlist;
directory_iterator dit("dir");
while (dit != directory_iterator()) {
string fil = dit->filename;
string fil = dit->filename;
if (prefixIs(fil, extension)) {
dirlist.push_back(fil);
dirlist.push_back(fil);
}
++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
// extension ext.
string const FileSearch(string const & path, string const & name,
// extension ext.
string const FileSearch(string const & path, string const & name,
string const & ext)
{
// 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.
if (IsFileReadable(fullname))
return fullname;
else if (ext.empty())
else if (ext.empty())
return string();
else { // Is it not more reasonable to use ChangeExtension()? (SMiyata)
fullname += '.';
fullname += ext;
if (IsFileReadable(fullname))
return fullname;
else
else
return string();
}
}
@ -279,28 +279,28 @@ string const FileSearch(string const & path, string const & name,
// 1) user_lyxdir
// 2) build_lyxdir (if not empty)
// 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 fullname = FileSearch(AddPath(user_lyxdir, dir), name, ext);
string fullname = FileSearch(AddPath(user_lyxdir, dir), name, ext);
if (!fullname.empty())
return fullname;
if (!build_lyxdir.empty())
if (!build_lyxdir.empty())
fullname = FileSearch(AddPath(build_lyxdir, dir), name, ext);
if (!fullname.empty())
return fullname;
return FileSearch(AddPath(system_lyxdir, dir), name, ext);
}
string const
i18nLibFileSearch(string const & dir, string const & name,
i18nLibFileSearch(string const & dir, string const & name,
string const & ext)
{
// this comment is from intl/dcigettext.c. We try to mimick this
// behaviour here.
// behaviour here.
/* The highest priority value is the `LANGUAGE' environment
variable. But we don't use the value if the currently
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 = token(lang, '_', 0);
if (lang.empty() || lang == "C")
return LibFileSearch(dir, name, ext);
else {
@ -356,7 +356,7 @@ bool PutEnv(string const & envstr)
#if HAVE_PUTENV
// 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)
// Actually we don't have to leak...calling putenv like this
// 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.
//int retval = lyx::putenv(envstr.c_str());
#else
#ifdef HAVE_SETENV
#ifdef HAVE_SETENV
string varname;
string const str = envstr.split(varname,'=');
int const retval = ::setenv(varname.c_str(), str.c_str(), true);
@ -429,11 +429,11 @@ int DeleteAllFilesInDir (string const & path)
int return_value = 0;
while ((de = readdir(dir))) {
string const temp = de->d_name;
if (temp == "." || temp == "..")
if (temp == "." || temp == "..")
continue;
string const unlinkpath = AddName (path, temp);
lyxerr[Debug::FILES] << "Deleting file: " << unlinkpath
lyxerr[Debug::FILES] << "Deleting file: " << unlinkpath
<< endl;
bool deleted = true;
@ -441,12 +441,12 @@ int DeleteAllFilesInDir (string const & path)
if (fi.isOK() && fi.isDir())
deleted = (DeleteAllFilesInDir(unlinkpath) == 0);
deleted &= (lyx::unlink(unlinkpath) == 0);
if (!deleted) {
Alert::err_alert(_("Error! Could not remove file:"),
if (!deleted) {
Alert::err_alert(_("Error! Could not remove file:"),
unlinkpath);
return_value = -1;
}
}
}
closedir(dir);
return return_value;
}
@ -457,14 +457,14 @@ string const CreateTmpDir(string const & tempdir, string const & mask)
lyxerr[Debug::FILES]
<< "CreateTmpDir: tempdir=`" << tempdir << "'\n"
<< "CreateTmpDir: mask=`" << mask << "'" << endl;
string const tmpfl(lyx::tempName(tempdir, mask));
// lyx::tempName actually creates a file to make sure that it
// 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
// safe because of the gap between unlink and mkdir. (Lgb)
lyx::unlink(tmpfl.c_str());
if (tmpfl.empty() || lyx::mkdir(tmpfl, 0700)) {
Alert::err_alert(_("Error! Couldn't create temporary directory:"),
tempdir);
@ -482,12 +482,12 @@ int DestroyTmpDir(string const & tmpdir, bool Allfiles)
if (Allfiles && DeleteAllFilesInDir(tmpdir)) {
return -1;
}
if (lyx::rmdir(tmpdir)) {
Alert::err_alert(_("Error! Couldn't delete temporary directory:"),
if (lyx::rmdir(tmpdir)) {
Alert::err_alert(_("Error! Couldn't delete temporary directory:"),
tmpdir);
return -1;
}
return 0;
return 0;
}
} // namespace anon
@ -594,7 +594,7 @@ string const MakeAbsPath(string const & RelPath, string const & BasePath)
TempBase = BasePath;
else
TempBase = AddPath(lyx::getcwd(), BasePath);
// Handle /./ at the end of the path
while (suffixIs(TempBase, "/./"))
TempBase.erase(TempBase.length() - 2);
@ -606,7 +606,7 @@ string const MakeAbsPath(string const & RelPath, string const & BasePath)
while (!RTemp.empty()) {
// Split by next /
RTemp = split(RTemp, Temp, '/');
if (Temp == ".") continue;
if (Temp == "..") {
// Remove one level of TempBase
@ -729,7 +729,7 @@ string const NormalizePath(string const & path)
while (!RTemp.empty()) {
// Split by next /
RTemp = split(RTemp, Temp, '/');
if (Temp == ".") {
TempBase = "./";
} else if (Temp == "..") {
@ -747,7 +747,7 @@ string const NormalizePath(string const & 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
// the denoted environmentvariable
// Allow Variables according to
// Allow Variables according to
// variable := '$' '{' [A-Za-z_]{[A-Za-z_0-9]*} '}'
//
string const ReplaceEnvironmentPath(string const & path)
{
//
//
// CompareChar: Environmentvariables starts with this character
// PathChar: Next path component start with this character
// while CompareChar found do:
// Split String with PathChar
// Search Environmentvariable
// Search Environmentvariable
// if found: Replace Strings
//
char const CompareChar = '$';
char const FirstChar = '{';
char const EndChar = '}';
char const UnderscoreChar = '_';
char const FirstChar = '{';
char const EndChar = '}';
char const UnderscoreChar = '_';
string EndString; EndString += EndChar;
string FirstString; FirstString += FirstChar;
string CompareString; CompareString += CompareChar;
@ -800,9 +800,9 @@ string const ReplaceEnvironmentPath(string const & path)
string result0 = split(path, result1, CompareChar);
while (!result0.empty()) {
string copy1(result0); // contains String after $
// Check, if there is an EndChar inside original String.
if (!regexMatch(copy1, RegExp)) {
// No EndChar inside. So we are finished
result1 += CompareString + result0;
@ -833,8 +833,8 @@ string const ReplaceEnvironmentPath(string const & path)
bool result = isalpha(*cp1) || (*cp1 == UnderscoreChar);
++cp1;
while (*cp1 && result) {
result = isalnum(*cp1) ||
(*cp1 == UnderscoreChar);
result = isalnum(*cp1) ||
(*cp1 == UnderscoreChar);
++cp1;
}
@ -845,7 +845,7 @@ string const ReplaceEnvironmentPath(string const & path)
result1 += res1;
continue;
}
string env(GetEnv(res1_contents + 1));
if (!env.empty()) {
// Congratulations. Environmentvariable found
@ -856,7 +856,7 @@ string const ReplaceEnvironmentPath(string const & path)
// Next $-Sign?
result0 = split(res0, res1, CompareChar);
result1 += res1;
}
}
return result1;
} // ReplaceEnvironmentPath
@ -919,7 +919,7 @@ string const AddPath(string const & path, string const & path_2)
}
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 const tmp = path2.substr(p2start, p2end - p2start + 1);
buf += tmp + '/';
@ -928,7 +928,7 @@ string const AddPath(string const & path, string const & path_2)
}
/*
/*
Change extension of oldname to extension.
Strips path off if no_path == true.
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('.');
if (last_dot < last_slash && last_slash != string::npos)
last_dot = string::npos;
string ext;
// Make sure the extension starts with a dot
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
// (dots are any characters). (Herbert 20020131)
// (dots are any characters). (Herbert 20020131)
// AGR Grace...
// BMP BM...
// EPS %!PS-Adobe-3.0 EPSF...
@ -974,9 +974,9 @@ string const GetExtension(string const & name)
// JPG JFIF
// PDF %PDF-...
// PNG .PNG...
// PBM P1... or P4 (B/W)
// PBM P1... or P4 (B/W)
// 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"!
// SGI \001\332... (decimal 474)
// TGIF %TGIF...
@ -996,7 +996,7 @@ string const getExtFromContents(string const & filename) {
if (filename.empty() || !IsFileReadable(filename))
// paranoia check
return string();
ifstream ifs(filename.c_str());
if (!ifs)
// Couldn't open file...
@ -1068,7 +1068,7 @@ string const getExtFromContents(string const & filename) {
format = "ppm";
}
break;
}
}
if (stamp == "\001\332")
format = "sgi";
else if ((stamp == "II") || (stamp == "MM"))
@ -1120,20 +1120,20 @@ string const getExtFromContents(string const & filename) {
else if (contains(str,"BITPIX"))
format = "fits";
}
if (!format.empty()) {
lyxerr[Debug::GRAPHICS]
<< "Recognised Fileformat: " << format << endl;
return format;
}
}
string const ext(GetExtension(filename));
lyxerr[Debug::GRAPHICS]
<< "filetools(getExtFromContents)\n"
<< "\tCouldn't find a known Type!\n";
if (!ext.empty()) {
lyxerr[Debug::GRAPHICS]
<< "\twill take the file extension -> "
<< "\twill take the file extension -> "
<< ext << endl;
return ext;
} else {
@ -1196,9 +1196,9 @@ MakeDisplayPath (string const & path, unsigned int threshold)
if (l2 > threshold) {
// Yes, shortend it
prefix += ".../";
string temp;
while (relhome.length() > threshold)
relhome = split(relhome, temp, '/');
@ -1250,7 +1250,7 @@ cmdret const do_popen(string const & cmd)
// (Claus Hentschel) Check if popen was succesful ;-)
if (!inf)
return make_pair(-1, string());
string ret;
int c = fgetc(inf);
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.
Lgb
*/
// If the file can be found directly, we just return a
// absolute path version of it.
if (FileInfo(fil).exist())
// absolute path version of it.
if (FileInfo(fil).exist())
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
// kpsewhich without --format: "When the --format option is not
// 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);
lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n"
<< "kpse result = `" << strip(c.second, '\n')
<< "kpse result = `" << strip(c.second, '\n')
<< "'" << endl;
if (c.first != -1)
if (c.first != -1)
return os::internal_path(strip(strip(c.second, '\n'), '\r'));
else
return string();
@ -1327,5 +1327,3 @@ void removeAutosaveFile(string const & filename)
}
}
}

View File

@ -37,7 +37,7 @@ int DestroyLyXTmpDir (string const & tmpdir);
If path entry begins with $$User/, use user_lyxdir.
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());
/** 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
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());
/// 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());
/** Is directory read only?
returns
returns
true: dir writeable
false: not writeable
*/
@ -87,15 +87,15 @@ bool IsSGMLFilename(string const & filename);
\end{enumerate}
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());
/** Same as LibFileSearch(), but tries first to find an
internationalized version of the file by prepending $LANG_ to the
name
name
*/
string const
i18nLibFileSearch(string const & dir, string const & name,
i18nLibFileSearch(string const & dir, string const & name,
string const & ext = string());
///
@ -151,7 +151,7 @@ string const ExpandPath(string const & path);
If relpath is absolute, just use that.
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());
/** Creates a nice compact path for displaying. The parameter

View File

@ -26,7 +26,7 @@ using std::va_list;
glibc returns the needed size.
One problem can be that vsnprintf is not implemented on all archs,
but AFAIK it is part of the new ANSI C standard.
Lgb
*/

View File

@ -66,7 +66,7 @@ int Forkedcall::startscript(Starttype wait, string const & what)
} else {
retval_ = waitForChild();
}
return retval_;
}
@ -197,13 +197,13 @@ int Forkedcall::waitForChild() {
wait = false;
} else if (WIFSIGNALED(status)) {
lyxerr << "LyX: Child didn't catch signal "
<< WTERMSIG(status)
<< WTERMSIG(status)
<< "and died. Too bad." << endl;
wait = false;
} else if (WIFSTOPPED(status)) {
lyxerr << "LyX: Child (pid: " << pid_
<< ") stopped on signal "
<< WSTOPSIG(status)
<< WSTOPSIG(status)
<< ". Waiting for child to finish." << endl;
} else {
lyxerr << "LyX: Something rotten happened while "
@ -219,7 +219,7 @@ int Forkedcall::waitForChild() {
pid_t Forkedcall::generateChild()
{
const int MAX_ARGV = 255;
char *syscmd = 0;
char *syscmd = 0;
char *argv[MAX_ARGV];
string childcommand(command_); // copy
@ -243,7 +243,7 @@ pid_t Forkedcall::generateChild()
// reinit
more = !rest.empty();
if (more)
if (more)
rest = split(rest, childcommand, ' ');
}
argv[index] = 0;

View File

@ -43,10 +43,10 @@ public:
///
DontWait
};
///
Forkedcall();
/** Start the child process.
*
* The command "what" is passed to fork() for execution.
@ -94,7 +94,7 @@ public:
* Used by the timer.
*/
pid_t pid() const { return pid_; }
/** Emit the signal.
* Used by the timer.
*/

View File

@ -6,7 +6,7 @@
* \author Asger Alstrup Nielsen
* \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().
*/
@ -46,7 +46,7 @@ ForkedcallsController & ForkedcallsController::get()
ForkedcallsController::ForkedcallsController()
{
timeout_ = new Timeout(100, Timeout::ONETIME);
timeout_->timeout
.connect(SigC::slot(this, &ForkedcallsController::timer));
}
@ -94,7 +94,7 @@ void ForkedcallsController::timer()
bool remove_it = false;
if (waitrpid == -1) {
lyxerr << "LyX: Error waiting for child: "
lyxerr << "LyX: Error waiting for child: "
<< strerror(errno) << endl;
// Child died, so pretend it returned 1
@ -116,9 +116,9 @@ void ForkedcallsController::timer()
remove_it = true;
} else if (WIFSTOPPED(stat_loc)) {
lyxerr << "LyX: Child (pid: " << pid
lyxerr << "LyX: Child (pid: " << pid
<< ") stopped on signal "
<< WSTOPSIG(stat_loc)
<< WSTOPSIG(stat_loc)
<< ". Waiting for child to finish." << endl;
} else {

View File

@ -37,7 +37,7 @@ public:
~ForkedcallsController();
/// 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.
void addCall(Forkedcall const & newcall);
@ -63,7 +63,7 @@ public:
/// Signal emitted when the list of current child processes changes.
SigC::Signal0<void> childrenChanged;
private:
///
ForkedcallsController(ForkedcallsController const &);
@ -76,7 +76,7 @@ private:
/** The timer. Enables us to check the status of the children
* every XX ms and to invoke a callback on completion.
*/
Timeout * timeout_;
Timeout * timeout_;
};
#endif // FORKEDCONTR_H

View File

@ -23,17 +23,17 @@ char * l_getcwd(char * buffer, size_t size)
// Returns current working directory
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 * tbuf = new char[n];
// Safe. Hopefully all getcwds behave this way!
while (((err = l_getcwd(tbuf, n)) == 0) && (errno == ERANGE)) {
char * tbuf = new char[n];
// Safe. Hopefully all getcwds behave this way!
while (((err = l_getcwd(tbuf, n)) == 0) && (errno == ERANGE)) {
// Buffer too small, double the buffersize and try again
delete[] tbuf;
n = 2 * n;
tbuf = new char[n];
}
delete[] tbuf;
n = 2 * n;
tbuf = new char[n];
}
string result;
if (err) result = tbuf;

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* 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)
{
if (str.empty()) return false;
// Remove leading and trailing white space chars.
string const tmpstr = frontStrip(strip(str, ' '), ' ');
if (tmpstr.empty()) return false;
string::const_iterator cit = tmpstr.begin();
if ((*cit) == '-') ++cit;
string::const_iterator end = tmpstr.end();
@ -132,11 +132,11 @@ bool isStrInt(string const & str)
bool isStrUnsignedInt(string const & str)
{
if (str.empty()) return false;
// Remove leading and trailing white space chars.
string const tmpstr = frontStrip(strip(str, ' '), ' ');
if (tmpstr.empty()) return false;
string::const_iterator cit = tmpstr.begin();
string::const_iterator end = tmpstr.end();
for (; cit != end; ++cit) {
@ -175,7 +175,7 @@ unsigned int strToUnsignedInt(string const & str)
bool isStrDbl(string const & str)
{
if (str.empty()) return false;
// Remove leading and trailing white space chars.
string const tmpstr = frontStrip(strip(str, ' '), ' ');
if (tmpstr.empty()) return false;
@ -215,15 +215,15 @@ double strToDbl(string const & str)
}
char lowercase(char c)
{
return char(tolower(c));
char lowercase(char c)
{
return char(tolower(c));
}
char uppercase(char c)
{
return char(toupper(c));
char uppercase(char c)
{
return char(toupper(c));
}
@ -237,7 +237,7 @@ struct local_lowercase {
return tolower(c);
}
};
struct local_uppercase {
char operator()(char c) const {
return toupper(c);
@ -264,10 +264,10 @@ string const uppercase(string const & a)
bool prefixIs(string const & a, char const * pre)
{
lyx::Assert(pre);
size_t const l = strlen(pre);
string::size_type const alen = a.length();
if (l > alen || a.empty())
return false;
else {
@ -289,7 +289,7 @@ bool prefixIs(string const & a, string const & pre)
{
string::size_type const prelen = pre.length();
string::size_type const alen = a.length();
if (prelen > alen || a.empty())
return false;
else {
@ -312,10 +312,10 @@ bool suffixIs(string const & a, char c)
bool suffixIs(string const & a, char const * suf)
{
lyx::Assert(suf);
size_t const suflen = strlen(suf);
string::size_type const alen = a.length();
if (suflen > alen)
return false;
else {
@ -338,7 +338,7 @@ bool suffixIs(string const & a, string const & suf)
{
string::size_type const suflen = suf.length();
string::size_type const alen = a.length();
if (suflen > alen) {
return false;
} else {
@ -396,7 +396,7 @@ bool contains(char const * a, char const * b)
bool containsOnly(string const & s, char const * cset)
{
lyx::Assert(cset);
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)
{
lyx::Assert(s && cset);
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)
{
lyx::Assert(s);
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)
{
if (a.empty()) return string();
string::size_type k = 0;
string::size_type i = 0;
@ -496,7 +496,7 @@ string const subst(string const & a,
char const * oldstr, string const & newstr)
{
lyx::Assert(oldstr);
string lstr(a);
string::size_type i = 0;
string::size_type olen = strlen(oldstr);
@ -530,7 +530,7 @@ string const strip(string const & a, char c)
string tmp(a);
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 != string::npos)
if (i != string::npos)
tmp.erase(i + 1, string::npos);
#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
/// 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)
{
lyx::Assert(p);
if (a.empty() || !*p) return a;
string tmp(a);
string::size_type i = tmp.find_first_not_of(p);

View File

@ -41,7 +41,7 @@ int compare(char const * a, char const * b)
return std::strcmp(a, b);
#else
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);
#else
return strncmp(a, b, len);
#endif
#endif
}
///
@ -73,10 +73,10 @@ bool isStrDbl(string const & str);
///
double strToDbl(string const & str);
///
///
char lowercase(char c);
///
///
char uppercase(char c);
///
@ -88,7 +88,7 @@ string const uppercase(string const &);
/// convert \a T to string
template<typename T>
inline
string const tostr(T const & t)
string const tostr(T const & t)
{
ostringstream ostr;
ostr << t;
@ -151,7 +151,7 @@ public:
typedef string first_argument_type;
typedef string second_argument_type;
typedef bool result_type;
bool operator()(string const & haystack, string const & needle) const {
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.
Doesn't modify the original string. Returns -1 in case of
failure.
failure.
Example:
\code
"a;bc;d".tokenPos(';', "bc") == 1;

View File

@ -2,7 +2,7 @@
/* lxtl.h
* LyX eXternalization Template Library
* This file is part of
* ======================================================
* ======================================================
*
* LyX, The Document Processor
*
@ -28,7 +28,7 @@
typedef GIOP_format<auto_mem_buffer> gui_format;
/* 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
thereby avoiding an extra file dependency.
ARRae 20000423

View File

@ -46,7 +46,7 @@ struct firster {
template <class InputIter, class OutputIter, class Func>
OutputIter copy_if(InputIter first, InputIter last,
OutputIter result, Func func)
OutputIter result, Func func)
{
for (; first != last; ++first) {
if (func(*first)) {
@ -63,10 +63,10 @@ typename std::iterator_traits<Iterator>::difference_type
count (Iterator first, Iterator last, T const & value)
{
#ifdef HAVE_STD_COUNT
return std::count(first, last, value);
return std::count(first, last, value);
#else
std::iterator_traits<Iterator>::difference_type n = 0;
while (first != last)
std::iterator_traits<Iterator>::difference_type n = 0;
while (first != last)
if (*first++ == value) ++n;
return n;
#endif

View File

@ -5,7 +5,7 @@
/** \file lyxfunctional.h
\brief Convenient function objects for use with LyX
This is currently a small collection of small function objects for use
together with std::algorithms.
**/
@ -18,7 +18,7 @@ namespace lyx {
template<class R, class C, class A>
class class_fun_t {
public:
class_fun_t(C & ct, R(C::*p)(A))
class_fun_t(C & ct, R(C::*p)(A))
: c(ct), cmf(p) {}
R operator()(A & a) const {
return (c.*cmf)(a);
@ -78,7 +78,7 @@ public:
typedef void difference_type;
typedef void pointer;
typedef void reference;
back_insert_fun_iterator(Cont & x, MemRet(Type::*p)())
: container(&x), pmf(p) {}
@ -118,12 +118,12 @@ public:
typedef void difference_type;
typedef void pointer;
typedef void reference;
const_back_insert_fun_iterator(Cont & x, MemRet(Type::*p)() const)
: container(&x), pmf(p) {}
~const_back_insert_fun_iterator() {}
const_back_insert_fun_iterator &
operator=(Type const * val) {
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);
}
// Functors used in the template.
///

View File

@ -1,9 +1,9 @@
// -*- C++ -*-
/* This file is part of
* ======================================================
*
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
@ -32,7 +32,7 @@ bool copy(string const & from, string const & to);
/// generates a checksum
unsigned long sum(string const & file);
/// returns a date string (not used currently)
char * date();
char * date();
/// returns the name of the user (not used currently)
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
* 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
* zero. If you only need an approximate equality (you usually do), use this
* template.
*
* Usage: if (float_equal(var, number, 0.0001)) { }
*
*
* 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)

View File

@ -52,7 +52,7 @@ typedef unsigned reg_syntax_t;
#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
/* 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. */
#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
expressions, of course).
If this bit is not set, then it depends:
^ is an anchor if it is at the beginning of a regular
expression or after an open-group or an alternation operator;
$ is an anchor if it is at the end of a regular expression, or
before a close-group or an alternation operator.
^ is an anchor if it is at the beginning of a regular
expression or after an open-group or an alternation operator;
$ is an anchor if it is at the end of a regular expression, or
before a close-group or an alternation operator.
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
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
regardless of where they are in the pattern.
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,
open-group, or alternation operator. */
#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)
/* 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. */
#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. */
#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. */
#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.
(The [[[ comments delimit what gets put into the Texinfo file, so
don't delete them!) */
don't delete them!) */
/* [[[begin syntaxes]]] */
#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_UNMATCHED_RIGHT_PAREN_ORD)
#define RE_SYNTAX_POSIX_AWK \
#define RE_SYNTAX_POSIX_AWK \
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
#define RE_SYNTAX_GREP \
@ -215,7 +215,7 @@ extern reg_syntax_t re_syntax_options;
#ifdef RE_DUP_MAX
#undef RE_DUP_MAX
#endif
#define RE_DUP_MAX ((1 << 15) - 1)
#define RE_DUP_MAX ((1 << 15) - 1)
/* 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 not set, then case is significant. */
#define REG_ICASE (REG_EXTENDED << 1)
/* If this bit is set, then anchors do not match at newline
characters in the string.
If not set, then anchors do match at newlines. */
@ -266,7 +266,7 @@ typedef enum
REG_EESCAPE, /* Trailing backslash. */
REG_ESUBREG, /* Invalid back reference. */
REG_EBRACK, /* Unmatched left bracket. */
REG_EPAREN, /* Parenthesis imbalance. */
REG_EPAREN, /* Parenthesis imbalance. */
REG_EBRACE, /* Unmatched \{. */
REG_BADBR, /* Invalid contents of \{\}. */
REG_ERANGE, /* Invalid range end. */
@ -289,65 +289,65 @@ struct re_pattern_buffer
{
/* [[[begin pattern_buffer]]] */
/* Space that holds the compiled pattern. It is declared as
`unsigned char *' because its elements are
sometimes used as array indexes. */
`unsigned char *' because its elements are
sometimes used as array indexes. */
unsigned char *buffer;
/* Number of bytes to which `buffer' points. */
unsigned long allocated;
/* 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;
/* Pointer to a fastmap, if any, otherwise zero. re_search uses
the fastmap, if there is one, to skip over impossible
starting points for matches. */
/* Pointer to a fastmap, if any, otherwise zero. re_search uses
the fastmap, if there is one, to skip over impossible
starting points for matches. */
char *fastmap;
/* Either a translate table to apply to all characters before
comparing them, or zero for no translation. The translation
is applied to a pattern when it is compiled and to a string
when it is matched. */
/* Either a translate table to apply to all characters before
comparing them, or zero for no translation. The translation
is applied to a pattern when it is compiled and to a string
when it is matched. */
char *translate;
/* Number of subexpressions found by the compiler. */
size_t re_nsub;
/* Zero if this pattern cannot match the empty string, one else.
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
this absolutely perfectly; see `re_compile_fastmap' (the
`duplicate' case). */
/* Zero if this pattern cannot match the empty string, one else.
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
this absolutely perfectly; see `re_compile_fastmap' (the
`duplicate' case). */
unsigned can_be_null : 1;
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
for `max (RE_NREGS, re_nsub + 1)' groups.
If REGS_REALLOCATE, reallocate space if necessary.
If REGS_FIXED, use what's there. */
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
for `max (RE_NREGS, re_nsub + 1)' groups.
If REGS_REALLOCATE, reallocate space if necessary.
If REGS_FIXED, use what's there. */
#define REGS_UNALLOCATED 0
#define REGS_REALLOCATE 1
#define REGS_FIXED 2
unsigned regs_allocated : 2;
/* Set to zero when `regex_compile' compiles a pattern; set to one
by `re_compile_fastmap' if it updates the fastmap. */
/* Set to zero when `regex_compile' compiles a pattern; set to one
by `re_compile_fastmap' if it updates the fastmap. */
unsigned fastmap_accurate : 1;
/* If set, `re_match_2' does not return information about
subexpressions. */
/* If set, `re_match_2' does not return information about
subexpressions. */
unsigned no_sub : 1;
/* If set, a beginning-of-line anchor doesn't match at the
beginning of the string. */
/* If set, a beginning-of-line anchor doesn't match at the
beginning of the string. */
unsigned not_bol : 1;
/* Similarly for an end-of-line anchor. */
/* Similarly for an end-of-line anchor. */
unsigned not_eol : 1;
/* If true, an anchor at a newline matches. */
/* If true, an anchor at a newline matches. */
unsigned newline_anchor : 1;
/* [[[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. */
extern const char *re_compile_pattern
_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
@ -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). */
extern int re_search
_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
STRING2. Also, stop searching at index START + STOP. */
extern int re_search_2
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
int length1, const char *string2, int length2,
int start, int range, struct re_registers *regs, int stop));
int length1, const char *string2, int length2,
int start, int range, struct re_registers *regs, int stop));
/* Like `re_search', but return how many characters in STRING the regexp
in BUFFER matched, starting at position START. */
extern int re_match
_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'. */
extern int re_match_2
extern int re_match_2
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
int length1, const char *string2, int length2,
int start, struct re_registers *regs, int stop));
int length1, const char *string2, int length2,
int start, struct re_registers *regs, int stop));
/* 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. */
extern void re_set_registers
_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. */
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 regexec
_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
_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));
/* LyX added. */

View File

@ -1,8 +1,8 @@
/* This file is part of
* ======================================================
*
* ======================================================
*
* LyX, The Document Processor
*
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2000 The LyX Team.
*
@ -77,7 +77,7 @@ struct lyxstring::Srep {
size_t res;
/// Data. At least 1 char for trailing null.
lyxstring::value_type * s;
///
Srep(lyxstring::size_type nsz, const lyxstring::value_type * p);
///
@ -90,7 +90,7 @@ struct lyxstring::Srep {
--ref;
return new Srep(sz, s);
}
///
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;
}
}
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);
delete[] s;
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
///////////////////////////////////////
// There are no know bugs in lyxstring now, and it have been
// tested for a long time. so we disable the invariant checker. (Lgb)
#undef ENABLE_ASSERTIONS
@ -313,7 +313,7 @@ void lyxstring::Srep::replace(lyxstring::size_type i, lyxstring::size_type n,
/** Testing of the lyxstring invariant
* By creating an object that tests the lyxstring invariant during its
* 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
* 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
@ -523,7 +523,7 @@ const_reverse_iterator lyxstring::rend() const
///////////////////////
lyxstring::size_type lyxstring::size() const
{
{
return rep->sz;
}
@ -601,7 +601,7 @@ lyxstring & lyxstring::assign(lyxstring const & x)
rep = x.rep; // share representation
return *this;
}
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));
}
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;
}
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);
}
////////////////
// Find
////////////////
// All the below find functions should be verified,
// it is very likely that I have mixed up or interpreted
// some of the parameters wrong, also some of the funcs can surely
// be written more effectively.
// All the below find functions should be verified,
// it is very likely that I have mixed up or interpreted
// some of the parameters wrong, also some of the funcs can surely
// be written more effectively.
lyxstring::size_type lyxstring::find(lyxstring const & a, size_type i) const
{
if (!rep->sz || i >= rep->sz) return npos;
TestlyxstringInvariant(this);
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!
if (!rep->sz || !*ptr || i >= rep->sz) return npos;
TestlyxstringInvariant(this);
// 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!
if (!rep->sz || i >= rep->sz) return npos;
TestlyxstringInvariant(this);
if (!s || !*s) return npos;
@ -968,10 +968,10 @@ lyxstring::size_type lyxstring::find(value_type c, size_type i) const
TestlyxstringInvariant(this);
for (size_type t = 0; t + i < rep->sz; ++t) {
if (rep->s[t + i] == c) return t + i;
for (size_type t = 0; t + i < rep->sz; ++t) {
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);
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);
}
lyxstring & lyxstring::replace(iterator i, iterator i2,
iterator j, iterator j2)
@ -1478,11 +1478,11 @@ int lyxstring::internal_compare(size_type pos, size_type n,
if (!*s) return 1;
// 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
// so we have to ensure that n is no larger than rep->sz
n = min(n, 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
n = min(n, rep->sz);
n2 = min(n2, slen);
if (n == n2)
if (n == n2)
return memcmp(&(rep->s[pos]), s, n);
int c = memcmp(&(rep->s[pos]), s, min(n, n2));
if (c)

Some files were not shown because too many files have changed in this diff Show More