12 files changed:
+2000-02-25 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * src/insets/insettext.h: small change to get the new files from
+ Juergen to compile (use "string", not "class string").
+
+ * src/insets/insettext.[Ch], src/insets/insertert.[Ch]: use string
+ const & as parameter to LocalDispatch, use LyXFont const & as
+ paramter to some other func. This also had impacto on lyxinsets.h
+ and the two mathed insets.
+
2000-02-24 Juergen Vigna <jug@sad.it>
* src/buffer.C:
2000-02-24 Juergen Vigna <jug@sad.it>
* src/buffer.C:
/// An updatable inset could handle lyx editing commands
#ifdef SCROLL_INSET
/// An updatable inset could handle lyx editing commands
#ifdef SCROLL_INSET
-UpdatableInset::RESULT UpdatableInset::LocalDispatch(BufferView *,
- int action, string arg)
+UpdatableInset::RESULT
+UpdatableInset::LocalDispatch(BufferView *,
+ int action, string const & arg)
-UpdatableInset::RESULT UpdatableInset::LocalDispatch(BufferView *, int, string)
+UpdatableInset::RESULT
+UpdatableInset::LocalDispatch(BufferView *, int, string const &)
#endif
{
#ifdef SCROLL_INSET
#endif
{
#ifdef SCROLL_INSET
*
* LyX, The Document Processor
*
*
* LyX, The Document Processor
*
- * Copyright (C) 1998 The LyX Team.
+ * Copyright 1998 The LyX Team.
*
*======================================================*/
*
*======================================================*/
#include "lyx_gui_misc.h"
#include "lyx_gui_misc.h"
-InsetERT::InsetERT(Buffer * bf): InsetText(bf)
+InsetERT::InsetERT(Buffer * bf)
+ : InsetText(bf)
{
closed = true;
nomotion = false;
{
closed = true;
nomotion = false;
-void InsetERT::draw(Painter & pain, LyXFont const & f, int baseline, float & x) const
+void InsetERT::draw(Painter & pain, LyXFont const & f,
+ int baseline, float & x) const
{
if (closed) {
top_x = int(x);
{
if (closed) {
top_x = int(x);
*
* LyX, The Document Processor
*
*
* LyX, The Document Processor
*
- * Copyright (C) 1998 The LyX Team.
+ * Copyright 1998 The LyX Team.
*
*======================================================
*/
*
*======================================================
*/
///
int width_closed(Painter &, LyXFont const & f) const;
///
///
int width_closed(Painter &, LyXFont const & f) const;
///
- void draw_closed(Painter & pain, const LyXFont &, int , float &) const;
+ void draw_closed(Painter & pain, LyXFont const &, int , float &) const;
- ///
- bool
- closed,
- nomotion;
+ ///
+ bool closed;
+ ///
+ bool nomotion;
*
* LyX, The Document Processor
*
*
* LyX, The Document Processor
*
- * Copyright (C) 1998 The LyX Team.
+ * Copyright 1998 The LyX Team.
*
* ======================================================
*/
*
* ======================================================
*/
-void InsetText::WriteParagraphData(ostream &os) const
+void InsetText::WriteParagraphData(ostream & os) const
{
LyXFont font1 = LyXFont(LyXFont::ALL_INHERIT);
LyXFont font2;
{
LyXFont font1 = LyXFont(LyXFont::ALL_INHERIT);
LyXFont font2;
switch (c) {
case LyXParagraph::META_INSET: {
switch (c) {
case LyXParagraph::META_INSET: {
- Inset *inset = par->GetInset(i);
+ Inset * inset = par->GetInset(i);
if (inset) {
os << "\n\\begin_inset ";
inset->Write(os);
if (inset) {
os << "\n\\begin_inset ";
inset->Write(os);
continue;
else if (token[0] != '\\') {
int n = token.length();
continue;
else if (token[0] != '\\') {
int n = token.length();
- for (int i=0; i < n; ++i) {
+ for (int i = 0; i < n; ++i) {
par->InsertChar(pos, token[i]);
par->SetFont(pos, font);
++pos;
par->InsertChar(pos, token[i]);
par->SetFont(pos, font);
++pos;
} else if (inscmd.getCmdName() == "ref" ||
inscmd.getCmdName() == "pageref") {
inset = new InsetRef(inscmd, buffer);
} else if (inscmd.getCmdName() == "ref" ||
inscmd.getCmdName() == "pageref") {
inset = new InsetRef(inscmd, buffer);
+ }
+#if 0 // Is this compatibility code needed (Lgb)
+ else
// The following three are only for compatibility
if (inscmd.getCmdName()=="-") {
inset = new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
// The following three are only for compatibility
if (inscmd.getCmdName()=="-") {
inset = new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
inset = new InsetSpecialChar(InsetSpecialChar::LDOTS);
} else
inset = inscmd.Clone();
inset = new InsetSpecialChar(InsetSpecialChar::LDOTS);
} else
inset = inscmd.Clone();
}
if (inset) {
par->InsertChar(pos, LyXParagraph::META_INSET);
}
if (inset) {
par->InsertChar(pos, LyXParagraph::META_INSET);
-void InsetText::draw(Painter & pain,const LyXFont & f,int baseline,float & x) const
+void InsetText::draw(Painter & pain, LyXFont const & f,
+ int baseline, float & x) const
- unsigned int
- r;
- bool
- do_reset_pos;
-
UpdatableInset::draw(pain, f, baseline, x);
UpdatableInset::draw(pain, f, baseline, x);
- do_reset_pos = (x != top_x) || (baseline != top_baseline);
+
+ bool do_reset_pos = (x != top_x) || (baseline != top_baseline);
top_x = int(x);
top_baseline = baseline;
computeBaselines(baseline);
top_x = int(x);
top_baseline = baseline;
computeBaselines(baseline);
- for(r=0; r<rows.size()-1; ++r) {
+ for(unsigned int r = 0; r < rows.size() - 1; ++r) {
drawRowSelection(pain, rows[r].pos, rows[r+1].pos, r,
rows[r].baseline, x);
drawRowText(pain, rows[r].pos, rows[r+1].pos, rows[r].baseline, x);
drawRowSelection(pain, rows[r].pos, rows[r+1].pos, r,
rows[r].baseline, x);
drawRowText(pain, rows[r].pos, rows[r+1].pos, rows[r].baseline, x);
{
if (!hasSelection())
return;
{
if (!hasSelection())
return;
- int
- p,
- ssel_x, esel_x,
- s_start, s_end;
- LyXFont
- font;
- char
- ch;
if (selection_start > selection_end) {
s_start = selection_end;
s_end = selection_start;
if (selection_start > selection_end) {
s_start = selection_end;
s_end = selection_start;
}
if ((s_start > endpos) || (s_end < startpos))
return;
}
if ((s_start > endpos) || (s_end < startpos))
return;
- ssel_x = esel_x = int(x);
- for(p=startpos; p < endpos; ++p) {
+
+ int esel_x;
+ int ssel_x = esel_x = int(x);
+ LyXFont font;
+ int p = startpos;
+ for(; p < endpos; ++p) {
if (p == s_start)
ssel_x = int(x);
if ((p >= s_start) && (p <= s_end))
esel_x = int(x);
if (p == s_start)
ssel_x = int(x);
if ((p >= s_start) && (p <= s_end))
esel_x = int(x);
+ char ch = par->GetChar(p);
font = GetFont(par,p);
if (IsFloatChar(ch)) {
// skip for now
font = GetFont(par,p);
if (IsFloatChar(ch)) {
// skip for now
int baseline, float x) const
{
Assert(endpos <= par->Last());
int baseline, float x) const
{
Assert(endpos <= par->Last());
- int
- p;
- char
- ch;
- LyXFont
- font;
- for(p=startpos; p < endpos; ++p) {
- ch = par->GetChar(p);
- font = GetFont(par,p);
+
+ for(int p = startpos; p < endpos; ++p) {
+ char ch = par->GetChar(p);
+ LyXFont font = GetFont(par,p);
if (IsFloatChar(ch)) {
// skip for now
} else if (ch == LyXParagraph::META_INSET) {
if (IsFloatChar(ch)) {
// skip for now
} else if (ch == LyXParagraph::META_INSET) {
-const char * InsetText::EditMessage() const
+char const * InsetText::EditMessage() const
{
return _("Opened Text Inset");
}
{
return _("Opened Text Inset");
}
-void InsetText::InsetUnlock(BufferView *bv)
+void InsetText::InsetUnlock(BufferView * bv)
{
if (the_locking_inset)
the_locking_inset->InsetUnlock(bv);
{
if (the_locking_inset)
the_locking_inset->InsetUnlock(bv);
return the_locking_inset->UnlockInsetInInset(bv, inset,lr);
}
return the_locking_inset->UnlockInsetInInset(bv, inset,lr);
}
bool InsetText::UpdateInsetInInset(BufferView * bv, Inset * inset)
{
if (!the_locking_inset)
bool InsetText::UpdateInsetInInset(BufferView * bv, Inset * inset)
{
if (!the_locking_inset)
void InsetText::InsetMotionNotify(BufferView * bv, int x, int y, int button)
{
if (the_locking_inset) {
void InsetText::InsetMotionNotify(BufferView * bv, int x, int y, int button)
{
if (the_locking_inset) {
- the_locking_inset->InsetMotionNotify(bv, x-inset_x, y-inset_y,button);
+ the_locking_inset->InsetMotionNotify(bv, x - inset_x,
+ y - inset_y,button);
return;
}
if (!no_selection) {
return;
}
if (!no_selection) {
- int
- old = selection_end;
+ int old = selection_end;
setPos(bv, x, y, false);
selection_end = actpos;
if (old != selection_end)
setPos(bv, x, y, false);
selection_end = actpos;
if (old != selection_end)
UpdatableInset::RESULT InsetText::LocalDispatch(BufferView * bv,
UpdatableInset::RESULT InsetText::LocalDispatch(BufferView * bv,
- int action, string arg)
+ int action, string const & arg)
{
no_selection = false;
if (UpdatableInset::LocalDispatch(bv, action, arg)) {
{
no_selection = false;
if (UpdatableInset::LocalDispatch(bv, action, arg)) {
- for(;actpos > rows[actrow].pos;--actpos)
+ for(; actpos > rows[actrow].pos; --actpos)
cx -= SingleWidth(bv, par, actpos);
cx -= SingleWidth(bv, par, actpos);
if (hasSelection()) {
cx -= SingleWidth(bv, par, actpos);
cx -= SingleWidth(bv, par, actpos);
if (hasSelection()) {
- for(;actpos < rows[actrow+1].pos;++actpos)
+ for(; actpos < rows[actrow + 1].pos; ++actpos)
cx += SingleWidth(bv, par, actpos);
if (hasSelection()) {
selection_start = selection_end = actpos;
cx += SingleWidth(bv, par, actpos);
if (hasSelection()) {
selection_start = selection_end = actpos;
int InsetText::Latex(ostream &os, signed char fragile) const
{
int InsetText::Latex(ostream &os, signed char fragile) const
{
- string
- fstr;
- int
- i;
- i = Latex(fstr, fragile);
- os << fstr.c_str();
+ int i = Latex(fstr, fragile);
+ os << fstr;
return i;
}
int InsetText::Latex(string & file, signed char /* fragile */) const
{
return i;
}
int InsetText::Latex(string & file, signed char /* fragile */) const
{
return par->SimpleTeXOnePar(file, texrow);
}
return par->SimpleTeXOnePar(file, texrow);
}
// Returns the width of a character at a certain spot
// Returns the width of a character at a certain spot
-int InsetText::SingleWidth(BufferView *bv, LyXParagraph * par, int pos)
+int InsetText::SingleWidth(BufferView * bv, LyXParagraph * par, int pos)
- LyXFont
- font = GetFont(par, pos);
- char
- c = par->GetChar(pos);
+ LyXFont font = GetFont(par, pos);
+ char c = par->GetChar(pos);
// The most common case is handled first (Asger)
if (IsPrintable(c)) {
// The most common case is handled first (Asger)
if (IsPrintable(c)) {
void InsetText::SingleHeight(BufferView * bv, LyXParagraph * par,int pos,
int & asc, int & desc)
{
void InsetText::SingleHeight(BufferView * bv, LyXParagraph * par,int pos,
int & asc, int & desc)
{
- LyXFont
- font = GetFont(par, pos);
- char
- c = par->GetChar(pos);
+ LyXFont font = GetFont(par, pos);
+ char c = par->GetChar(pos);
asc = desc = 0;
// The most common case is handled first (Asger)
asc = desc = 0;
// The most common case is handled first (Asger)
the_locking_inset->ToggleInsetCursor(bv);
return;
}
the_locking_inset->ToggleInsetCursor(bv);
return;
}
- int
- asc,desc;
- LyXFont
- font = GetFont(par, actpos);
- asc = font.maxAscent();
- desc = font.maxDescent();
+ LyXFont font = GetFont(par, actpos);
+
+ int asc = font.maxAscent();
+ int desc = font.maxDescent();
if (cursor_visible)
bv->hideLockedInsetCursor();
if (cursor_visible)
bv->hideLockedInsetCursor();
void InsetText::ShowInsetCursor(BufferView * bv)
{
if (!cursor_visible) {
void InsetText::ShowInsetCursor(BufferView * bv)
{
if (!cursor_visible) {
- int
- asc,desc;
- LyXFont
- font = GetFont(par, actpos);
+ LyXFont font = GetFont(par, actpos);
- asc = font.maxAscent();
- desc = font.maxDescent();
+ int asc = font.maxAscent();
+ int desc = font.maxDescent();
bv->fitLockedInsetCursor(cx, cy, asc, desc);
bv->showLockedInsetCursor(cx, cy, asc, desc);
cursor_visible = true;
bv->fitLockedInsetCursor(cx, cy, asc, desc);
bv->showLockedInsetCursor(cx, cy, asc, desc);
cursor_visible = true;
void InsetText::setPos(BufferView * bv, int x, int y, bool activate_inset)
{
void InsetText::setPos(BufferView * bv, int x, int y, bool activate_inset)
{
oy = y;
// search right X-pos x==0 -> top_x
actpos = actrow = 0;
cy = top_baseline;
y += cy;
oy = y;
// search right X-pos x==0 -> top_x
actpos = actrow = 0;
cy = top_baseline;
y += cy;
- for(unsigned int i=1;
- ((cy+rows[i-1].desc) < y) && (i < rows.size()-1); ++i) {
+ for(unsigned int i = 1;
+ ((cy + rows[i - 1].desc) < y) && (i < rows.size() - 1); ++i) {
cy = rows[i].baseline;
actpos = rows[i].pos;
actrow = i;
cy = rows[i].baseline;
actpos = rows[i].pos;
actrow = i;
cy -= top_baseline;
cx = top_x;
x += top_x;
cy -= top_baseline;
cx = top_x;
x += top_x;
- sw = swh = SingleWidth(bv, par,actpos);
+ int swh;
+ int sw = swh = SingleWidth(bv, par,actpos);
if (par->GetChar(actpos)!=LyXParagraph::META_INSET)
swh /= 2;
if (par->GetChar(actpos)!=LyXParagraph::META_INSET)
swh /= 2;
- while ((actpos < (rows[actrow+1].pos-1)) && ((cx+swh) < x)) {
+ while ((actpos < (rows[actrow + 1].pos - 1)) && ((cx + swh) < x)) {
cx += sw;
++actpos;
sw = swh = SingleWidth(bv, par,actpos);
cx += sw;
++actpos;
sw = swh = SingleWidth(bv, par,actpos);
swh /= 2;
}
if (activate_inset && par->GetChar(actpos)==LyXParagraph::META_INSET) {
swh /= 2;
}
if (activate_inset && par->GetChar(actpos)==LyXParagraph::META_INSET) {
- the_locking_inset=(UpdatableInset*)par->GetInset(actpos);
- inset_x = cx-top_x;
+ the_locking_inset =
+ static_cast<UpdatableInset*>(par->GetInset(actpos));
+ inset_x = cx - top_x;
inset_y = cy;
inset_pos = actpos;
the_locking_inset->Edit(bv, ox - inset_x, oy - inset_y, 0);
inset_y = cy;
inset_pos = actpos;
the_locking_inset->Edit(bv, ox - inset_x, oy - inset_y, 0);
if (actpos >= par->Last())
return false;
if (activate_inset && par->GetChar(actpos)==LyXParagraph::META_INSET) {
if (actpos >= par->Last())
return false;
if (activate_inset && par->GetChar(actpos)==LyXParagraph::META_INSET) {
- the_locking_inset=(UpdatableInset*)par->GetInset(actpos);
- inset_x = cx-top_x;
+ the_locking_inset =
+ static_cast<UpdatableInset*>(par->GetInset(actpos));
+ inset_x = cx - top_x;
inset_y = cy;
inset_pos = actpos;
the_locking_inset->Edit(bv, 0, 0, 0);
inset_y = cy;
inset_pos = actpos;
the_locking_inset->Edit(bv, 0, 0, 0);
return false;
--actpos;
if (activate_inset && par->GetChar(actpos)==LyXParagraph::META_INSET) {
return false;
--actpos;
if (activate_inset && par->GetChar(actpos)==LyXParagraph::META_INSET) {
- the_locking_inset=(UpdatableInset*)par->GetInset(actpos);
+ the_locking_inset =
+ static_cast<UpdatableInset*>(par->GetInset(actpos));
inset_y = cy;
inset_pos = actpos;
the_locking_inset->Edit(bv, the_locking_inset->
inset_y = cy;
inset_pos = actpos;
the_locking_inset->Edit(bv, the_locking_inset->
- width(bv->getPainter(),GetFont(par,actpos)),
+ width(bv->getPainter(), GetFont(par,actpos)),
0, 0);
} else {
resetPos(bv);
0, 0);
} else {
resetPos(bv);
{
if (!actrow)
return false;
{
if (!actrow)
return false;
- cy = rows[actrow-1].baseline - top_baseline;
- setPos(bv, cx-top_x, cy, activate_inset);
+ cy = rows[actrow - 1].baseline - top_baseline;
+ setPos(bv, cx - top_x, cy, activate_inset);
return true;
}
bool InsetText::moveDown(BufferView * bv, bool activate_inset)
{
return true;
}
bool InsetText::moveDown(BufferView * bv, bool activate_inset)
{
- if (actrow >= int(rows.size()-2))
+ if (actrow >= int(rows.size() - 2))
- cy = rows[actrow+1].baseline - top_baseline;
- setPos(bv, cx-top_x, cy, activate_inset);
+ cy = rows[actrow + 1].baseline - top_baseline;
+ setPos(bv, cx - top_x, cy, activate_inset);
return true;
}
void InsetText::resetPos(BufferView * bv)
{
return true;
}
void InsetText::resetPos(BufferView * bv)
{
- int
- i,
- old_pos = actpos;
cy = top_baseline;
actrow = 0;
cy = top_baseline;
actrow = 0;
- for(i=0; rows[i].pos <= actpos; ++i) {
+ for(int i = 0; rows[i].pos <= actpos; ++i) {
cy = rows[i].baseline;
actrow = i;
}
cy = rows[i].baseline;
actrow = i;
}
par->InsertInset(actpos, inset);
computeTextRows(bv);
bv->updateInset(this, true);
par->InsertInset(actpos, inset);
computeTextRows(bv);
bv->updateInset(this, true);
- the_locking_inset = (UpdatableInset*)inset;
- inset_x = cx-top_x;
+ the_locking_inset = static_cast<UpdatableInset*>(inset);
+ inset_x = cx - top_x;
inset_y = cy;
inset_pos = actpos;
inset->Edit(bv, 0, 0, 0);
inset_y = cy;
inset_pos = actpos;
inset->Edit(bv, 0, 0, 0);
-void InsetText::SetFont(BufferView * bv, LyXFont const & font,bool toggleall)
+void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall)
{
// if there is no selection just set the current_font
if (!hasSelection()) {
{
// if there is no selection just set the current_font
if (!hasSelection()) {
real_current_font.realize(layoutfont);
return;
}
real_current_font.realize(layoutfont);
return;
}
- int
- s_start, s_end;
-
if (selection_start > selection_end) {
s_start = selection_end;
s_end = selection_start;
if (selection_start > selection_end) {
s_start = selection_end;
s_end = selection_start;
s_start = selection_start;
s_end = selection_end;
}
s_start = selection_start;
s_end = selection_end;
}
while(s_start < s_end) {
newfont = GetFont(par,s_start);
newfont.update(font, toggleall);
while(s_start < s_end) {
newfont = GetFont(par,s_start);
newfont.update(font, toggleall);
-void InsetText::SetCharFont(int pos, LyXFont font)
+void InsetText::SetCharFont(int pos, LyXFont const & f)
- /* let the insets convert their font */
+ /* let the insets convert their font */
+ LyXFont font(f);
+
if (par->GetChar(pos) == LyXParagraph::META_INSET) {
if (par->GetInset(pos))
font = par->GetInset(pos)->ConvertFont(font);
if (par->GetChar(pos) == LyXParagraph::META_INSET) {
if (par->GetInset(pos))
font = par->GetInset(pos)->ConvertFont(font);
void InsetText::computeTextRows(BufferView * bv)
{
void InsetText::computeTextRows(BufferView * bv)
{
nwp = 0,
asc = 0,
desc = 0,
oasc = 0,
odesc = 0,
owidth = 0,
nwp = 0,
asc = 0,
desc = 0,
oasc = 0,
odesc = 0,
owidth = 0,
if (rows.size())
rows.erase(rows.begin(),rows.end());
if (rows.size())
rows.erase(rows.begin(),rows.end());
- width = wordAscent = wordDescent = 0;
+ int width = wordAscent = wordDescent = 0;
insetWidth = maxAscent = maxDescent = 0;
row.asc = 0;
row.desc = 0;
insetWidth = maxAscent = maxDescent = 0;
row.asc = 0;
row.desc = 0;
rows.push_back(row);
return;
}
rows.push_back(row);
return;
}
- bool
- is_first_word_in_row = true;
+ bool is_first_word_in_row = true;
lastWordWidth=0;
for(p = 0; p < par->Last(); ++p) {
lastWordWidth=0;
for(p = 0; p < par->Last(); ++p) {
void InsetText::computeBaselines(int baseline) const
{
rows[0].baseline = baseline;
void InsetText::computeBaselines(int baseline) const
{
rows[0].baseline = baseline;
void InsetText::init(BufferView * bv)
{
// if (init_inset)
void InsetText::init(BufferView * bv)
{
// if (init_inset)
*
* LyX, The Document Processor
*
*
* LyX, The Document Processor
*
- * Copyright (C) 1998 The LyX Team.
+ * Copyright 1998 The LyX Team.
*
*======================================================
*/
*
*======================================================
*/
///
int getMaxWidth(UpdatableInset *) const;
///
///
int getMaxWidth(UpdatableInset *) const;
///
- void draw(Painter & pain, const LyXFont &, int , float &) const;
+ void draw(Painter & pain, LyXFont const &, int , float &) const;
- const char * EditMessage() const;
+ char const * EditMessage() const;
///
void Edit(BufferView *, int, int, unsigned int);
///
void InsetUnlock(BufferView *);
///
///
void Edit(BufferView *, int, int, unsigned int);
///
void InsetUnlock(BufferView *);
///
- bool UnlockInsetInInset(BufferView *, Inset *, bool lr=false);
+ bool UnlockInsetInInset(BufferView *, Inset *, bool lr = false);
///
//void UpdateLocal(bool flag=true);
///
///
//void UpdateLocal(bool flag=true);
///
///
void InsetKeyPress(XKeyEvent *);
///
///
void InsetKeyPress(XKeyEvent *);
///
- UpdatableInset::RESULT LocalDispatch(BufferView *, int, string);
+ UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &);
///
int Latex(ostream &, signed char) const;
///
int Latex(string &, signed char) const;
///
///
int Latex(ostream &, signed char) const;
///
int Latex(string &, signed char) const;
///
- int Linuxdoc(class string &) const { return true; }
+ int Linuxdoc(string &) const { return 0; }
- int DocBook(class string &) const { return true; }
+ int DocBook(string &) const { return 0; }
///
void Validate(LaTeXFeatures & features) const;
///
///
void Validate(LaTeXFeatures & features) const;
///
///
void HideInsetCursor(BufferView *);
///
///
void HideInsetCursor(BufferView *);
///
- void setPos(BufferView *, int x, int y, bool activate_inset=true);
+ void setPos(BufferView *, int x, int y, bool activate_inset = true);
///
bool moveRight(BufferView *, bool activate_inset = true);
bool moveLeft(BufferView *, bool activate_inset = true);
///
bool moveRight(BufferView *, bool activate_inset = true);
bool moveLeft(BufferView *, bool activate_inset = true);
bool moveDown(BufferView *, bool activate_inset = true);
bool Delete();
///
bool moveDown(BufferView *, bool activate_inset = true);
bool Delete();
///
- bool hasSelection() const {return (selection_start != selection_end);}
+ bool hasSelection() const { return selection_start != selection_end; }
- void SetCharFont(int pos, LyXFont font);
+ void SetCharFont(int pos, LyXFont const & font);
dispatched by lower level insets
*/
enum RESULT {
dispatched by lower level insets
*/
enum RESULT {
///
virtual int InsetInInsetY() { return 0; }
///
///
virtual int InsetInInsetY() { return 0; }
///
- virtual bool UpdateInsetInInset(BufferView *, Inset *) {return false;}
+ virtual bool UpdateInsetInInset(BufferView *, Inset *)
+ { return false; }
- virtual bool UnlockInsetInInset(BufferView *,Inset *,bool /*lr*/=false)
- {return false;}
+ virtual bool UnlockInsetInInset(BufferView *, Inset *,
+ bool /*lr*/=false)
+ { return false; }
/// An updatable inset could handle lyx editing commands
/// An updatable inset could handle lyx editing commands
- virtual RESULT LocalDispatch(BufferView *, int, string);
+ virtual RESULT LocalDispatch(BufferView *, int, string const &);
///
virtual bool isCursorVisible() const { return cursor_visible; }
///
virtual int getMaxWidth(UpdatableInset *) const { return -1; }
///
virtual bool isCursorVisible() const { return cursor_visible; }
///
virtual int getMaxWidth(UpdatableInset *) const { return -1; }
protected:
///
// virtual void UpdateLocal(bool flag=true);
protected:
///
// virtual void UpdateLocal(bool flag=true);
inset->Edit(owner->view(),slx,sly,0);
return string();
} else if (owner->view()->the_locking_inset->
inset->Edit(owner->view(),slx,sly,0);
return string();
} else if (owner->view()->the_locking_inset->
- LocalDispatch(owner->view(),action,
+ LocalDispatch(owner->view(), action,
argument) ==
UpdatableInset::DISPATCHED)
return string();
argument) ==
UpdatableInset::DISPATCHED)
return string();
if (owner->view()->available()) {
owner->view()->
open_new_inset(new InsetFormula(false));
if (owner->view()->available()) {
owner->view()->
open_new_inset(new InsetFormula(false));
- owner->view()->
- the_locking_inset->LocalDispatch(owner->view(),
- action,
- argument.c_str());
+ owner->view()
+ ->the_locking_inset
+ ->LocalDispatch(owner->view(),
+ action,
+ argument);
-UpdatableInset::RESULT InsetFormula::LocalDispatch(BufferView * bv,
- int action, string arg)
+UpdatableInset::RESULT
+InsetFormula::LocalDispatch(BufferView * bv,
+ int action, string const & arg)
{
// extern char *dispatch_result;
MathedTextCodes varcode = LM_TC_MIN;
{
// extern char *dispatch_result;
MathedTextCodes varcode = LM_TC_MIN;
void InsetUnlock(BufferView *);
/// To allow transparent use of math editing functions
void InsetUnlock(BufferView *);
/// To allow transparent use of math editing functions
- virtual RESULT LocalDispatch(BufferView *, int, string);
+ virtual RESULT LocalDispatch(BufferView *, int, string const &);
///
void InsertSymbol(BufferView *, char const *);
///
void InsertSymbol(BufferView *, char const *);
-UpdatableInset::RESULT InsetFormulaMacro::LocalDispatch(BufferView * bv,
- int action, string arg)
+UpdatableInset::RESULT
+InsetFormulaMacro::LocalDispatch(BufferView * bv,
+ int action, string const & arg)
{
if (action == LFUN_MATH_MACROARG) {
int i = atoi(arg.c_str()) - 1;
{
if (action == LFUN_MATH_MACROARG) {
int i = atoi(arg.c_str()) - 1;
///
void InsetUnlock(BufferView *);
///
///
void InsetUnlock(BufferView *);
///
- RESULT LocalDispatch(BufferView *, int, string);
+ RESULT LocalDispatch(BufferView *, int, string const &);