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

View File

@ -312,4 +312,3 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
} }
} }
} }

View File

@ -375,7 +375,7 @@ string const UpdatableInset::selectNextWordToSpellcheck(BufferView *bv,
bool UpdatableInset::searchForward(BufferView * bv, string const &, bool UpdatableInset::searchForward(BufferView * bv, string const &,
bool, bool) bool, bool)
{ {
// we have to unlock ourself in this function by default! // we have to unlock ourself in this function by default!
bv->unlockInset(const_cast<UpdatableInset *>(this)); bv->unlockInset(const_cast<UpdatableInset *>(this));
@ -384,7 +384,7 @@ bool UpdatableInset::searchForward(BufferView * bv, string const &,
bool UpdatableInset::searchBackward(BufferView * bv, string const &, bool UpdatableInset::searchBackward(BufferView * bv, string const &,
bool, bool) bool, bool)
{ {
// we have to unlock ourself in this function by default! // we have to unlock ourself in this function by default!
bv->unlockInset(const_cast<UpdatableInset *>(this)); bv->unlockInset(const_cast<UpdatableInset *>(this));

View File

@ -190,7 +190,7 @@ public:
bool free_spc) const = 0; bool free_spc) const = 0;
/// ///
virtual int ascii(Buffer const *, virtual int ascii(Buffer const *,
std::ostream &, int linelen = 0) const = 0; std::ostream &, int linelen = 0) const = 0;
/// ///
virtual int linuxdoc(Buffer const *, std::ostream &) const = 0; virtual int linuxdoc(Buffer const *, std::ostream &) const = 0;
/// ///
@ -298,7 +298,7 @@ public:
virtual bool checkInsertChar(LyXFont &); virtual bool checkInsertChar(LyXFont &);
/// we need this here because collapsed insets are only EDITABLE /// we need this here because collapsed insets are only EDITABLE
virtual void setFont(BufferView *, LyXFont const &, virtual void setFont(BufferView *, LyXFont const &,
bool toggleall = false, bool selectall = false); bool toggleall = false, bool selectall = false);
/// ///
// needed for spellchecking text // needed for spellchecking text
/// ///
@ -398,17 +398,17 @@ public:
DISPATCHED = the inset catched the action DISPATCHED = the inset catched the action
DISPATCHED_NOUPDATE = the inset catched the action and no update DISPATCHED_NOUPDATE = the inset catched the action and no update
is needed here to redraw the inset is needed here to redraw the inset
FINISHED = the inset must be unlocked as a result FINISHED = the inset must be unlocked as a result
of the action of the action
FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of
the inset. the inset.
FINISHED_UP = FINISHED, but put the cursor UP of FINISHED_UP = FINISHED, but put the cursor UP of
the inset. the inset.
FINISHED_DOWN = FINISHED, but put the cursor DOWN of FINISHED_DOWN = FINISHED, but put the cursor DOWN of
the inset. the inset.
UNDISPATCHED = the action was not catched, it should be UNDISPATCHED = the action was not catched, it should be
dispatched by lower level insets dispatched by lower level insets
*/ */
enum RESULT { enum RESULT {
UNDISPATCHED = 0, UNDISPATCHED = 0,
@ -454,7 +454,7 @@ public:
// if that one has one! // if that one has one!
/// ///
virtual bool insetButtonRelease(BufferView *, virtual bool insetButtonRelease(BufferView *,
int x, int y, int button); int x, int y, int button);
/// ///
virtual void insetKeyPress(XKeyEvent * ev); virtual void insetKeyPress(XKeyEvent * ev);
/// ///
@ -487,7 +487,7 @@ public:
{ return false; } { return false; }
/// ///
virtual bool unlockInsetInInset(BufferView *, UpdatableInset *, virtual bool unlockInsetInInset(BufferView *, UpdatableInset *,
bool /*lr*/ = false) bool /*lr*/ = false)
{ return false; } { return false; }
/// An updatable inset could handle lyx editing commands /// An updatable inset could handle lyx editing commands
virtual RESULT localDispatch(BufferView *, kb_action, string const &); virtual RESULT localDispatch(BufferView *, kb_action, string const &);
@ -526,10 +526,10 @@ public:
// needed for search/replace functionality // needed for search/replace functionality
/// ///
virtual bool searchForward(BufferView *, string const &, virtual bool searchForward(BufferView *, string const &,
bool = true, bool = false); bool = true, bool = false);
/// ///
virtual bool searchBackward(BufferView *, string const &, virtual bool searchBackward(BufferView *, string const &,
bool = true, bool = false); bool = true, bool = false);
protected: protected:
/// ///

View File

@ -159,7 +159,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
} }
} }
if (!buffer->niceFile if (!buffer->niceFile
&& IsFileReadable(MakeAbsPath(style, buffer->filePath()) + ".bst")) { && IsFileReadable(MakeAbsPath(style, buffer->filePath()) + ".bst")) {
style = MakeAbsPath(style, buffer->filePath()); style = MakeAbsPath(style, buffer->filePath());
} }
@ -169,7 +169,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
} }
// bibtotoc-Option // bibtotoc-Option
if (!bibtotoc.empty()) { if (!bibtotoc.empty()) {
// maybe a problem when a textclass has no "art" as // maybe a problem when a textclass has no "art" as
// part of its name, because it's than book. // part of its name, because it's than book.
// For the "official" lyx-layouts it's no problem to support // For the "official" lyx-layouts it's no problem to support
@ -201,7 +201,7 @@ int InsetBibtex::latex(Buffer const * buffer, ostream & os,
while (!adb.empty()) { while (!adb.empty()) {
if (!buffer->niceFile && if (!buffer->niceFile &&
IsFileReadable(MakeAbsPath(adb, buffer->filePath())+".bib")) IsFileReadable(MakeAbsPath(adb, buffer->filePath())+".bib"))
adb = os::external_path(MakeAbsPath(adb, buffer->filePath())); adb = os::external_path(MakeAbsPath(adb, buffer->filePath()));
db_out += adb; db_out += adb;
db_out += ','; db_out += ',';
db_in= split(db_in, adb,','); db_in= split(db_in, adb,',');
@ -231,7 +231,7 @@ vector<string> const InsetBibtex::getFiles(Buffer const & buffer) const
vec.push_back(file); vec.push_back(file);
// Get next file name // Get next file name
bibfiles = split(bibfiles, tmp, ','); bibfiles = split(bibfiles, tmp, ',');
} }
return vec; return vec;
@ -273,7 +273,7 @@ vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer)
} }
} }
} }
return keys; return keys;
} }

View File

@ -98,7 +98,7 @@ public:
void edit(BufferView * bv, bool front = true); void edit(BufferView * bv, bool front = true);
/// ///
int latex(Buffer const *, std::ostream &, int latex(Buffer const *, std::ostream &,
bool fragile, bool freespace) const; bool fragile, bool freespace) const;
/// ///
std::vector<std::pair<string,string> > const getKeys(Buffer const *) const; std::vector<std::pair<string,string> > const getKeys(Buffer const *) const;
/// ///
@ -110,7 +110,7 @@ public:
/// ///
bool display() const { return true; } bool display() const { return true; }
/// ///
struct Holder { struct Holder {
InsetBibtex * inset; InsetBibtex * inset;
BufferView * view; BufferView * view;
}; };

View File

@ -36,9 +36,9 @@ int InsetButton::ascent(BufferView * bv, LyXFont const &) const
int width; int width;
int ascent; int ascent;
int descent; int descent;
string const s = getScreenLabel(bv->buffer()); string const s = getScreenLabel(bv->buffer());
if (editable()) { if (editable()) {
lyxfont::buttonText(s, font, width, ascent, descent); lyxfont::buttonText(s, font, width, ascent, descent);
} else { } else {
lyxfont::rectText(s, font, width, ascent, descent); lyxfont::rectText(s, font, width, ascent, descent);
@ -58,9 +58,9 @@ int InsetButton::descent(BufferView * bv, LyXFont const &) const
int width; int width;
int ascent; int ascent;
int descent; int descent;
string const s = getScreenLabel(bv->buffer()); string const s = getScreenLabel(bv->buffer());
if (editable()) { if (editable()) {
lyxfont::buttonText(s, font, width, ascent, descent); lyxfont::buttonText(s, font, width, ascent, descent);
} else { } else {
lyxfont::rectText(s, font, width, ascent, descent); lyxfont::rectText(s, font, width, ascent, descent);
@ -80,9 +80,9 @@ int InsetButton::width(BufferView * bv, LyXFont const &) const
int width; int width;
int ascent; int ascent;
int descent; int descent;
string const s = getScreenLabel(bv->buffer()); string const s = getScreenLabel(bv->buffer());
if (editable()) { if (editable()) {
lyxfont::buttonText(s, font, width, ascent, descent); lyxfont::buttonText(s, font, width, ascent, descent);
} else { } else {
lyxfont::rectText(s, font, width, ascent, descent); lyxfont::rectText(s, font, width, ascent, descent);

View File

@ -76,8 +76,8 @@ void InsetCitation::edit(BufferView * bv, bool)
int InsetCitation::ascii(Buffer const *, ostream & os, int) const int InsetCitation::ascii(Buffer const *, ostream & os, int) const
{ {
os << "[" << getContents() << "]"; os << "[" << getContents() << "]";
return 0; return 0;
} }
// Have to overwrite the default InsetCommand method in order to check that // Have to overwrite the default InsetCommand method in order to check that

View File

@ -39,7 +39,7 @@ public:
void edit(BufferView * bv, bool front = true); void edit(BufferView * bv, bool front = true);
/// ///
int ascii(Buffer const *, std::ostream &, int linelen) const; int ascii(Buffer const *, std::ostream &, int linelen) const;
/// ///
int latex(Buffer const *, std::ostream &, bool, bool) const; int latex(Buffer const *, std::ostream &, bool, bool) const;
/// ///
void validate(LaTeXFeatures &) const; void validate(LaTeXFeatures &) const;

View File

@ -179,7 +179,7 @@ void InsetCollapsable::draw_collapsed(Painter & pain,
void InsetCollapsable::draw(BufferView * bv, LyXFont const & f, void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const int baseline, float & x, bool cleared) const
{ {
if (need_update != NONE) { if (need_update != NONE) {
const_cast<InsetText *>(&inset)->update(bv, f, true); const_cast<InsetText *>(&inset)->update(bv, f, true);
@ -208,9 +208,9 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
x += static_cast<float>(scroll()); x += static_cast<float>(scroll());
if (!cleared && (inset.need_update == InsetText::FULL || if (!cleared && (inset.need_update == InsetText::FULL ||
inset.need_update == InsetText::INIT || inset.need_update == InsetText::INIT ||
top_x != int(x) || top_x != int(x) ||
top_baseline != baseline)) top_baseline != baseline))
{ {
// we don't need anymore to clear here we just have to tell // we don't need anymore to clear here we just have to tell
// the underlying LyXText that it should do the RowClear! // the underlying LyXText that it should do the RowClear!
@ -235,7 +235,7 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
void InsetCollapsable::edit(BufferView * bv, int xp, int yp, void InsetCollapsable::edit(BufferView * bv, int xp, int yp,
unsigned int button) unsigned int button)
{ {
UpdatableInset::edit(bv, xp, yp, button); UpdatableInset::edit(bv, xp, yp, button);
@ -313,7 +313,7 @@ void InsetCollapsable::insetUnlock(BufferView * bv)
void InsetCollapsable::insetButtonPress(BufferView * bv, void InsetCollapsable::insetButtonPress(BufferView * bv,
int x, int y, int button) int x, int y, int button)
{ {
if (!collapsed_ && (y > button_bottom_y)) { if (!collapsed_ && (y > button_bottom_y)) {
LyXFont font(LyXFont::ALL_SANE); LyXFont font(LyXFont::ALL_SANE);
@ -327,7 +327,7 @@ void InsetCollapsable::insetButtonPress(BufferView * bv,
bool InsetCollapsable::insetButtonRelease(BufferView * bv, bool InsetCollapsable::insetButtonRelease(BufferView * bv,
int x, int y, int button) int x, int y, int button)
{ {
bool ret = false; bool ret = false;
if ((button != 3) && (x >= 0) && (x < button_length) && if ((button != 3) && (x >= 0) && (x < button_length) &&
@ -360,7 +360,7 @@ bool InsetCollapsable::insetButtonRelease(BufferView * bv,
void InsetCollapsable::insetMotionNotify(BufferView * bv, void InsetCollapsable::insetMotionNotify(BufferView * bv,
int x, int y, int state) int x, int y, int state)
{ {
if (y > button_bottom_y) { if (y > button_bottom_y) {
LyXFont font(LyXFont::ALL_SANE); LyXFont font(LyXFont::ALL_SANE);
@ -380,7 +380,7 @@ void InsetCollapsable::insetKeyPress(XKeyEvent * xke)
int InsetCollapsable::latex(Buffer const * buf, ostream & os, int InsetCollapsable::latex(Buffer const * buf, ostream & os,
bool fragile, bool free_spc) const bool fragile, bool free_spc) const
{ {
return inset.latex(buf, os, fragile, free_spc); return inset.latex(buf, os, fragile, free_spc);
} }
@ -405,7 +405,7 @@ int InsetCollapsable::docbook(Buffer const * buf, ostream & os) const
#if 0 #if 0
int InsetCollapsable::getMaxWidth(BufferView * bv, int InsetCollapsable::getMaxWidth(BufferView * bv,
UpdatableInset const * in) const UpdatableInset const * in) const
{ {
#if 0 #if 0
int const w = UpdatableInset::getMaxWidth(bv, in); int const w = UpdatableInset::getMaxWidth(bv, in);
@ -425,7 +425,7 @@ int InsetCollapsable::getMaxWidth(BufferView * bv,
void InsetCollapsable::update(BufferView * bv, LyXFont const & font, void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
bool reinit) bool reinit)
{ {
if (in_update) { if (in_update) {
if (reinit && owner()) { if (reinit && owner()) {
@ -444,7 +444,7 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
UpdatableInset::RESULT UpdatableInset::RESULT
InsetCollapsable::localDispatch(BufferView * bv, kb_action action, InsetCollapsable::localDispatch(BufferView * bv, kb_action action,
string const & arg) string const & arg)
{ {
UpdatableInset::RESULT result = inset.localDispatch(bv, action, arg); UpdatableInset::RESULT result = inset.localDispatch(bv, action, arg);
if (result >= FINISHED) if (result >= FINISHED)
@ -463,7 +463,7 @@ bool InsetCollapsable::lockInsetInInset(BufferView * bv, UpdatableInset * in)
bool InsetCollapsable::unlockInsetInInset(BufferView * bv, UpdatableInset * in, bool InsetCollapsable::unlockInsetInInset(BufferView * bv, UpdatableInset * in,
bool lr) bool lr)
{ {
if (&inset == in) { if (&inset == in) {
bv->unlockInset(this); bv->unlockInset(this);
@ -535,7 +535,7 @@ UpdatableInset * InsetCollapsable::getFirstLockingInsetOfType(Inset::Code c)
void InsetCollapsable::setFont(BufferView * bv, LyXFont const & font, void InsetCollapsable::setFont(BufferView * bv, LyXFont const & font,
bool toggleall, bool selectall) bool toggleall, bool selectall)
{ {
inset.setFont(bv, font, toggleall, selectall); inset.setFont(bv, font, toggleall, selectall);
} }
@ -650,7 +650,7 @@ void InsetCollapsable::setLabel(string const & l) const
bool InsetCollapsable::searchForward(BufferView * bv, string const & str, bool InsetCollapsable::searchForward(BufferView * bv, string const & str,
bool cs, bool mw) bool cs, bool mw)
{ {
bool found = inset.searchForward(bv, str, cs, mw); bool found = inset.searchForward(bv, str, cs, mw);
if (first_after_edit && !found) if (first_after_edit && !found)
@ -661,7 +661,7 @@ bool InsetCollapsable::searchForward(BufferView * bv, string const & str,
bool InsetCollapsable::searchBackward(BufferView * bv, string const & str, bool InsetCollapsable::searchBackward(BufferView * bv, string const & str,
bool cs, bool mw) bool cs, bool mw)
{ {
bool found = inset.searchBackward(bv, str, cs, mw); bool found = inset.searchBackward(bv, str, cs, mw);
if (first_after_edit && !found) if (first_after_edit && !found)

View File

@ -83,7 +83,7 @@ public:
bool lockInsetInInset(BufferView *, UpdatableInset *); bool lockInsetInInset(BufferView *, UpdatableInset *);
/// ///
bool unlockInsetInInset(BufferView *, UpdatableInset *, bool unlockInsetInInset(BufferView *, UpdatableInset *,
bool lr = false); bool lr = false);
/// ///
bool updateInsetInInset(BufferView *, Inset *); bool updateInsetInInset(BufferView *, Inset *);
/// ///
@ -98,7 +98,7 @@ public:
void insetKeyPress(XKeyEvent *); void insetKeyPress(XKeyEvent *);
/// ///
UpdatableInset::RESULT localDispatch(BufferView *, kb_action, UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
string const &); string const &);
/// ///
int latex(Buffer const *, std::ostream &, int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const; bool fragile, bool free_spc) const;
@ -127,7 +127,7 @@ public:
UpdatableInset * getFirstLockingInsetOfType(Inset::Code); UpdatableInset * getFirstLockingInsetOfType(Inset::Code);
/// ///
void setFont(BufferView *, LyXFont const &, bool toggleall = false, void setFont(BufferView *, LyXFont const &, bool toggleall = false,
bool selectall = false); bool selectall = false);
/// ///
void setLabel(string const & l) const; void setLabel(string const & l) const;
/// ///
@ -188,9 +188,9 @@ public:
} }
/// ///
bool searchForward(BufferView * bv, string const & str, bool searchForward(BufferView * bv, string const & str,
bool = true, bool = false); bool = true, bool = false);
bool searchBackward(BufferView * bv, string const & str, bool searchBackward(BufferView * bv, string const & str,
bool = true, bool = false); bool = true, bool = false);
protected: protected:
/// ///

View File

@ -105,11 +105,11 @@ void InsetCommandParams::scanCommand(string const & cmd)
} }
if ((state == OPTION && c == '[') || if ((state == OPTION && c == '[') ||
(state == CONTENT && c == '{')) { (state == CONTENT && c == '{')) {
++nestdepth; ++nestdepth;
} }
switch (state) { switch (state) {
case CMDNAME: tcmdname += c; break; case CMDNAME: tcmdname += c; break;
case OPTION: toptions += c; break; case OPTION: toptions += c; break;
case CONTENT: tcontents += c; break; case CONTENT: tcontents += c; break;
case WS: case WS:
if (c == '\\') { if (c == '\\') {

View File

@ -247,8 +247,8 @@ void InsetERT::setFont(BufferView *, LyXFont const &, bool, bool selectall)
// fontchange and this messages is not needed // fontchange and this messages is not needed
if (!selectall) if (!selectall)
Alert::alert(_("Impossible Operation!"), Alert::alert(_("Impossible Operation!"),
_("Not permitted to change font-types inside ERT-insets!"), _("Not permitted to change font-types inside ERT-insets!"),
_("Sorry.")); _("Sorry."));
} }
@ -300,7 +300,7 @@ void InsetERT::edit(BufferView * bv, bool front)
void InsetERT::insetButtonPress(BufferView * bv, void InsetERT::insetButtonPress(BufferView * bv,
int x, int y, int button) int x, int y, int button)
{ {
if (status_ == Inlined) { if (status_ == Inlined) {
inset.insetButtonPress(bv, x, y, button); inset.insetButtonPress(bv, x, y, button);
@ -338,7 +338,7 @@ bool InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
void InsetERT::insetMotionNotify(BufferView * bv, void InsetERT::insetMotionNotify(BufferView * bv,
int x, int y, int state) int x, int y, int state)
{ {
if (status_ == Inlined) { if (status_ == Inlined) {
inset.insetMotionNotify(bv, x, y, state); inset.insetMotionNotify(bv, x, y, state);
@ -556,7 +556,7 @@ int InsetERT::width(BufferView * bv, LyXFont const & font) const
void InsetERT::draw(BufferView * bv, LyXFont const & f, void InsetERT::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const int baseline, float & x, bool cleared) const
{ {
Painter & pain = bv->painter(); Painter & pain = bv->painter();
@ -577,9 +577,9 @@ void InsetERT::draw(BufferView * bv, LyXFont const & f,
x += static_cast<float>(scroll()); x += static_cast<float>(scroll());
if (!cleared && (inset.need_update == InsetText::FULL || if (!cleared && (inset.need_update == InsetText::FULL ||
inset.need_update == InsetText::INIT || inset.need_update == InsetText::INIT ||
top_x != int(x) || top_x != int(x) ||
top_baseline != baseline)) top_baseline != baseline))
{ {
// we don't need anymore to clear here we just have to tell // we don't need anymore to clear here we just have to tell
// the underlying LyXText that it should do the RowClear! // the underlying LyXText that it should do the RowClear!
@ -675,7 +675,7 @@ void InsetERT::close(BufferView * bv) const
string const InsetERT::selectNextWordToSpellcheck(BufferView * bv, string const InsetERT::selectNextWordToSpellcheck(BufferView * bv,
float &) const float &) const
{ {
bv->unlockInset(const_cast<InsetERT *>(this)); bv->unlockInset(const_cast<InsetERT *>(this));
return string(); return string();

View File

@ -65,7 +65,7 @@ public:
bool insetAllowed(Inset::Code) const { return false; } bool insetAllowed(Inset::Code) const { return false; }
/// ///
void setFont(BufferView *, LyXFont const &, void setFont(BufferView *, LyXFont const &,
bool toggleall = false, bool selectall = false); bool toggleall = false, bool selectall = false);
/// ///
void edit(BufferView *, int, int, unsigned int); void edit(BufferView *, int, int, unsigned int);
/// ///
@ -85,7 +85,7 @@ public:
bool free_spc) const; bool free_spc) const;
/// ///
int ascii(Buffer const *, int ascii(Buffer const *,
std::ostream &, int linelen = 0) const; std::ostream &, int linelen = 0) const;
/// ///
int linuxdoc(Buffer const *, std::ostream &) const; int linuxdoc(Buffer const *, std::ostream &) const;
/// ///
@ -94,7 +94,7 @@ public:
void validate(LaTeXFeatures &) const {} void validate(LaTeXFeatures &) const {}
/// ///
UpdatableInset::RESULT localDispatch(BufferView *, kb_action, UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
string const &); string const &);
/// ///
bool checkInsertChar(LyXFont &); bool checkInsertChar(LyXFont &);
/// ///

View File

@ -342,6 +342,5 @@ bool operator==(InsetExternal::Params const & left,
bool operator!=(InsetExternal::Params const & left, bool operator!=(InsetExternal::Params const & left,
InsetExternal::Params const & right) InsetExternal::Params const & right)
{ {
return !(left == right); return !(left == right);
} }

View File

@ -61,7 +61,7 @@ public:
is in a free-spacing paragraph. is in a free-spacing paragraph.
*/ */
virtual int latex(Buffer const *, std::ostream &, bool fragile, virtual int latex(Buffer const *, std::ostream &, bool fragile,
bool free_spc) const; bool free_spc) const;
/// write ASCII output to the ostream /// write ASCII output to the ostream
virtual int ascii(Buffer const *, std::ostream &, int linelen) const; virtual int ascii(Buffer const *, std::ostream &, int linelen) const;
/// write LinuxDoc output to the ostream /// write LinuxDoc output to the ostream

View File

@ -41,6 +41,3 @@ public:
}; };
#endif #endif

View File

@ -38,8 +38,3 @@ public:
}; };
#endif #endif

View File

@ -23,7 +23,7 @@ Known BUGS:
which is relative if it is at reference path (here puffer path) which is relative if it is at reference path (here puffer path)
level or below, and an absolute path if the file name is not a level or below, and an absolute path if the file name is not a
`natural' relative file name. In any case, `natural' relative file name. In any case,
MakeAbsPath(filename, buf->filePath()) MakeAbsPath(filename, buf->filePath())
is guaranteed to provide the correct absolute path. This is what is is guaranteed to provide the correct absolute path. This is what is
done know for include insets. Feel free to ask me -- JMarc done know for include insets. Feel free to ask me -- JMarc
14/01/2002 14/01/2002
@ -60,13 +60,13 @@ TODO Before initial production release:
* *
* PDF output is best done with PDF figures if it's a direct conversion * PDF output is best done with PDF figures if it's a direct conversion
* or PNG figures otherwise. * or PNG figures otherwise.
* Image format * Image format
* from to * from to
* EPS epstopdf * EPS epstopdf
* PS ps2pdf * PS ps2pdf
* JPG/PNG direct * JPG/PNG direct
* PDF direct * PDF direct
* others PNG * others PNG
*/ */
#include <config.h> #include <config.h>
@ -275,7 +275,7 @@ int InsetGraphics::width(BufferView *, LyXFont const & font) const
void InsetGraphics::draw(BufferView * bv, LyXFont const & font, void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
int baseline, float & x, bool) const int baseline, float & x, bool) const
{ {
int oasc = old_asc; int oasc = old_asc;
grfx::ImageStatus old_status_ = cached_status_; grfx::ImageStatus old_status_ = cached_status_;
@ -311,14 +311,14 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
if (drawImage()) { if (drawImage()) {
// lyxerr << "IG(" << this << "): " << old_x << endl; // lyxerr << "IG(" << this << "): " << old_x << endl;
paint.image(old_x + 2, baseline - lascent, paint.image(old_x + 2, baseline - lascent,
lwidth - 4, lascent + ldescent, lwidth - 4, lascent + ldescent,
*cached_image_.get()); *cached_image_.get());
} else { } else {
paint.rectangle(old_x + 2, baseline - lascent, paint.rectangle(old_x + 2, baseline - lascent,
lwidth - 4, lwidth - 4,
lascent + ldescent); lascent + ldescent);
// Print the file name. // Print the file name.
LyXFont msgFont(font); LyXFont msgFont(font);

View File

@ -61,7 +61,7 @@ public:
fragile commands by adding a #\protect# before. fragile commands by adding a #\protect# before.
*/ */
int latex(Buffer const *, std::ostream &, int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const; bool fragile, bool free_spc) const;
/// ///
int ascii(Buffer const *, std::ostream &, int linelen) const; int ascii(Buffer const *, std::ostream &, int linelen) const;
/// ///

View File

@ -146,28 +146,28 @@ void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
} }
bool operator==(InsetGraphicsParams const & left, bool operator==(InsetGraphicsParams const & left,
InsetGraphicsParams const & right) InsetGraphicsParams const & right)
{ {
if (left.filename == right.filename && if (left.filename == right.filename &&
left.bb == right.bb && left.bb == right.bb &&
left.draft == right.draft && left.draft == right.draft &&
left.clip == right.clip && left.clip == right.clip &&
left.display == right.display && left.display == right.display &&
left.subcaption == right.subcaption && left.subcaption == right.subcaption &&
left.noUnzip == right.noUnzip && left.noUnzip == right.noUnzip &&
left.subcaptionText == right.subcaptionText && left.subcaptionText == right.subcaptionText &&
left.keepAspectRatio == right.keepAspectRatio && left.keepAspectRatio == right.keepAspectRatio &&
left.width == right.width && left.width == right.width &&
left.height == right.height && left.height == right.height &&
left.scale == right.scale && left.scale == right.scale &&
left.size_type == right.size_type && left.size_type == right.size_type &&
left.lyxsize_type == right.lyxsize_type && left.lyxsize_type == right.lyxsize_type &&
left.lyxwidth == right.lyxwidth && left.lyxwidth == right.lyxwidth &&
left.lyxheight == right.lyxheight && left.lyxheight == right.lyxheight &&
left.lyxscale == right.lyxscale && left.lyxscale == right.lyxscale &&
left.rotate == right.rotate && left.rotate == right.rotate &&
left.rotateOrigin == right.rotateOrigin && left.rotateOrigin == right.rotateOrigin &&
lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 && lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
left.special == right.special) left.special == right.special)
) )
return true; return true;
@ -176,9 +176,9 @@ bool operator==(InsetGraphicsParams const & left,
} }
bool operator!=(InsetGraphicsParams const & left, bool operator!=(InsetGraphicsParams const & left,
InsetGraphicsParams const & right) InsetGraphicsParams const & right)
{ {
return !(left == right); return !(left == right);
} }
@ -238,7 +238,7 @@ void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const
bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex, bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
string const& token) string const& token)
{ {
if (token == "filename") { if (token == "filename") {
lex.next(); lex.next();

View File

@ -96,18 +96,18 @@ void InsetInclude::set(Params const & p)
string command; string command;
switch (params_.flag) { switch (params_.flag) {
case INCLUDE: case INCLUDE:
command="include"; command="include";
break; break;
case VERB: case VERB:
command="verbatiminput"; command="verbatiminput";
break; break;
case INPUT: case INPUT:
command="input"; command="input";
break; break;
case VERBAST: case VERBAST:
command="verbatiminput*"; command="verbatiminput*";
break; break;
} }
params_.cparams.setCmdName(command); params_.cparams.setCmdName(command);

View File

@ -26,8 +26,8 @@ struct LaTeXFeatures;
*/ */
class InsetInclude: public InsetButton, boost::noncopyable { class InsetInclude: public InsetButton, boost::noncopyable {
public: public:
/// the type of inclusion /// the type of inclusion
enum Flags { enum Flags {
/// ///
INCLUDE = 0, INCLUDE = 0,
/// ///
@ -91,7 +91,7 @@ public:
void read(Buffer const *, LyXLex &); void read(Buffer const *, LyXLex &);
/// ///
int latex(Buffer const *, std::ostream &, int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const; bool fragile, bool free_spc) const;
/// ///
int ascii(Buffer const *, std::ostream &, int linelen) const; int ascii(Buffer const *, std::ostream &, int linelen) const;
/// ///
@ -101,7 +101,7 @@ public:
/// ///
void validate(LaTeXFeatures &) const; void validate(LaTeXFeatures &) const;
/** Input inserts anything inside a paragraph. /** Input inserts anything inside a paragraph.
Display can give some visual feedback Display can give some visual feedback
*/ */
bool display() const; bool display() const;
@ -122,10 +122,10 @@ private:
string const getScreenLabel(Buffer const *) const; string const getScreenLabel(Buffer const *) const;
/// is this a verbatim include ? /// is this a verbatim include ?
bool isVerbatim() const; bool isVerbatim() const;
/// get the filename of the master buffer /// get the filename of the master buffer
string const getMasterFilename() const; string const getMasterFilename() const;
/// get the included file name /// get the included file name
string const getFileName() const; string const getFileName() const;
/// the parameters /// the parameters
Params params_; Params params_;

View File

@ -46,7 +46,7 @@ int InsetIndex::docbook(Buffer const *, ostream & os) const
Inset::Code InsetIndex::lyxCode() const Inset::Code InsetIndex::lyxCode() const
{ {
return Inset::INDEX_CODE; return Inset::INDEX_CODE;
} }
@ -68,5 +68,5 @@ void InsetPrintIndex::validate(LaTeXFeatures & features) const
Inset::Code InsetPrintIndex::lyxCode() const Inset::Code InsetPrintIndex::lyxCode() const
{ {
return Inset::INDEX_PRINT_CODE; return Inset::INDEX_PRINT_CODE;
} }

View File

@ -40,7 +40,7 @@ public:
std::vector<string> const getLabelList() const; std::vector<string> const getLabelList() const;
/// ///
int latex(Buffer const *, std::ostream &, int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const; bool fragile, bool free_spc) const;
/// ///
int ascii(Buffer const *, std::ostream &, int linelen) const; int ascii(Buffer const *, std::ostream &, int linelen) const;
/// ///

View File

@ -43,9 +43,9 @@ InsetLatexAccent::InsetLatexAccent(string const & str)
void InsetLatexAccent::checkContents() void InsetLatexAccent::checkContents()
// check, if we know the modifier and can display it ok on screen // check, if we know the modifier and can display it ok on screen
{ {
candisp = false; candisp = false;
if (contents.empty() || contents.length() < 2) { if (contents.empty() || contents.length() < 2) {
lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl; lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl;
@ -90,80 +90,80 @@ void InsetLatexAccent::checkContents()
contents = tmp; contents = tmp;
} }
} }
if (contents[0] != '\\') { // demand that first char is a '\\' if (contents[0] != '\\') { // demand that first char is a '\\'
lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl; lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl;
return; return;
} }
lyxerr[Debug::KEY] << "Decode: " << contents << endl; lyxerr[Debug::KEY] << "Decode: " << contents << endl;
remdot = false; plusasc = false; plusdesc = false; remdot = false; plusasc = false; plusdesc = false;
switch (contents[1]) { // second char should be one of these switch (contents[1]) { // second char should be one of these
case '\'': // acute case '\'': // acute
modtype = ACUTE; // acute modtype = ACUTE; // acute
plusasc = true; // at the top of character plusasc = true; // at the top of character
break; break;
case '`': // grave case '`': // grave
modtype = GRAVE; // grave modtype = GRAVE; // grave
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case '=': // macron case '=': // macron
modtype = MACRON; // macron modtype = MACRON; // macron
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case '~': // tilde case '~': // tilde
modtype = TILDE; // tilde modtype = TILDE; // tilde
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case 'b': // underbar case 'b': // underbar
modtype = UNDERBAR; // underbar modtype = UNDERBAR; // underbar
plusdesc = true; // at the bottom plusdesc = true; // at the bottom
break; break;
case 'c': // cedilla case 'c': // cedilla
modtype = CEDILLA; // cedilla modtype = CEDILLA; // cedilla
plusdesc = true; // at the bottom plusdesc = true; // at the bottom
break; break;
case 'd': // underdot case 'd': // underdot
modtype = UNDERDOT; // underdot modtype = UNDERDOT; // underdot
plusdesc = true; // at the bottom plusdesc = true; // at the bottom
break; break;
case 'r': // circle case 'r': // circle
modtype = CIRCLE; // circle modtype = CIRCLE; // circle
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case 't': // tie case 't': // tie
modtype = TIE; // tie modtype = TIE; // tie
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case 'u': // breve case 'u': // breve
modtype = BREVE; // breve modtype = BREVE; // breve
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case 'v': // caron case 'v': // caron
modtype = CARON; // caron modtype = CARON; // caron
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case 'q': // special caron case 'q': // special caron
modtype = SPECIAL_CARON; // special caron modtype = SPECIAL_CARON; // special caron
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case 'H': // hungarian umlaut case 'H': // hungarian umlaut
modtype = HUNGARIAN_UMLAUT; // hungarian umlaut modtype = HUNGARIAN_UMLAUT; // hungarian umlaut
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case '"': // umlaut case '"': // umlaut
modtype = UMLAUT; // umlaut modtype = UMLAUT; // umlaut
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case '.': // dot case '.': // dot
modtype = DOT; // dot modtype = DOT; // dot
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case '^': // circumflex case '^': // circumflex
modtype = CIRCUMFLEX; // circumflex modtype = CIRCUMFLEX; // circumflex
plusasc = true; // at the top plusasc = true; // at the top
break; break;
case 'k': // ogonek case 'k': // ogonek
modtype = OGONEK; // ogonek modtype = OGONEK; // ogonek
plusdesc = true; plusdesc = true;
@ -178,19 +178,19 @@ void InsetLatexAccent::checkContents()
plusasc = true; // at the top (not really needed) plusasc = true; // at the top (not really needed)
remdot = true; remdot = true;
break; break;
case 'l': // lslash case 'l': // lslash
modtype = lSLASH; modtype = lSLASH;
plusasc = true; // at the top (not really needed) plusasc = true; // at the top (not really needed)
break; break;
case 'L': // lslash case 'L': // lslash
modtype = LSLASH; modtype = LSLASH;
plusasc = true; // at the top (not really needed) plusasc = true; // at the top (not really needed)
break; break;
default: default:
lyxerr[Debug::KEY] << "Default" << endl; lyxerr[Debug::KEY] << "Default" << endl;
// unknow accent (or something else) // unknow accent (or something else)
return; return;
} }
// we demand that third char is a '{' (Lgb) // we demand that third char is a '{' (Lgb)
if (contents[2] != '{') return; if (contents[2] != '{') return;
@ -257,7 +257,7 @@ void InsetLatexAccent::checkContents()
<< ", dot: " << remdot << ", dot: " << remdot
<< ", mod: " << modtype << endl; << ", mod: " << modtype << endl;
} }
candisp = true; candisp = true;
} }
@ -287,10 +287,10 @@ int InsetLatexAccent::descent(BufferView *, LyXFont const & font) const
if (candisp) { if (candisp) {
if (ic == ' ') if (ic == ' ')
max = lyxfont::descent('a', font); max = lyxfont::descent('a', font);
else else
max = lyxfont::descent(ic, font); max = lyxfont::descent(ic, font);
if (plusdesc) if (plusdesc)
max += 3; max += 3;
} else } else
max = lyxfont::maxDescent(font) + 4; max = lyxfont::maxDescent(font) + 4;
return max; return max;
@ -301,8 +301,8 @@ int InsetLatexAccent::width(BufferView *, LyXFont const & font) const
{ {
if (candisp) if (candisp)
return lyxfont::width(ic, font); return lyxfont::width(ic, font);
else else
return lyxfont::width(contents, font) + 4; return lyxfont::width(contents, font) + 4;
} }
@ -346,7 +346,7 @@ bool InsetLatexAccent::displayISO8859_9(BufferView * bv, LyXFont const & font,
if (ic == 'U') tmpic = 0xdc; if (ic == 'U') tmpic = 0xdc;
break; break;
} }
case DOT: if (ic == 'I') tmpic = 0xdd; break; case DOT: if (ic == 'I') tmpic = 0xdd; break;
case DOT_LESS_I: tmpic = 0xfd; break; case DOT_LESS_I: tmpic = 0xfd; break;
default: return false; default: return false;
} }
@ -429,7 +429,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
// now the rest - draw within (x, y, x+wid, y+hg) // now the rest - draw within (x, y, x+wid, y+hg)
switch (modtype) { switch (modtype) {
case ACUTE: // acute 0xB4 case ACUTE: // acute 0xB4
{ {
pain.text(int(x2 - (lyxfont::rbearing(0xB4, font) - lyxfont::lbearing(0xB4, font)) / 2), pain.text(int(x2 - (lyxfont::rbearing(0xB4, font) - lyxfont::lbearing(0xB4, font)) / 2),
baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB4, font) - (lyxfont::ascent(0xB4, font) + lyxfont::descent(0xB4, font)) / 2, baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB4, font) - (lyxfont::ascent(0xB4, font) + lyxfont::descent(0xB4, font)) / 2,
char(0xB4), font); char(0xB4), font);
@ -587,14 +587,14 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
{ {
int xp[2], yp[2]; int xp[2], yp[2];
xp[0] = int(x); xp[0] = int(x);
yp[0] = y + int(3.0 * hg); yp[0] = y + int(3.0 * hg);
xp[1] = int(x + float(wid) * 0.75); xp[1] = int(x + float(wid) * 0.75);
yp[1] = y + int(hg); yp[1] = y + int(hg);
pain.lines(xp, yp, 2); pain.lines(xp, yp, 2);
break; break;
} }
case DOT_LESS_I: // dotless-i case DOT_LESS_I: // dotless-i
case DOT_LESS_J: // dotless-j case DOT_LESS_J: // dotless-j

View File

@ -114,11 +114,11 @@ public:
/// ///
DOT_LESS_I, DOT_LESS_I,
/// ///
DOT_LESS_J, // 18 DOT_LESS_J, // 18
/// ///
lSLASH, lSLASH,
/// ///
LSLASH LSLASH
}; };
private: private:
friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES); friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);

View File

@ -44,7 +44,7 @@ public:
void edit(BufferView * bv, bool front = true); void edit(BufferView * bv, bool front = true);
/// ///
int latex(Buffer const *, std::ostream &, int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const; bool fragile, bool free_spc) const;
/// ///
void setParent(string fn) { setContents(fn); } void setParent(string fn) { setContents(fn); }
}; };

View File

@ -149,23 +149,23 @@ void InsetQuotes::parseString(string const & s)
string const InsetQuotes::dispString(Language const * loclang) const string const InsetQuotes::dispString(Language const * loclang) const
{ {
string disp; string disp;
disp += quote_char[quote_index[side_][language_]]; disp += quote_char[quote_index[side_][language_]];
if (times_ == DoubleQ) if (times_ == DoubleQ)
disp += disp; disp += disp;
if (lyxrc.font_norm_type == LyXRC::ISO_8859_1 if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
|| lyxrc.font_norm_type == LyXRC::ISO_8859_3 || lyxrc.font_norm_type == LyXRC::ISO_8859_3
|| lyxrc.font_norm_type == LyXRC::ISO_8859_4 || lyxrc.font_norm_type == LyXRC::ISO_8859_4
|| lyxrc.font_norm_type == LyXRC::ISO_8859_9) { || lyxrc.font_norm_type == LyXRC::ISO_8859_9) {
if (disp == "'") if (disp == "'")
disp = "´"; disp = "´";
else if (disp == "''") else if (disp == "''")
disp = "´´"; disp = "´´";
} }
if (lyxrc.font_norm_type == LyXRC::ISO_8859_1 if (lyxrc.font_norm_type == LyXRC::ISO_8859_1
|| lyxrc.font_norm_type == LyXRC::ISO_8859_9 || lyxrc.font_norm_type == LyXRC::ISO_8859_9
|| lyxrc.font_norm_type == LyXRC::ISO_8859_15) { || lyxrc.font_norm_type == LyXRC::ISO_8859_15) {
if (disp == "<<") if (disp == "<<")
disp = '«'; disp = '«';
else if (disp == ">>") else if (disp == ">>")
@ -180,7 +180,7 @@ string const InsetQuotes::dispString(Language const * loclang) const
disp = " " + disp; disp = " " + disp;
} }
return disp; return disp;
} }

View File

@ -124,4 +124,3 @@ private:
string const dispString(Language const *) const; string const dispString(Language const *) const;
}; };
#endif #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 // Eventually trigger dialog with button 3 not 1
if (button == 3) if (button == 3)
bv->owner()->getLyXFunc()-> bv->owner()->getLyXFunc()->
dispatch(LFUN_REF_GOTO, getContents()); dispatch(LFUN_REF_GOTO, getContents());
else if (button == 1) else if (button == 1)
bv->owner()->getDialogs()->showRef(this); bv->owner()->getDialogs()->showRef(this);

View File

@ -57,7 +57,7 @@ public:
bool display() const { return false; } bool display() const { return false; }
/// ///
int latex(Buffer const *, std::ostream &, int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const; bool fragile, bool free_spc) const;
/// ///
int ascii(Buffer const *, std::ostream &, int linelen) const; int ascii(Buffer const *, std::ostream &, int linelen) const;
/// ///

View File

@ -205,7 +205,7 @@ void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
else if (command == "\\ldots{}") else if (command == "\\ldots{}")
kind_ = LDOTS; kind_ = LDOTS;
else if (command == "\\menuseparator") else if (command == "\\menuseparator")
kind_ = MENU_SEPARATOR; kind_ = MENU_SEPARATOR;
else if (command == "\\protected_separator" else if (command == "\\protected_separator"
|| command == "~") || command == "~")
kind_ = PROTECTED_SEPARATOR; kind_ = PROTECTED_SEPARATOR;

View File

@ -261,7 +261,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
x += static_cast<float>(scroll()); x += static_cast<float>(scroll());
#endif #endif
if (!cleared && ((need_update == INIT) || (need_update == FULL) || if (!cleared && ((need_update == INIT) || (need_update == FULL) ||
(top_x != int(x)) || (top_baseline != baseline))) (top_x != int(x)) || (top_baseline != baseline)))
{ {
int h = ascent(bv, font) + descent(bv, font); int h = ascent(bv, font) + descent(bv, font);
int const tx = display() || !owner() ? 0 : top_x; int const tx = display() || !owner() ? 0 : top_x;
@ -437,7 +437,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
void InsetTabular::drawCellLines(Painter & pain, int x, int baseline, void InsetTabular::drawCellLines(Painter & pain, int x, int baseline,
int row, int cell) const int row, int cell) const
{ {
int x2 = x + tabular->GetWidthOfColumn(cell); int x2 = x + tabular->GetWidthOfColumn(cell);
bool on_off; bool on_off;
@ -612,7 +612,7 @@ void InsetTabular::insetUnlock(BufferView * bv)
void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what, void InsetTabular::updateLocal(BufferView * bv, UpdateCodes what,
bool mark_dirty) const bool mark_dirty) const
{ {
if (what == INIT) { if (what == INIT) {
LyXFont font; LyXFont font;
@ -821,7 +821,7 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
bool InsetTabular::insetButtonRelease(BufferView * bv, bool InsetTabular::insetButtonRelease(BufferView * bv,
int x, int y, int button) int x, int y, int button)
{ {
bool ret = false; bool ret = false;
if (the_locking_inset) if (the_locking_inset)
@ -870,7 +870,7 @@ void InsetTabular::insetKeyPress(XKeyEvent * xke)
UpdatableInset::RESULT UpdatableInset::RESULT
InsetTabular::localDispatch(BufferView * bv, kb_action action, InsetTabular::localDispatch(BufferView * bv, kb_action action,
string const & arg) string const & arg)
{ {
// We need to save the value of the_locking_inset as the call to // We need to save the value of the_locking_inset as the call to
// the_locking_inset->LocalDispatch might unlock it. // the_locking_inset->LocalDispatch might unlock it.
@ -1132,8 +1132,8 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
if (!copySelection(bv)) if (!copySelection(bv))
break; break;
setUndo(bv, Undo::DELETE, setUndo(bv, Undo::DELETE,
bv->text->cursor.par(), bv->text->cursor.par(),
bv->text->cursor.par()->next()); bv->text->cursor.par()->next());
cutSelection(); cutSelection();
updateLocal(bv, INIT, true); updateLocal(bv, INIT, true);
break; break;
@ -1217,8 +1217,8 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
case LFUN_PASTE: case LFUN_PASTE:
if (hasPasteBuffer()) { if (hasPasteBuffer()) {
setUndo(bv, Undo::INSERT, setUndo(bv, Undo::INSERT,
bv->text->cursor.par(), bv->text->cursor.par(),
bv->text->cursor.par()->next()); bv->text->cursor.par()->next());
pasteSelection(bv); pasteSelection(bv);
updateLocal(bv, INIT, true); updateLocal(bv, INIT, true);
break; break;
@ -1285,7 +1285,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
int InsetTabular::latex(Buffer const * buf, ostream & os, int InsetTabular::latex(Buffer const * buf, ostream & os,
bool fragile, bool fp) const bool fragile, bool fp) const
{ {
return tabular->latex(buf, os, fragile, fp); return tabular->latex(buf, os, fragile, fp);
} }
@ -1295,7 +1295,7 @@ int InsetTabular::ascii(Buffer const * buf, ostream & os, int ll) const
{ {
if (ll > 0) if (ll > 0)
return tabular->ascii(buf, os, (int)parOwner()->params().depth(), return tabular->ascii(buf, os, (int)parOwner()->params().depth(),
false,0); false,0);
return tabular->ascii(buf, os, 0, false,0); return tabular->ascii(buf, os, 0, false,0);
} }
@ -1342,8 +1342,8 @@ void InsetTabular::validate(LaTeXFeatures & features) const
bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv, bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
LyXFont const & font, LyXFont const & font,
bool reinit) const bool reinit) const
{ {
int cell = -1; int cell = -1;
int maxAsc = 0; int maxAsc = 0;
@ -1729,15 +1729,15 @@ bool InsetTabular::deletable() const
void InsetTabular::setFont(BufferView * bv, LyXFont const & font, bool tall, void InsetTabular::setFont(BufferView * bv, LyXFont const & font, bool tall,
bool selectall) bool selectall)
{ {
if (selectall) { if (selectall) {
setSelection(0, tabular->GetNumberOfCells() - 1); setSelection(0, tabular->GetNumberOfCells() - 1);
} }
if (hasSelection()) { if (hasSelection()) {
setUndo(bv, Undo::EDIT, setUndo(bv, Undo::EDIT,
bv->text->cursor.par(), bv->text->cursor.par(),
bv->text->cursor.par()->next()); bv->text->cursor.par()->next());
bool frozen = undo_frozen; bool frozen = undo_frozen;
if (!frozen) if (!frozen)
freezeUndo(); freezeUndo();
@ -1786,7 +1786,7 @@ bool InsetTabular::tabularFeatures(BufferView * bv, string const & what)
} }
static void checkLongtableSpecial(LyXTabular::ltType & ltt, static void checkLongtableSpecial(LyXTabular::ltType & ltt,
string const & special, bool & flag) string const & special, bool & flag)
{ {
if (special == "dl_above") { if (special == "dl_above") {
ltt.topDL = flag; ltt.topDL = flag;
@ -1805,8 +1805,8 @@ static void checkLongtableSpecial(LyXTabular::ltType & ltt,
void InsetTabular::tabularFeatures(BufferView * bv, void InsetTabular::tabularFeatures(BufferView * bv,
LyXTabular::Feature feature, LyXTabular::Feature feature,
string const & value) string const & value)
{ {
int sel_col_start; int sel_col_start;
int sel_col_end; int sel_col_end;
@ -1851,8 +1851,8 @@ void InsetTabular::tabularFeatures(BufferView * bv,
sel_row_start = sel_row_end = tabular->row_of_cell(actcell); sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
} }
setUndo(bv, Undo::FINISH, setUndo(bv, Undo::FINISH,
bv->text->cursor.par(), bv->text->cursor.par(),
bv->text->cursor.par()->next()); bv->text->cursor.par()->next());
int row = tabular->row_of_cell(actcell); int row = tabular->row_of_cell(actcell);
int column = tabular->column_of_cell(actcell); int column = tabular->column_of_cell(actcell);
@ -2197,7 +2197,7 @@ int InsetTabular::getMaxWidthOfCell(BufferView * bv, int cell) const
int InsetTabular::getMaxWidth(BufferView * bv, int InsetTabular::getMaxWidth(BufferView * bv,
UpdatableInset const * inset) const UpdatableInset const * inset) const
{ {
int cell = tabular->GetCellFromInset(inset, actcell); int cell = tabular->GetCellFromInset(inset, actcell);
@ -2237,7 +2237,7 @@ void InsetTabular::resizeLyXText(BufferView * bv, bool force) const
LyXText * InsetTabular::getLyXText(BufferView const * bv, LyXText * InsetTabular::getLyXText(BufferView const * bv,
bool const recursive) const bool const recursive) const
{ {
if (the_locking_inset) if (the_locking_inset)
return the_locking_inset->getLyXText(bv, recursive); return the_locking_inset->getLyXText(bv, recursive);
@ -2477,7 +2477,7 @@ bool InsetTabular::copySelection(BufferView * bv)
ostringstream sstr; ostringstream sstr;
paste_tabular->ascii(bv->buffer(), sstr, paste_tabular->ascii(bv->buffer(), sstr,
(int)parOwner()->params().depth(), true, '\t'); (int)parOwner()->params().depth(), true, '\t');
bv->stuffClipboard(sstr.str().c_str()); bv->stuffClipboard(sstr.str().c_str());
return true; return true;
} }
@ -2722,7 +2722,7 @@ void InsetTabular::toggleSelection(BufferView * bv, bool kill_selection)
bool InsetTabular::searchForward(BufferView * bv, string const & str, bool InsetTabular::searchForward(BufferView * bv, string const & str,
bool cs, bool mw) bool cs, bool mw)
{ {
nodraw(true); nodraw(true);
if (the_locking_inset) { if (the_locking_inset) {
@ -2750,7 +2750,7 @@ bool InsetTabular::searchForward(BufferView * bv, string const & str,
bool InsetTabular::searchBackward(BufferView * bv, string const & str, bool InsetTabular::searchBackward(BufferView * bv, string const & str,
bool cs, bool mw) bool cs, bool mw)
{ {
nodraw(true); nodraw(true);
if (the_locking_inset) { if (the_locking_inset) {
@ -2800,7 +2800,7 @@ bool InsetTabular::forceDefaultParagraphs(Inset const * in) const
} }
bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf, bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
bool usePaste) bool usePaste)
{ {
if (buf.find('\t') == string::npos) if (buf.find('\t') == string::npos)
return false; return false;
@ -2835,7 +2835,7 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
if (usePaste) { if (usePaste) {
delete paste_tabular; delete paste_tabular;
paste_tabular = new LyXTabular(bv->buffer()->params, paste_tabular = new LyXTabular(bv->buffer()->params,
this, rows, maxCols); this, rows, maxCols);
loctab = paste_tabular; loctab = paste_tabular;
cols = 0; cols = 0;
} else { } else {

View File

@ -166,7 +166,7 @@ public:
int getActCell() const { return actcell; } int getActCell() const { return actcell; }
/// ///
void setFont(BufferView *, LyXFont const &, bool toggleall = false, void setFont(BufferView *, LyXFont const &, bool toggleall = false,
bool selectall = false); bool selectall = false);
/// ///
int getMaxWidth(BufferView *, UpdatableInset const *) const; int getMaxWidth(BufferView *, UpdatableInset const *) const;
/// ///
@ -218,9 +218,9 @@ public:
void toggleSelection(BufferView *, bool kill_selection); void toggleSelection(BufferView *, bool kill_selection);
/// ///
bool searchForward(BufferView *, string const &, bool searchForward(BufferView *, string const &,
bool = true, bool = false); bool = true, bool = false);
bool searchBackward(BufferView *, string const &, bool searchBackward(BufferView *, string const &,
bool = true, bool = false); bool = true, bool = false);
// this should return true if we have a "normal" cell, otherwise true. // this should return true if we have a "normal" cell, otherwise true.
// "normal" means without width set! // "normal" means without width set!

View File

@ -110,10 +110,10 @@ void InsetText::restoreLyXTextState(BufferView * bv, LyXText * t) const
t->selection.mark(sstate.mark_set); t->selection.mark(sstate.mark_set);
if (sstate.selection) { if (sstate.selection) {
t->setCursor(bv, sstate.selstartpar, sstate.selstartpos, t->setCursor(bv, sstate.selstartpar, sstate.selstartpos,
true, sstate.selstartboundary); true, sstate.selstartboundary);
t->selection.cursor = t->cursor; t->selection.cursor = t->cursor;
t->setCursor(bv, sstate.selendpar, sstate.selendpos, t->setCursor(bv, sstate.selendpar, sstate.selendpos,
true, sstate.selendboundary); true, sstate.selendboundary);
t->setSelection(bv); t->setSelection(bv);
t->setCursor(bv, sstate.lpar, sstate.pos); t->setCursor(bv, sstate.lpar, sstate.pos);
} else { } else {
@ -335,7 +335,7 @@ int InsetText::textWidth(BufferView * bv, bool fordraw) const
} }
if (fordraw) { if (fordraw) {
return max(w - (2 * TEXT_TO_INSET_OFFSET), return max(w - (2 * TEXT_TO_INSET_OFFSET),
(int)getLyXText(bv)->width); (int)getLyXText(bv)->width);
} else if (w < 0) { } else if (w < 0) {
return -1; return -1;
} }
@ -344,7 +344,7 @@ int InsetText::textWidth(BufferView * bv, bool fordraw) const
void InsetText::draw(BufferView * bv, LyXFont const & f, void InsetText::draw(BufferView * bv, LyXFont const & f,
int baseline, float & x, bool cleared) const int baseline, float & x, bool cleared) const
{ {
if (nodraw()) if (nodraw())
return; return;
@ -458,7 +458,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
y = 0; y = 0;
while ((row != 0) && (yf < ph)) { while ((row != 0) && (yf < ph)) {
lt->getVisibleRow(bv, y+y_offset, int(x), row, lt->getVisibleRow(bv, y+y_offset, int(x), row,
y+first, cleared); y+first, cleared);
y += row->height(); y += row->height();
yf += row->height(); yf += row->height();
row = row->next(); row = row->next();
@ -515,7 +515,7 @@ void InsetText::drawFrame(Painter & pain, bool cleared) const
frame_w = insetWidth - TEXT_TO_INSET_OFFSET; frame_w = insetWidth - TEXT_TO_INSET_OFFSET;
frame_h = insetAscent + insetDescent - TEXT_TO_INSET_OFFSET; frame_h = insetAscent + insetDescent - TEXT_TO_INSET_OFFSET;
pain.rectangle(frame_x, frame_y, frame_w, frame_h, pain.rectangle(frame_x, frame_y, frame_w, frame_h,
frame_color); frame_color);
frame_is_visible = true; frame_is_visible = true;
} }
} }
@ -526,7 +526,7 @@ void InsetText::clearFrame(Painter & pain, bool cleared) const
if (frame_is_visible) { if (frame_is_visible) {
if (!cleared) { if (!cleared) {
pain.rectangle(frame_x, frame_y, frame_w, frame_h, pain.rectangle(frame_x, frame_y, frame_w, frame_h,
backgroundColor()); backgroundColor());
} }
frame_is_visible = false; frame_is_visible = false;
} }
@ -614,7 +614,7 @@ void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty) const
lt->fullRebreak(bv); lt->fullRebreak(bv);
setUpdateStatus(bv, what); setUpdateStatus(bv, what);
bool flag = (((need_update != CURSOR) && (need_update != NONE)) || bool flag = (((need_update != CURSOR) && (need_update != NONE)) ||
(lt->status() != LyXText::UNCHANGED) || lt->selection.set()); (lt->status() != LyXText::UNCHANGED) || lt->selection.set());
if (!lt->selection.set()) if (!lt->selection.set())
lt->selection.cursor = lt->cursor; lt->selection.cursor = lt->cursor;
if (clear) if (clear)
@ -664,7 +664,7 @@ void InsetText::edit(BufferView * bv, int x, int y, unsigned int button)
} }
if (!checkAndActivateInset(bv, x, tmp_y, button)) if (!checkAndActivateInset(bv, x, tmp_y, button))
lt->setCursorFromCoordinates(bv, x - drawTextXOffset, lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
y + insetAscent); y + insetAscent);
lt->clearSelection(); lt->clearSelection();
finishUndo(); finishUndo();
// If the inset is empty set the language of the current font to the // If the inset is empty set the language of the current font to the
@ -759,7 +759,7 @@ void InsetText::insetUnlock(BufferView * bv)
code = FULL; code = FULL;
} else if (owner()) { } else if (owner()) {
bv->owner()->setLayout(owner()->getLyXText(bv) bv->owner()->setLayout(owner()->getLyXText(bv)
->cursor.par()->layout()); ->cursor.par()->layout());
} else } else
bv->owner()->setLayout(bv->text->cursor.par()->layout()); bv->owner()->setLayout(bv->text->cursor.par()->layout());
// hack for deleteEmptyParMech // hack for deleteEmptyParMech
@ -837,7 +837,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset, bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
bool lr) bool lr)
{ {
if (!the_locking_inset) if (!the_locking_inset)
return false; return false;
@ -924,9 +924,9 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
if (the_locking_inset) { if (the_locking_inset) {
if (the_locking_inset == inset) { if (the_locking_inset == inset) {
the_locking_inset->insetButtonPress(bv, the_locking_inset->insetButtonPress(bv,
x - inset_x, x - inset_x,
y - inset_y, y - inset_y,
button); button);
no_selection = false; no_selection = false;
return; return;
} else if (inset) { } else if (inset) {
@ -936,7 +936,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
inset_y = cy(bv) + drawTextYOffset; inset_y = cy(bv) + drawTextYOffset;
the_locking_inset = 0; the_locking_inset = 0;
inset->insetButtonPress(bv, x - inset_x, inset->insetButtonPress(bv, x - inset_x,
y - inset_y, button); y - inset_y, button);
// inset->edit(bv, x - inset_x, y - inset_y, button); // inset->edit(bv, x - inset_x, y - inset_y, button);
if (the_locking_inset) if (the_locking_inset)
updateLocal(bv, CURSOR, false); updateLocal(bv, CURSOR, false);
@ -957,7 +957,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
inset_boundary = cboundary(bv); inset_boundary = cboundary(bv);
the_locking_inset = uinset; the_locking_inset = uinset;
uinset->insetButtonPress(bv, x - inset_x, y - inset_y, uinset->insetButtonPress(bv, x - inset_x, y - inset_y,
button); button);
uinset->edit(bv, x - inset_x, y - inset_y, 0); uinset->edit(bv, x - inset_x, y - inset_y, 0);
if (the_locking_inset) if (the_locking_inset)
updateLocal(bv, CURSOR, false); updateLocal(bv, CURSOR, false);
@ -978,7 +978,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
} }
lt->setCursorFromCoordinates(bv, x - drawTextXOffset, lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
y + insetAscent); y + insetAscent);
// set the selection cursor! // set the selection cursor!
lt->selection.cursor = lt->cursor; lt->selection.cursor = lt->cursor;
lt->cursor.x_fix(lt->cursor.x()); lt->cursor.x_fix(lt->cursor.x());
@ -1004,7 +1004,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
localDispatch(bv, LFUN_PASTE, ""); localDispatch(bv, LFUN_PASTE, "");
else else
localDispatch(bv, LFUN_PASTESELECTION, localDispatch(bv, LFUN_PASTESELECTION,
"paragraph"); "paragraph");
} }
} else { } else {
getLyXText(bv)->clearSelection(); getLyXText(bv)->clearSelection();
@ -1018,8 +1018,8 @@ bool InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
{ {
if (the_locking_inset) { if (the_locking_inset) {
return the_locking_inset->insetButtonRelease(bv, return the_locking_inset->insetButtonRelease(bv,
x - inset_x, y - inset_y, x - inset_x, y - inset_y,
button); button);
} }
int tmp_x = x - drawTextXOffset; int tmp_x = x - drawTextXOffset;
int tmp_y = y + insetAscent - getLyXText(bv)->first_y; int tmp_y = y + insetAscent - getLyXText(bv)->first_y;
@ -1028,14 +1028,14 @@ bool InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
if (inset) { if (inset) {
if (isHighlyEditableInset(inset)) { if (isHighlyEditableInset(inset)) {
ret = inset->insetButtonRelease(bv, x - inset_x, ret = inset->insetButtonRelease(bv, x - inset_x,
y - inset_y, button); y - inset_y, button);
} else { } else {
inset_x = cx(bv) - top_x + drawTextXOffset; inset_x = cx(bv) - top_x + drawTextXOffset;
inset_y = cy(bv) + drawTextYOffset; inset_y = cy(bv) + drawTextYOffset;
ret = inset->insetButtonRelease(bv, x - inset_x, ret = inset->insetButtonRelease(bv, x - inset_x,
y - inset_y, button); y - inset_y, button);
inset->edit(bv, x - inset_x, inset->edit(bv, x - inset_x,
y - inset_y, button); y - inset_y, button);
} }
updateLocal(bv, CURSOR_PAR, false); updateLocal(bv, CURSOR_PAR, false);
} }
@ -1049,7 +1049,7 @@ void InsetText::insetMotionNotify(BufferView * bv, int x, int y, int state)
return; return;
if (the_locking_inset) { if (the_locking_inset) {
the_locking_inset->insetMotionNotify(bv, x - inset_x, the_locking_inset->insetMotionNotify(bv, x - inset_x,
y - inset_y,state); y - inset_y,state);
return; return;
} }
bool clear = false; bool clear = false;
@ -1088,7 +1088,7 @@ void InsetText::insetKeyPress(XKeyEvent * xke)
UpdatableInset::RESULT UpdatableInset::RESULT
InsetText::localDispatch(BufferView * bv, InsetText::localDispatch(BufferView * bv,
kb_action action, string const & arg) kb_action action, string const & arg)
{ {
bool was_empty = par->size() == 0 && !par->next(); bool was_empty = par->size() == 0 && !par->next();
no_selection = false; no_selection = false;
@ -1161,7 +1161,7 @@ InsetText::localDispatch(BufferView * bv,
* true (on). */ * true (on). */
setUndo(bv, Undo::INSERT, setUndo(bv, Undo::INSERT,
lt->cursor.par(), lt->cursor.par()->next()); lt->cursor.par(), lt->cursor.par()->next());
bv->setState(); bv->setState();
if (lyxrc.auto_region_delete) { if (lyxrc.auto_region_delete) {
if (lt->selection.set()) { if (lt->selection.set()) {
@ -1234,7 +1234,7 @@ InsetText::localDispatch(BufferView * bv,
break; break;
case LFUN_BACKSPACE: { case LFUN_BACKSPACE: {
setUndo(bv, Undo::DELETE, setUndo(bv, Undo::DELETE,
lt->cursor.par(), lt->cursor.par()->next()); lt->cursor.par(), lt->cursor.par()->next());
if (lt->selection.set()) if (lt->selection.set())
lt->cutSelection(bv); lt->cutSelection(bv);
else else
@ -1246,7 +1246,7 @@ InsetText::localDispatch(BufferView * bv,
case LFUN_DELETE: { case LFUN_DELETE: {
setUndo(bv, Undo::DELETE, setUndo(bv, Undo::DELETE,
lt->cursor.par(), lt->cursor.par()->next()); lt->cursor.par(), lt->cursor.par()->next());
if (lt->selection.set()) { if (lt->selection.set()) {
lt->cutSelection(bv); lt->cutSelection(bv);
} else { } else {
@ -1259,7 +1259,7 @@ InsetText::localDispatch(BufferView * bv,
case LFUN_CUT: { case LFUN_CUT: {
setUndo(bv, Undo::DELETE, setUndo(bv, Undo::DELETE,
lt->cursor.par(), lt->cursor.par()->next()); lt->cursor.par(), lt->cursor.par()->next());
lt->cutSelection(bv); lt->cutSelection(bv);
updwhat = CURSOR_PAR; updwhat = CURSOR_PAR;
updflag = true; updflag = true;
@ -1297,7 +1297,7 @@ InsetText::localDispatch(BufferView * bv,
} }
} }
setUndo(bv, Undo::INSERT, setUndo(bv, Undo::INSERT,
lt->cursor.par(), lt->cursor.par()->next()); lt->cursor.par(), lt->cursor.par()->next());
lt->pasteSelection(bv); lt->pasteSelection(bv);
updwhat = CURSOR_PAR; updwhat = CURSOR_PAR;
updflag = true; updflag = true;
@ -1329,7 +1329,7 @@ InsetText::localDispatch(BufferView * bv,
break; break;
} }
setUndo(bv, Undo::INSERT, setUndo(bv, Undo::INSERT,
lt->cursor.par(), lt->cursor.par()->next()); lt->cursor.par(), lt->cursor.par()->next());
lt->insertChar(bv, Paragraph::META_NEWLINE); lt->insertChar(bv, Paragraph::META_NEWLINE);
updwhat = CURSOR_PAR; updwhat = CURSOR_PAR;
updflag = true; updflag = true;
@ -1523,7 +1523,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
environment_stack[depth].erase(); environment_stack[depth].erase();
environment_inner[depth].erase(); environment_inner[depth].erase();
} }
// Write opening SGML tags. // Write opening SGML tags.
switch (style.latextype) { switch (style.latextype) {
@ -1641,7 +1641,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
item_name = "listitem"; item_name = "listitem";
buf->sgmlCloseTag(os, command_depth + depth, buf->sgmlCloseTag(os, command_depth + depth,
item_name); item_name);
if (environment_inner[depth] == "varlistentry") if (environment_inner[depth] == "varlistentry")
buf->sgmlCloseTag(os, depth + command_depth, buf->sgmlCloseTag(os, depth + command_depth,
environment_inner[depth]); environment_inner[depth]);
} }
@ -1785,7 +1785,7 @@ InsetText::moveLeft(BufferView * bv, bool activate_inset, bool selecting)
UpdatableInset::RESULT UpdatableInset::RESULT
InsetText::moveRightIntern(BufferView * bv, bool behind, InsetText::moveRightIntern(BufferView * bv, bool behind,
bool activate_inset, bool selecting) bool activate_inset, bool selecting)
{ {
if (!cpar(bv)->next() && (cpos(bv) >= cpar(bv)->size())) if (!cpar(bv)->next() && (cpos(bv) >= cpar(bv)->size()))
return FINISHED_RIGHT; return FINISHED_RIGHT;
@ -1800,7 +1800,7 @@ InsetText::moveRightIntern(BufferView * bv, bool behind,
UpdatableInset::RESULT UpdatableInset::RESULT
InsetText::moveLeftIntern(BufferView * bv, bool behind, InsetText::moveLeftIntern(BufferView * bv, bool behind,
bool activate_inset, bool selecting) bool activate_inset, bool selecting)
{ {
if (!cpar(bv)->previous() && (cpos(bv) <= 0)) if (!cpar(bv)->previous() && (cpos(bv) <= 0))
return FINISHED; return FINISHED;
@ -1922,7 +1922,7 @@ vector<string> const InsetText::getLabelList() const
void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall, void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
bool selectall) bool selectall)
{ {
if (the_locking_inset) { if (the_locking_inset) {
the_locking_inset->setFont(bv, font, toggleall, selectall); the_locking_inset->setFont(bv, font, toggleall, selectall);
@ -2102,7 +2102,7 @@ int InsetText::cx(BufferView * bv) const
int x = llt->cursor.x() + top_x + TEXT_TO_INSET_OFFSET; int x = llt->cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
if (the_locking_inset) { if (the_locking_inset) {
LyXFont font = llt->getFont(bv->buffer(), llt->cursor.par(), LyXFont font = llt->getFont(bv->buffer(), llt->cursor.par(),
llt->cursor.pos()); llt->cursor.pos());
if (font.isVisibleRightToLeft()) if (font.isVisibleRightToLeft())
x -= the_locking_inset->width(bv, font); x -= the_locking_inset->width(bv, font);
} }
@ -2142,7 +2142,7 @@ Row * InsetText::crow(BufferView * bv) const
LyXText * InsetText::getLyXText(BufferView const * lbv, LyXText * InsetText::getLyXText(BufferView const * lbv,
bool const recursive) const bool const recursive) const
{ {
if (cached_bview == lbv) { if (cached_bview == lbv) {
if (recursive && the_locking_inset) if (recursive && the_locking_inset)
@ -2579,7 +2579,7 @@ void InsetText::toggleSelection(BufferView * bv, bool kill_selection)
bool InsetText::searchForward(BufferView * bv, string const & str, bool InsetText::searchForward(BufferView * bv, string const & str,
bool cs, bool mw) bool cs, bool mw)
{ {
if (the_locking_inset) { if (the_locking_inset) {
if (the_locking_inset->searchForward(bv, str, cs, mw)) if (the_locking_inset->searchForward(bv, str, cs, mw))
@ -2617,7 +2617,7 @@ bool InsetText::searchForward(BufferView * bv, string const & str,
} }
bool InsetText::searchBackward(BufferView * bv, string const & str, bool InsetText::searchBackward(BufferView * bv, string const & str,
bool cs, bool mw) bool cs, bool mw)
{ {
if (the_locking_inset) if (the_locking_inset)
if (the_locking_inset->searchBackward(bv, str, cs, mw)) if (the_locking_inset->searchBackward(bv, str, cs, mw))
@ -2659,7 +2659,7 @@ void InsetText::getDrawFont(LyXFont & font) const
void InsetText::appendParagraphs(BufferParams const & bparams, void InsetText::appendParagraphs(BufferParams const & bparams,
Paragraph * newpar) Paragraph * newpar)
{ {
Paragraph * buf; Paragraph * buf;
Paragraph * tmpbuf = newpar; Paragraph * tmpbuf = newpar;

View File

@ -170,7 +170,7 @@ public:
/// ///
void setFont(BufferView *, LyXFont const &, void setFont(BufferView *, LyXFont const &,
bool toggleall = false, bool toggleall = false,
bool selectall = false); bool selectall = false);
/// ///
int getMaxWidth(BufferView *, UpdatableInset const *) const; int getMaxWidth(BufferView *, UpdatableInset const *) const;
/// ///
@ -240,10 +240,10 @@ public:
void toggleSelection(BufferView *, bool kill_selection); void toggleSelection(BufferView *, bool kill_selection);
/// ///
bool searchForward(BufferView *, string const &, bool searchForward(BufferView *, string const &,
bool = true, bool = false); bool = true, bool = false);
/// ///
bool searchBackward(BufferView *, string const &, bool searchBackward(BufferView *, string const &,
bool = true, bool = false); bool = true, bool = false);
/// ///
bool checkInsertChar(LyXFont &); bool checkInsertChar(LyXFont &);
/// ///
@ -315,7 +315,7 @@ private:
bool checkAndActivateInset(BufferView * bv, bool behind); bool checkAndActivateInset(BufferView * bv, bool behind);
/// ///
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0, bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
int button = 0); int button = 0);
/// ///
void removeNewlines(); void removeNewlines();
/// ///

View File

@ -46,7 +46,7 @@ public:
bool display() const { return false; } bool display() const { return false; }
/// ///
int latex(Buffer const *, std::ostream &, int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const; bool fragile, bool free_spc) const;
/// ///
int ascii(Buffer const *, std::ostream &, int linelen) const; int ascii(Buffer const *, std::ostream &, int linelen) const;
/// ///

View File

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

View File

@ -56,7 +56,7 @@ struct Debug {
If you want to have debug output from time critical code you should If you want to have debug output from time critical code you should
use this construct: use this construct:
if (debug.debugging(Debug::INFO)) { if (debug.debugging(Debug::INFO)) {
debug << "...debug output...\n"; debug << "...debug output...\n";
} }
To give debug info even if no debug (NONE) is requested: To give debug info even if no debug (NONE) is requested:
@ -147,5 +147,3 @@ private:
}; };
#endif #endif

View File

@ -48,7 +48,7 @@ public:
FileInfo & newFile(string const & path, bool link = false); FileInfo & newFile(string const & path, bool link = false);
/// Query a new file descriptor /// Query a new file descriptor
FileInfo & newFile(int fildes); FileInfo & newFile(int fildes);
/// Returns a character describing file type (ls -F) /// Returns a character describing file type (ls -F)
char const * typeIndicator() const; char const * typeIndicator() const;

View File

@ -17,10 +17,10 @@
StrPool::~StrPool() StrPool::~StrPool()
{ {
for (Pool::const_iterator cit = pool_.begin(); for (Pool::const_iterator cit = pool_.begin();
cit != pool_.end() ; ++cit) { cit != pool_.end() ; ++cit) {
delete[] (*cit); delete[] (*cit);
} }
} }
/* One interesting thing here would be to store the strings in a map, /* One interesting thing here would be to store the strings in a map,
@ -31,12 +31,11 @@ StrPool::~StrPool()
char const * StrPool::add(string const & str) char const * StrPool::add(string const & str)
{ {
string::size_type s = str.length(); string::size_type s = str.length();
char * buf = new char [s + 1]; char * buf = new char [s + 1];
str.copy(buf, s); str.copy(buf, s);
buf[s] = '\0'; buf[s] = '\0';
pool_.push_back(buf); pool_.push_back(buf);
return buf; return buf;
} }
//StrPool strPool; //StrPool strPool;

View File

@ -22,16 +22,16 @@
/// ///
class StrPool { class StrPool {
public: public:
/// delete all the strings that have been allocated by add() /// delete all the strings that have been allocated by add()
~StrPool(); ~StrPool();
/// Make a copy of the string, and remember it in the pool /// Make a copy of the string, and remember it in the pool
char const * add(string const & str); char const * add(string const & str);
private: private:
/// ///
typedef std::vector<char const *> Pool; typedef std::vector<char const *> Pool;
/// ///
Pool pool_; Pool pool_;
}; };
//extern StrPool strPool; //extern StrPool strPool;

View File

@ -3,7 +3,7 @@
General path-mangling functions General path-mangling functions
Copyright 1996 Ivan Schreter Copyright 1996 Ivan Schreter
Parts Copyright 1996 Dirk Niggemann Parts Copyright 1996 Dirk Niggemann
Parts Copyright 1985, 1990, 1993 Free Software Foundation, Inc. Parts Copyright 1985, 1990, 1993 Free Software Foundation, Inc.
Parts Copyright 1996 Asger Alstrup Parts Copyright 1996 Asger Alstrup
See also filetools.h. See also filetools.h.
@ -238,9 +238,9 @@ vector<string> const DirList(string const & dir, string const & ext)
vector<string> dirlist; vector<string> dirlist;
directory_iterator dit("dir"); directory_iterator dit("dir");
while (dit != directory_iterator()) { while (dit != directory_iterator()) {
string fil = dit->filename; string fil = dit->filename;
if (prefixIs(fil, extension)) { if (prefixIs(fil, extension)) {
dirlist.push_back(fil); dirlist.push_back(fil);
} }
++dit; ++dit;
} }
@ -441,12 +441,12 @@ int DeleteAllFilesInDir (string const & path)
if (fi.isOK() && fi.isDir()) if (fi.isOK() && fi.isDir())
deleted = (DeleteAllFilesInDir(unlinkpath) == 0); deleted = (DeleteAllFilesInDir(unlinkpath) == 0);
deleted &= (lyx::unlink(unlinkpath) == 0); deleted &= (lyx::unlink(unlinkpath) == 0);
if (!deleted) { if (!deleted) {
Alert::err_alert(_("Error! Could not remove file:"), Alert::err_alert(_("Error! Could not remove file:"),
unlinkpath); unlinkpath);
return_value = -1; return_value = -1;
} }
} }
closedir(dir); closedir(dir);
return return_value; return return_value;
} }
@ -782,7 +782,7 @@ string const ReplaceEnvironmentPath(string const & path)
// PathChar: Next path component start with this character // PathChar: Next path component start with this character
// while CompareChar found do: // while CompareChar found do:
// Split String with PathChar // Split String with PathChar
// Search Environmentvariable // Search Environmentvariable
// if found: Replace Strings // if found: Replace Strings
// //
char const CompareChar = '$'; char const CompareChar = '$';
@ -919,7 +919,7 @@ string const AddPath(string const & path, string const & path_2)
} }
if (!path2.empty()) { if (!path2.empty()) {
string::size_type const p2start = path2.find_first_not_of('/'); string::size_type const p2start = path2.find_first_not_of('/');
string::size_type const p2end = path2.find_last_not_of('/'); string::size_type const p2end = path2.find_last_not_of('/');
string const tmp = path2.substr(p2start, p2end - p2start + 1); string const tmp = path2.substr(p2start, p2end - p2start + 1);
buf += tmp + '/'; buf += tmp + '/';
@ -965,7 +965,7 @@ string const GetExtension(string const & name)
} }
// the different filetypes and what they contain in one of the first lines // the different filetypes and what they contain in one of the first lines
// (dots are any characters). (Herbert 20020131) // (dots are any characters). (Herbert 20020131)
// AGR Grace... // AGR Grace...
// BMP BM... // BMP BM...
// EPS %!PS-Adobe-3.0 EPSF... // EPS %!PS-Adobe-3.0 EPSF...
@ -974,9 +974,9 @@ string const GetExtension(string const & name)
// JPG JFIF // JPG JFIF
// PDF %PDF-... // PDF %PDF-...
// PNG .PNG... // PNG .PNG...
// PBM P1... or P4 (B/W) // PBM P1... or P4 (B/W)
// PGM P2... or P5 (Grayscale) // PGM P2... or P5 (Grayscale)
// PPM P3... or P6 (color) // PPM P3... or P6 (color)
// PS %!PS-Adobe-2.0 or 1.0, no "EPSF"! // PS %!PS-Adobe-2.0 or 1.0, no "EPSF"!
// SGI \001\332... (decimal 474) // SGI \001\332... (decimal 474)
// TGIF %TGIF... // TGIF %TGIF...
@ -1277,10 +1277,10 @@ string const findtexfile(string const & fil, string const & /*format*/)
// If the file can be found directly, we just return a // If the file can be found directly, we just return a
// absolute path version of it. // absolute path version of it.
if (FileInfo(fil).exist()) if (FileInfo(fil).exist())
return MakeAbsPath(fil); return MakeAbsPath(fil);
// No we try to find it using kpsewhich. // No we try to find it using kpsewhich.
// It seems from the kpsewhich manual page that it is safe to use // It seems from the kpsewhich manual page that it is safe to use
// kpsewhich without --format: "When the --format option is not // kpsewhich without --format: "When the --format option is not
// given, the search path used when looking for a file is inferred // given, the search path used when looking for a file is inferred
@ -1327,5 +1327,3 @@ void removeAutosaveFile(string const & filename)
} }
} }
} }

View File

@ -37,7 +37,7 @@ public:
~ForkedcallsController(); ~ForkedcallsController();
/// Get hold of the only controller that can exist inside the process. /// Get hold of the only controller that can exist inside the process.
static ForkedcallsController & get(); static ForkedcallsController & get();
/// Add a new child process to the list of controlled processes. /// Add a new child process to the list of controlled processes.
void addCall(Forkedcall const & newcall); void addCall(Forkedcall const & newcall);
@ -76,7 +76,7 @@ private:
/** The timer. Enables us to check the status of the children /** The timer. Enables us to check the status of the children
* every XX ms and to invoke a callback on completion. * every XX ms and to invoke a callback on completion.
*/ */
Timeout * timeout_; Timeout * timeout_;
}; };
#endif // FORKEDCONTR_H #endif // FORKEDCONTR_H

View File

@ -23,17 +23,17 @@ char * l_getcwd(char * buffer, size_t size)
// Returns current working directory // Returns current working directory
string const lyx::getcwd() string const lyx::getcwd()
{ {
int n = 256; // Assume path is less than 256 chars int n = 256; // Assume path is less than 256 chars
char * err; char * err;
char * tbuf = new char[n]; char * tbuf = new char[n];
// Safe. Hopefully all getcwds behave this way! // Safe. Hopefully all getcwds behave this way!
while (((err = l_getcwd(tbuf, n)) == 0) && (errno == ERANGE)) { while (((err = l_getcwd(tbuf, n)) == 0) && (errno == ERANGE)) {
// Buffer too small, double the buffersize and try again // Buffer too small, double the buffersize and try again
delete[] tbuf; delete[] tbuf;
n = 2 * n; n = 2 * n;
tbuf = new char[n]; tbuf = new char[n];
} }
string result; string result;
if (err) result = tbuf; if (err) result = tbuf;

View File

@ -63,9 +63,9 @@ typename std::iterator_traits<Iterator>::difference_type
count (Iterator first, Iterator last, T const & value) count (Iterator first, Iterator last, T const & value)
{ {
#ifdef HAVE_STD_COUNT #ifdef HAVE_STD_COUNT
return std::count(first, last, value); return std::count(first, last, value);
#else #else
std::iterator_traits<Iterator>::difference_type n = 0; std::iterator_traits<Iterator>::difference_type n = 0;
while (first != last) while (first != last)
if (*first++ == value) ++n; if (*first++ == value) ++n;
return n; return n;

View File

@ -65,10 +65,10 @@ typedef unsigned reg_syntax_t;
/* If this bit is set, then ^ and $ are always anchors (outside bracket /* If this bit is set, then ^ and $ are always anchors (outside bracket
expressions, of course). expressions, of course).
If this bit is not set, then it depends: If this bit is not set, then it depends:
^ is an anchor if it is at the beginning of a regular ^ is an anchor if it is at the beginning of a regular
expression or after an open-group or an alternation operator; expression or after an open-group or an alternation operator;
$ is an anchor if it is at the end of a regular expression, or $ is an anchor if it is at the end of a regular expression, or
before a close-group or an alternation operator. before a close-group or an alternation operator.
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
POSIX draft 11.2 says that * etc. in leading positions is undefined. POSIX draft 11.2 says that * etc. in leading positions is undefined.
@ -158,7 +158,7 @@ extern reg_syntax_t re_syntax_options;
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
| RE_UNMATCHED_RIGHT_PAREN_ORD) | RE_UNMATCHED_RIGHT_PAREN_ORD)
#define RE_SYNTAX_POSIX_AWK \ #define RE_SYNTAX_POSIX_AWK \
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS) (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
#define RE_SYNTAX_GREP \ #define RE_SYNTAX_GREP \
@ -289,8 +289,8 @@ struct re_pattern_buffer
{ {
/* [[[begin pattern_buffer]]] */ /* [[[begin pattern_buffer]]] */
/* Space that holds the compiled pattern. It is declared as /* Space that holds the compiled pattern. It is declared as
`unsigned char *' because its elements are `unsigned char *' because its elements are
sometimes used as array indexes. */ sometimes used as array indexes. */
unsigned char *buffer; unsigned char *buffer;
/* Number of bytes to which `buffer' points. */ /* Number of bytes to which `buffer' points. */
@ -299,55 +299,55 @@ struct re_pattern_buffer
/* Number of bytes actually used in `buffer'. */ /* Number of bytes actually used in `buffer'. */
unsigned long used; unsigned long used;
/* Syntax setting with which the pattern was compiled. */ /* Syntax setting with which the pattern was compiled. */
reg_syntax_t syntax; reg_syntax_t syntax;
/* Pointer to a fastmap, if any, otherwise zero. re_search uses /* Pointer to a fastmap, if any, otherwise zero. re_search uses
the fastmap, if there is one, to skip over impossible the fastmap, if there is one, to skip over impossible
starting points for matches. */ starting points for matches. */
char *fastmap; char *fastmap;
/* Either a translate table to apply to all characters before /* Either a translate table to apply to all characters before
comparing them, or zero for no translation. The translation comparing them, or zero for no translation. The translation
is applied to a pattern when it is compiled and to a string is applied to a pattern when it is compiled and to a string
when it is matched. */ when it is matched. */
char *translate; char *translate;
/* Number of subexpressions found by the compiler. */ /* Number of subexpressions found by the compiler. */
size_t re_nsub; size_t re_nsub;
/* Zero if this pattern cannot match the empty string, one else. /* Zero if this pattern cannot match the empty string, one else.
Well, in truth it's used only in `re_search_2', to see Well, in truth it's used only in `re_search_2', to see
whether or not we should use the fastmap, so we don't set whether or not we should use the fastmap, so we don't set
this absolutely perfectly; see `re_compile_fastmap' (the this absolutely perfectly; see `re_compile_fastmap' (the
`duplicate' case). */ `duplicate' case). */
unsigned can_be_null : 1; unsigned can_be_null : 1;
/* If REGS_UNALLOCATED, allocate space in the `regs' structure /* If REGS_UNALLOCATED, allocate space in the `regs' structure
for `max (RE_NREGS, re_nsub + 1)' groups. for `max (RE_NREGS, re_nsub + 1)' groups.
If REGS_REALLOCATE, reallocate space if necessary. If REGS_REALLOCATE, reallocate space if necessary.
If REGS_FIXED, use what's there. */ If REGS_FIXED, use what's there. */
#define REGS_UNALLOCATED 0 #define REGS_UNALLOCATED 0
#define REGS_REALLOCATE 1 #define REGS_REALLOCATE 1
#define REGS_FIXED 2 #define REGS_FIXED 2
unsigned regs_allocated : 2; unsigned regs_allocated : 2;
/* Set to zero when `regex_compile' compiles a pattern; set to one /* Set to zero when `regex_compile' compiles a pattern; set to one
by `re_compile_fastmap' if it updates the fastmap. */ by `re_compile_fastmap' if it updates the fastmap. */
unsigned fastmap_accurate : 1; unsigned fastmap_accurate : 1;
/* If set, `re_match_2' does not return information about /* If set, `re_match_2' does not return information about
subexpressions. */ subexpressions. */
unsigned no_sub : 1; unsigned no_sub : 1;
/* If set, a beginning-of-line anchor doesn't match at the /* If set, a beginning-of-line anchor doesn't match at the
beginning of the string. */ beginning of the string. */
unsigned not_bol : 1; unsigned not_bol : 1;
/* Similarly for an end-of-line anchor. */ /* Similarly for an end-of-line anchor. */
unsigned not_eol : 1; unsigned not_eol : 1;
/* If true, an anchor at a newline matches. */ /* If true, an anchor at a newline matches. */
unsigned newline_anchor : 1; unsigned newline_anchor : 1;
/* [[[end pattern_buffer]]] */ /* [[[end pattern_buffer]]] */
@ -418,7 +418,7 @@ extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
BUFFER. Return NULL if successful, and an error string if not. */ BUFFER. Return NULL if successful, and an error string if not. */
extern const char *re_compile_pattern extern const char *re_compile_pattern
_RE_ARGS ((const char *pattern, int length, _RE_ARGS ((const char *pattern, int length,
struct re_pattern_buffer *buffer)); struct re_pattern_buffer *buffer));
/* Compile a fastmap for the compiled pattern in BUFFER; used to /* Compile a fastmap for the compiled pattern in BUFFER; used to
@ -434,29 +434,29 @@ extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
information in REGS (if REGS and BUFFER->no_sub are nonzero). */ information in REGS (if REGS and BUFFER->no_sub are nonzero). */
extern int re_search extern int re_search
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
int length, int start, int range, struct re_registers *regs)); int length, int start, int range, struct re_registers *regs));
/* Like `re_search', but search in the concatenation of STRING1 and /* Like `re_search', but search in the concatenation of STRING1 and
STRING2. Also, stop searching at index START + STOP. */ STRING2. Also, stop searching at index START + STOP. */
extern int re_search_2 extern int re_search_2
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
int length1, const char *string2, int length2, int length1, const char *string2, int length2,
int start, int range, struct re_registers *regs, int stop)); int start, int range, struct re_registers *regs, int stop));
/* Like `re_search', but return how many characters in STRING the regexp /* Like `re_search', but return how many characters in STRING the regexp
in BUFFER matched, starting at position START. */ in BUFFER matched, starting at position START. */
extern int re_match extern int re_match
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
int length, int start, struct re_registers *regs)); int length, int start, struct re_registers *regs));
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */ /* Relates to `re_match' as `re_search_2' relates to `re_search'. */
extern int re_match_2 extern int re_match_2
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
int length1, const char *string2, int length2, int length1, const char *string2, int length2,
int start, struct re_registers *regs, int stop)); int start, struct re_registers *regs, int stop));
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and /* Set REGS to hold NUM_REGS registers, storing them in STARTS and
@ -473,7 +473,7 @@ extern int re_match_2
freeing the old data. */ freeing the old data. */
extern void re_set_registers extern void re_set_registers
_RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs, _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
unsigned num_regs, regoff_t *starts, regoff_t *ends)); unsigned num_regs, regoff_t *starts, regoff_t *ends));
/* 4.2 bsd compatibility. */ /* 4.2 bsd compatibility. */
extern char *re_comp _RE_ARGS ((const char *)); extern char *re_comp _RE_ARGS ((const char *));
@ -483,10 +483,10 @@ extern int re_exec _RE_ARGS ((const char *));
extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags)); extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
extern int regexec extern int regexec
_RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch, _RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags)); regmatch_t pmatch[], int eflags));
extern size_t regerror extern size_t regerror
_RE_ARGS ((int errcode, const regex_t *preg, char *errbuf, _RE_ARGS ((int errcode, const regex_t *preg, char *errbuf,
size_t errbuf_size)); size_t errbuf_size));
extern void regfree _RE_ARGS ((regex_t *preg)); extern void regfree _RE_ARGS ((regex_t *preg));
/* LyX added. */ /* LyX added. */

View File

@ -887,10 +887,10 @@ void lyxstring::insert(iterator p, iterator first, iterator last)
// Find // Find
//////////////// ////////////////
// All the below find functions should be verified, // All the below find functions should be verified,
// it is very likely that I have mixed up or interpreted // it is very likely that I have mixed up or interpreted
// some of the parameters wrong, also some of the funcs can surely // some of the parameters wrong, also some of the funcs can surely
// be written more effectively. // be written more effectively.
lyxstring::size_type lyxstring::find(lyxstring const & a, size_type i) const lyxstring::size_type lyxstring::find(lyxstring const & a, size_type i) const
{ {
@ -968,10 +968,10 @@ lyxstring::size_type lyxstring::find(value_type c, size_type i) const
TestlyxstringInvariant(this); TestlyxstringInvariant(this);
for (size_type t = 0; t + i < rep->sz; ++t) { for (size_type t = 0; t + i < rep->sz; ++t) {
if (rep->s[t + i] == c) return t + i; if (rep->s[t + i] == c) return t + i;
} }
return npos; return npos;
} }
@ -1478,11 +1478,11 @@ int lyxstring::internal_compare(size_type pos, size_type n,
if (!*s) return 1; if (!*s) return 1;
// since n > n2, min(n, n2) == 0, c == 0 (stops segfault also) // since n > n2, min(n, n2) == 0, c == 0 (stops segfault also)
// remember that n can very well be a lot larger than rep->sz // remember that n can very well be a lot larger than rep->sz
// so we have to ensure that n is no larger than rep->sz // so we have to ensure that n is no larger than rep->sz
n = min(n, rep->sz); n = min(n, rep->sz);
n2 = min(n2, slen); n2 = min(n2, slen);
if (n == n2) if (n == n2)
return memcmp(&(rep->s[pos]), s, n); return memcmp(&(rep->s[pos]), s, n);
int c = memcmp(&(rep->s[pos]), s, min(n, n2)); int c = memcmp(&(rep->s[pos]), s, min(n, n2));
if (c) if (c)

View File

@ -49,12 +49,12 @@
If you want to use a default empty lyxstring as a parameter, use If you want to use a default empty lyxstring as a parameter, use
#void foo(lyxstring par = lyxstring()); // Correct# #void foo(lyxstring par = lyxstring()); // Correct#
rather than rather than
#void foo(lyxstring par = ""); // WRONG!# #void foo(lyxstring par = ""); // WRONG!#
#void foo(lyxstring par = 0); // WRONG!# #void foo(lyxstring par = 0); // WRONG!#
(The last one is only wrong because some compilers can't handle it.) (The last one is only wrong because some compilers can't handle it.)
@ -70,11 +70,11 @@
If you want to check whether a string is empty, do If you want to check whether a string is empty, do
#if (foo.empty()) something right# #if (foo.empty()) something right#
rather than something along the lines of rather than something along the lines of
#if (!foo) completely wrong# #if (!foo) completely wrong#
When you want to copy an lyxstring, just do When you want to copy an lyxstring, just do
@ -83,8 +83,8 @@ When you want to copy an lyxstring, just do
not something like not something like
#lyxstring a, b = "String";# #lyxstring a, b = "String";#
#a = b.copy(); // This leaks. // and does not work either. # #a = b.copy(); // This leaks. // and does not work either. #
The class automatically handles deep copying when required. The class automatically handles deep copying when required.
*/ */

View File

@ -29,4 +29,3 @@ int Path::pop()
popped_ = true; popped_ = true;
return 0; return 0;
} }

View File

@ -106,53 +106,53 @@ template<typename T> class shared_c_ptr {
#if !defined(BOOST_NO_MEMBER_TEMPLATES) #if !defined(BOOST_NO_MEMBER_TEMPLATES)
template<typename Y> template<typename Y>
shared_c_ptr(const shared_c_ptr<Y>& r) : px(r.px) { // never throws shared_c_ptr(const shared_c_ptr<Y>& r) : px(r.px) { // never throws
++*(pn = r.pn); ++*(pn = r.pn);
} }
#ifndef BOOST_NO_AUTO_PTR #ifndef BOOST_NO_AUTO_PTR
template<typename Y> template<typename Y>
explicit shared_c_ptr(std::auto_ptr<Y>& r) { explicit shared_c_ptr(std::auto_ptr<Y>& r) {
pn = new long(1); // may throw pn = new long(1); // may throw
px = r.release(); // fix: moved here to stop leak if new throws px = r.release(); // fix: moved here to stop leak if new throws
} }
#endif #endif
template<typename Y> template<typename Y>
shared_c_ptr& operator=(const shared_c_ptr<Y>& r) { shared_c_ptr& operator=(const shared_c_ptr<Y>& r) {
share(r.px,r.pn); share(r.px,r.pn);
return *this; return *this;
} }
#ifndef BOOST_NO_AUTO_PTR #ifndef BOOST_NO_AUTO_PTR
template<typename Y> template<typename Y>
shared_c_ptr& operator=(std::auto_ptr<Y>& r) { shared_c_ptr& operator=(std::auto_ptr<Y>& r) {
// code choice driven by guarantee of "no effect if new throws" // code choice driven by guarantee of "no effect if new throws"
if (*pn == 1) { checked_delete(px); } if (*pn == 1) { checked_delete(px); }
else { // allocate new reference counter else { // allocate new reference counter
long * tmp = new long(1); // may throw long * tmp = new long(1); // may throw
--*pn; // only decrement once danger of new throwing is past --*pn; // only decrement once danger of new throwing is past
pn = tmp; pn = tmp;
} // allocate new reference counter } // allocate new reference counter
px = r.release(); // fix: moved here so doesn't leak if new throws px = r.release(); // fix: moved here so doesn't leak if new throws
return *this; return *this;
} }
#endif #endif
#else #else
#ifndef BOOST_NO_AUTO_PTR #ifndef BOOST_NO_AUTO_PTR
explicit shared_c_ptr(std::auto_ptr<T>& r) { explicit shared_c_ptr(std::auto_ptr<T>& r) {
pn = new long(1); // may throw pn = new long(1); // may throw
px = r.release(); // fix: moved here to stop leak if new throws px = r.release(); // fix: moved here to stop leak if new throws
} }
shared_c_ptr& operator=(std::auto_ptr<T>& r) { shared_c_ptr& operator=(std::auto_ptr<T>& r) {
// code choice driven by guarantee of "no effect if new throws" // code choice driven by guarantee of "no effect if new throws"
if (*pn == 1) { checked_delete(px); } if (*pn == 1) { checked_delete(px); }
else { // allocate new reference counter else { // allocate new reference counter
long * tmp = new long(1); // may throw long * tmp = new long(1); // may throw
--*pn; // only decrement once danger of new throwing is past --*pn; // only decrement once danger of new throwing is past
pn = tmp; pn = tmp;
} // allocate new reference counter } // allocate new reference counter
px = r.release(); // fix: moved here so doesn't leak if new throws px = r.release(); // fix: moved here so doesn't leak if new throws
return *this; return *this;
} }
#endif #endif
#endif #endif
@ -162,12 +162,12 @@ template<typename T> class shared_c_ptr {
if (--*pn == 0) { checked_delete(px); } if (--*pn == 0) { checked_delete(px); }
else { // allocate new reference counter else { // allocate new reference counter
#ifndef LYX_NO_EXCEPTIONS #ifndef LYX_NO_EXCEPTIONS
try { pn = new long; } // fix: prevent leak if new throws try { pn = new long; } // fix: prevent leak if new throws
catch (...) { catch (...) {
++*pn; // undo effect of --*pn above to meet effects guarantee ++*pn; // undo effect of --*pn above to meet effects guarantee
checked_delete(p); checked_delete(p);
throw; throw;
} // catch } // catch
#else #else
pn = new long; pn = new long;
assert(pn != 0); assert(pn != 0);
@ -206,11 +206,11 @@ template<typename T> class shared_c_ptr {
void share(T* rpx, long* rpn) { void share(T* rpx, long* rpn) {
if (pn != rpn) { // Q: why not px != rpx? A: fails when both == 0 if (pn != rpn) { // Q: why not px != rpx? A: fails when both == 0
++*rpn; // done before dispose() in case rpn transitively ++*rpn; // done before dispose() in case rpn transitively
// dependent on *this (bug reported by Ken Johnson) // dependent on *this (bug reported by Ken Johnson)
dispose(); dispose();
px = rpx; px = rpx;
pn = rpn; pn = rpn;
} }
} // share } // share
}; // shared_ptr }; // shared_ptr
@ -250,7 +250,7 @@ template<typename T>
: binary_function<lyx::shared_c_ptr<T>, lyx::shared_c_ptr<T>, bool> : binary_function<lyx::shared_c_ptr<T>, lyx::shared_c_ptr<T>, bool>
{ {
bool operator()(const lyx::shared_c_ptr<T>& a, bool operator()(const lyx::shared_c_ptr<T>& a,
const lyx::shared_c_ptr<T>& b) const const lyx::shared_c_ptr<T>& b) const
{ return less<T*>()(a.get(),b.get()); } { return less<T*>()(a.get(),b.get()); }
}; };
@ -259,5 +259,3 @@ template<typename T>
#endif // ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #endif // ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#endif // LYX_SMART_PTR_H #endif // LYX_SMART_PTR_H

View File

@ -39,12 +39,11 @@ namespace lyx
template< typename T > template< typename T >
inline void checked_delete(T * x) inline void checked_delete(T * x)
{ {
BOOST_STATIC_ASSERT( sizeof(T) != 0 ); // assert type complete at point BOOST_STATIC_ASSERT( sizeof(T) != 0 ); // assert type complete at point
// of instantiation // of instantiation
free(x); free(x);
} }
} // namespace boost } // namespace boost
#endif // BOOST_UTILITY_HPP #endif // BOOST_UTILITY_HPP