if (isInset(pos))
nextInset(pos)->substitute(tmp, m);
else
- tmp.push_back(GetChar(pos), GetCode(pos));
+ tmp.push_back(getChar(pos), getCode(pos));
}
swap(tmp);
}
}
-unsigned char MathArray::GetChar(int pos) const
+unsigned char MathArray::getChar(int pos) const
{
return pos < size() ? bf_[pos + 1] : '\0';
}
-string MathArray::GetString(int & pos) const
+string MathArray::getString(int & pos) const
{
string s;
if (isInset(pos))
return s;
- MathTextCodes const fcode = GetCode(pos);
+ MathTextCodes const fcode = getCode(pos);
do {
- s += GetChar(pos);
+ s += getChar(pos);
next(pos);
- } while (pos < size() && !isInset(pos) && GetCode(pos) == fcode);
+ } while (pos < size() && !isInset(pos) && getCode(pos) == fcode);
return s;
}
-MathTextCodes MathArray::GetCode(int pos) const
+MathTextCodes MathArray::getCode(int pos) const
{
return pos < size() ? MathTextCodes(bf_[pos]) : LM_TC_MIN;
}
} else {
- MathTextCodes fcode = GetCode(pos);
- unsigned char c = GetChar(pos);
+ MathTextCodes fcode = getCode(pos);
+ unsigned char c = getChar(pos);
if (MathIsSymbol(fcode)) {
latexkeys const * l = lm_get_key_by_id(c, LM_TK_SYM);
///
MathInset * prevInset(int pos) const;
///
- unsigned char GetChar(int pos) const;
+ unsigned char getChar(int pos) const;
/// read subsequent chars of the same kind.
// pos is afterwards one behind the last char belonging to the string
- string GetString(int & pos) const;
+ string getString(int & pos) const;
///
- MathTextCodes GetCode(int pos) const;
+ MathTextCodes getCode(int pos) const;
///
void setCode(int pos, MathTextCodes t);
///
bv->lockedInsetStoreUndo(Undo::INSERT);
int x;
int y;
- mathcursor->GetPos(x, y);
+ mathcursor->getPos(x, y);
mathcursor->breakLine();
mathcursor->normalize();
updateLocal(bv, true);
bv->lockedInsetStoreUndo(Undo::EDIT);
int x;
int y;
- mathcursor->GetPos(x, y);
+ mathcursor->getPos(x, y);
par()->mutate(arg);
- mathcursor->SetPos(x, y);
+ mathcursor->setPos(x, y);
mathcursor->normalize();
updateLocal(bv, true);
break;
{
int x;
int y;
- mathcursor->GetPos(x, y);
+ mathcursor->getPos(x, y);
if (par()->getType() == LM_OT_SIMPLE)
par()->mutate(LM_OT_EQUATION);
else
par()->mutate(LM_OT_SIMPLE);
- mathcursor->SetPos(x, y);
+ mathcursor->setPos(x, y);
mathcursor->normalize();
updateLocal(bv, true);
break;
void handleFont(BufferView * bv, MathTextCodes t)
{
- if (mathcursor->Selection())
+ if (mathcursor->selection())
bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->handleFont(t);
}
void InsetFormulaBase::insetUnlock(BufferView * bv)
{
if (mathcursor) {
- if (mathcursor->InMacroMode()) {
- mathcursor->MacroModeClose();
+ if (mathcursor->inMacroMode()) {
+ mathcursor->macroModeClose();
updateLocal(bv, true);
}
delete mathcursor;
void InsetFormulaBase::getCursorPos(BufferView *, int & x, int & y) const
{
- mathcursor->GetPos(x, y);
+ mathcursor->getPos(x, y);
x -= par_->xo();
y -= par_->yo();
}
else {
int x;
int y;
- mathcursor->GetPos(x, y);
+ mathcursor->getPos(x, y);
//x -= par_->xo();
y -= par_->yo();
int asc;
if (mathcursor) {
int x;
int y;
- mathcursor->GetPos(x, y);
+ mathcursor->getPos(x, y);
x -= par_->xo();
y -= par_->yo();
int asc;
hideInsetCursor(bv);
x += par_->xo();
y += par_->yo();
- mathcursor->SetPos(x, y);
+ mathcursor->setPos(x, y);
showInsetCursor(bv);
if (sel_flag) {
sel_flag = false;
sel_flag = false;
sel_x = x;
sel_y = y;
- if (mathcursor && mathcursor->Selection()) {
- mathcursor->SelClear();
+ if (mathcursor && mathcursor->selection()) {
+ mathcursor->selClear();
bv->updateInset(this, false);
}
}
if (sel_x && sel_y && abs(x-sel_x) > 4 && !sel_flag) {
sel_flag = true;
hideInsetCursor(bv);
- mathcursor->SetPos(sel_x + par_->xo(), sel_y + par_->yo());
- mathcursor->SelStart();
+ mathcursor->setPos(sel_x + par_->xo(), sel_y + par_->yo());
+ mathcursor->selStart();
showInsetCursor(bv);
- mathcursor->GetPos(sel_x, sel_y);
+ mathcursor->getPos(sel_x, sel_y);
} else if (sel_flag) {
hideInsetCursor(bv);
x += par_->xo();
y += par_->yo();
- mathcursor->SetPos(x, y);
+ mathcursor->setPos(x, y);
showInsetCursor(bv);
- mathcursor->GetPos(x, y);
+ mathcursor->getPos(x, y);
if (sel_x != x || sel_y != y)
bv->updateInset(this, false);
sel_x = x;
void InsetFormulaBase::insetKeyPress(XKeyEvent *)
{
- lyxerr[Debug::MATHED]
- << "Used InsetFormulaBase::InsetKeyPress." << endl;
+ lyxerr[Debug::MATHED] << "Used InsetFormulaBase::InsetKeyPress." << endl;
}
return UNDISPATCHED;
MathTextCodes varcode = LM_TC_MIN;
- bool was_macro = mathcursor->InMacroMode();
+ bool was_macro = mathcursor->inMacroMode();
bool sel = false;
- bool was_selection = mathcursor->Selection();
+ bool was_selection = mathcursor->selection();
RESULT result = DISPATCHED;
hideInsetCursor(bv);
sel = true; // fall through...
case LFUN_RIGHT:
- result = DISPATCH_RESULT(mathcursor->Right(sel));
+ result = DISPATCH_RESULT(mathcursor->right(sel));
updateLocal(bv, false);
break;
sel = true; // fall through
case LFUN_LEFT:
- result = DISPATCH_RESULT(mathcursor->Left(sel));
+ result = DISPATCH_RESULT(mathcursor->left(sel));
updateLocal(bv, false);
break;
sel = true;
case LFUN_UP:
- result = DISPATCH_RESULT(mathcursor->Up(sel));
+ result = DISPATCH_RESULT(mathcursor->up(sel));
updateLocal(bv, false);
break;
sel = true;
case LFUN_DOWN:
- result = DISPATCH_RESULT(mathcursor->Down(sel));
+ result = DISPATCH_RESULT(mathcursor->down(sel));
updateLocal(bv, false);
break;
case LFUN_HOME:
- mathcursor->Home();
+ mathcursor->home();
updateLocal(bv, false);
break;
case LFUN_END:
- mathcursor->End();
+ mathcursor->end();
updateLocal(bv, false);
break;
case LFUN_DELETE_LINE_FORWARD:
bv->lockedInsetStoreUndo(Undo::DELETE);
- mathcursor->DelLine();
+ mathcursor->delLine();
updateLocal(bv, true);
break;
break;
case LFUN_BACKSPACE:
- // if (!mathcursor->InMacroMode() && mathcursor->pos() == 0)
+ // if (!mathcursor->inMacroMode() && mathcursor->pos() == 0)
if (mathcursor->pos() == 0) {
bv->lockedInsetStoreUndo(Undo::DELETE);
mathcursor->pullArg(false);
bv->updateInset(this, true);
break;
}
- if (mathcursor->InMacroMode())
- mathcursor->Left();
+ if (mathcursor->inMacroMode())
+ mathcursor->left();
else
mathcursor->plainLeft();
// fall through...
if (mathcursor->pos() == mathcursor->array().size())
mathcursor->pullArg(true);
else
- mathcursor->Delete();
+ mathcursor->erase();
bv->updateInset(this, true);
break;
istringstream is(arg.c_str());
is >> x >> y;
par_->getXY(x1, y1);
- mathcursor->SetPos(x1 + x, y1 + y);
+ mathcursor->setPos(x1 + x, y1 + y);
updateLocal(bv, false);
}
break;
case LFUN_PASTE:
if (was_macro)
- mathcursor->MacroModeClose();
+ mathcursor->macroModeClose();
bv->lockedInsetStoreUndo(Undo::INSERT);
- mathcursor->SelPaste();
+ mathcursor->selPaste();
updateLocal(bv, true);
break;
case LFUN_CUT:
bv->lockedInsetStoreUndo(Undo::DELETE);
- mathcursor->SelCut();
+ mathcursor->selCut();
updateLocal(bv, true);
break;
case LFUN_COPY:
- mathcursor->SelCopy();
+ mathcursor->selCopy();
break;
case LFUN_HOMESEL:
#ifndef NO_LATEX
case LFUN_TEX:
- if (!mathcursor->Selection()) {
+ if (!mathcursor->selection()) {
mathcursor->handleFont(LM_TC_TEX);
//bv->owner()->message(_("TeX mode toggled"));
}
if (!arg.empty()) {
bv->lockedInsetStoreUndo(Undo::INSERT);
latexkeys const * l = in_word_set(arg);
- mathcursor->SetSize(MathStyles(l ? l->id : static_cast<unsigned int>(-1)));
+ mathcursor->setSize(MathStyles(l ? l->id : static_cast<unsigned int>(-1)));
updateLocal(bv, true);
}
break;
case LFUN_INSERT_MATRIX:
if (!arg.empty()) {
bv->lockedInsetStoreUndo(Undo::INSERT);
- mathcursor->Interpret("matrix " + arg);
+ mathcursor->interpret("matrix " + arg);
updateLocal(bv, true);
}
break;
case LFUN_INSERT_MATH:
if (!arg.empty()) {
bv->lockedInsetStoreUndo(Undo::INSERT);
- mathcursor->Interpret(arg);
+ mathcursor->interpret(arg);
updateLocal(bv, true);
}
break;
if (isalpha(c)) {
if (mathcursor->getLastCode() == LM_TC_TEX) {
- mathcursor->MacroModeOpen();
+ mathcursor->macroModeOpen();
mathcursor->clearLastCode();
varcode = LM_TC_MIN;
} else if (!varcode) {
mathcursor->insert(c, LM_TC_TEX);
if (c == '{') {
mathcursor->insert('}', LM_TC_TEX);
- mathcursor->Left();
+ mathcursor->left();
}
mathcursor->clearLastCode();
// varcode = LM_TC_MIN;
mathcursor->clearLastCode();
// varcode = LM_TC_MIN;
} else if ('0' <= c && c <= '9' && (varcode == LM_TC_TEX||was_macro)) {
- mathcursor->MacroModeOpen();
+ mathcursor->macroModeOpen();
mathcursor->clearLastCode();
mathcursor->insert(c, LM_TC_MIN);
} else if (('0' <= c && c <= '9') || strchr(";:!|[]().,?", c)) {
char s[2];
s[0] = c;
s[1] = 0;
- mathcursor->Interpret(s);
+ mathcursor->interpret(s);
} else if (c == ' ') {
if (!varcode) {
MathTextCodes f = (mathcursor->getLastCode()) ?
if (varcode == LM_TC_TEXTRM)
mathcursor->insert(c, LM_TC_TEXTRM);
else if (was_macro)
- mathcursor->MacroModeClose();
+ mathcursor->macroModeClose();
else if (mathcursor->pop())
mathcursor->plainRight();
else {
mathcursor->insert(c, LM_TC_VAR);
} else if (c == '\\') {
if (was_macro)
- mathcursor->MacroModeClose();
+ mathcursor->macroModeClose();
bv->owner()->message(_("TeX mode"));
mathcursor->setLastCode(LM_TC_TEX);
}
mathcursor->normalize();
- if (was_macro != mathcursor->InMacroMode()
+ if (was_macro != mathcursor->inMacroMode()
&& action >= 0 && action != LFUN_BACKSPACE)
updateLocal(bv, true);
- if (mathcursor->Selection() || was_selection)
+ if (mathcursor->selection() || was_selection)
toggleInsetSelection(bv);
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE ||
if (i1.idx_ == i2.idx_)
data_.push_back(MathArray(i1.cell(), i1.pos_, i2.pos_));
else {
-#ifdef RECTANGULAR_SELECT
std::vector<int> indices = i1.par_->idxBetween(i1.idx_, i2.idx_);
for (unsigned i = 0; i < indices.size(); ++i)
data_.push_back(i1.cell(indices[i]));
-#else
- data_.push_back(MathArray(i1.cell(), i1.pos_, i1.cell().size()));
- for (int i = i1.idx_ + 1; i < i2.idx_; ++i)
- data_.push_back(i1.cell(i));
- data_.push_back(MathArray(i2.cell(), 0, i2.pos_));
-#endif
}
}
MathCursor::MathCursor(InsetFormulaBase * formula)
- : formula_(formula)
+ : formula_(formula), lastcode_(LM_TC_MIN), imacro_(0), selection_(false)
{
- lastcode = LM_TC_MIN;
- macro_mode = false;
- selection = false;
first();
}
<< " idx: " << Cursor_[i].idx_
<< " par: " << Cursor_[i].par_ << "\n";
- //lyxerr << " sel: " << selection << " data: " << array() << "\n";
+ //lyxerr << " sel: " << selection_ << " data: " << array() << "\n";
}
}
-bool MathCursor::Left(bool sel)
+bool MathCursor::left(bool sel)
{
dump("Left 1");
- if (macro_mode) {
+ if (imacro_) {
// was MacroModeBack()
- if (!imacro->name().empty()) {
- imacro->setName(imacro->name().substr(0, imacro->name().length()-1));
- imacro->metrics(imacro->size());
+ if (!imacro_->name().empty()) {
+ imacro_->setName(imacro_->name().substr(0, imacro_->name().length()-1));
+ imacro_->metrics(imacro_->size());
} else
- MacroModeClose();
+ macroModeClose();
return true;
}
- SelHandle(sel);
+ selHandle(sel);
clearLastCode();
MathInset * p = prevInset();
}
-bool MathCursor::Right(bool sel)
+bool MathCursor::right(bool sel)
{
dump("Right 1");
- if (macro_mode) {
- MacroModeClose();
+ if (imacro_) {
+ macroModeClose();
return true;
}
- SelHandle(sel);
+ selHandle(sel);
clearLastCode();
MathInset * p = nextInset();
}
-void MathCursor::SetPos(int x, int y)
+void MathCursor::setPos(int x, int y)
{
- dump("SetPos 1");
- //lyxerr << "MathCursor::SetPos x: " << x << " y: " << y << "\n";
+ dump("setPos 1");
+ //lyxerr << "MathCursor::setPos x: " << x << " y: " << y << "\n";
- MacroModeClose();
- lastcode = LM_TC_MIN;
+ macroModeClose();
+ lastcode_ = LM_TC_MIN;
first();
cursor().par_ = formula()->par();
// << cursor().pos_ << "\n";
MathInset * n = nextInset();
MathInset * p = prevInset();
- if (openable(n, selection, true) && n->covers(x, y))
+ if (openable(n, selection_, true) && n->covers(x, y))
push(n, true);
- else if (openable(p, selection, true) && p->covers(x, y)) {
+ else if (openable(p, selection_, true) && p->covers(x, y)) {
plainLeft();
push(p, false);
} else
break;
}
- dump("SetPos 2");
+ dump("setPos 2");
}
-void MathCursor::Home()
+void MathCursor::home()
{
- dump("Home 1");
- MacroModeClose();
+ dump("home 1");
+ macroModeClose();
clearLastCode();
if (!cursor().par_->idxHome(cursor().idx_, cursor().pos_))
pop();
- dump("Home 2");
+ dump("home 2");
}
-void MathCursor::End()
+void MathCursor::end()
{
- dump("End 1");
- MacroModeClose();
+ dump("end 1");
+ macroModeClose();
clearLastCode();
if (!cursor().par_->idxEnd(cursor().idx_, cursor().pos_)) {
pop();
array().next(cursor().pos_);
}
- dump("End 2");
+ dump("end 2");
}
-void MathCursor::erase()
+void MathCursor::plainErase()
{
array().erase(cursor().pos_);
}
void MathCursor::insert(char c, MathTextCodes t)
{
//lyxerr << "inserting '" << c << "'\n";
- if (selection)
- SelDel();
+ if (selection_)
+ selDel();
- if (t == LM_TC_MIN)
- t = lastcode;
+ if (t != LM_TC_MIN)
+ lastcode_ = t;
- if (macro_mode && !(MathIsAlphaFont(t) || t == LM_TC_MIN))
- MacroModeClose();
+ if (imacro_ && !(MathIsAlphaFont(t) || t == LM_TC_MIN))
+ macroModeClose();
- if (macro_mode) {
+ if (imacro_) {
if (MathIsAlphaFont(t) || t == LM_TC_MIN) {
// was MacroModeinsert(c);
- imacro->setName(imacro->name() + static_cast<char>(c));
+ imacro_->setName(imacro_->name() + c);
return;
}
}
array().insert(cursor().pos_, c, t);
array().next(cursor().pos_);
-
- lastcode = t;
}
void MathCursor::insert(MathInset * p)
{
- MacroModeClose();
+ macroModeClose();
- if (selection) {
+ if (selection_) {
if (p->nargs())
- SelCut();
+ selCut();
else
- SelDel();
+ selDel();
}
array().insert(cursor().pos_, p);
void MathCursor::insert(MathArray const & ar)
{
- MacroModeClose();
- if (selection)
- SelCut();
+ macroModeClose();
+ if (selection_)
+ selCut();
array().insert(cursor().pos_, ar);
cursor().pos_ += ar.size();
}
-void MathCursor::Delete()
+void MathCursor::erase()
{
- dump("Delete 1");
- if (macro_mode)
+ dump("erase 1");
+ if (imacro_)
return;
- if (selection) {
- SelDel();
+ if (selection_) {
+ selDel();
return;
}
bool removeit;
cursor().par_->idxDelete(cursor().idx_, popit, removeit);
if (popit && pop() && removeit)
- Delete();
+ plainErase();
return;
}
if (cursor().pos_ < array().size())
- array().erase(cursor().pos_);
+ plainErase();
- dump("Delete 2");
+ dump("erase 2");
}
-void MathCursor::DelLine()
+void MathCursor::delLine()
{
- MacroModeClose();
+ macroModeClose();
- if (selection) {
- SelDel();
+ if (selection_) {
+ selDel();
return;
}
}
-bool MathCursor::Up(bool sel)
+bool MathCursor::up(bool sel)
{
- dump("Up 1");
- MacroModeClose();
- SelHandle(sel);
+ dump("up 1");
+ macroModeClose();
+ selHandle(sel);
- if (selection) {
+ if (selection_) {
int x = xarray().pos2x(cursor().pos_);
if (cursor().idxDown()) {
cursor().pos_ = xarray().x2pos(x);
push(p, true);
cursor().idx_ = idx;
cursor().pos_ = pos;
- dump("Up 3");
+ dump("up 3");
return true;
}
}
push(p, false);
cursor().idx_ = idx;
cursor().pos_ = pos;
- dump("Up 4");
+ dump("up 4");
return true;
}
}
}
-bool MathCursor::Down(bool sel)
+bool MathCursor::down(bool sel)
{
- dump("Down 1");
- MacroModeClose();
- SelHandle(sel);
+ dump("down 1");
+ macroModeClose();
+ selHandle(sel);
- if (selection) {
+ if (selection_) {
int x = xarray().pos2x(cursor().pos_);
if (cursor().idxDown()) {
cursor().pos_ = xarray().x2pos(x);
}
-void MathCursor::SetSize(MathStyles size)
+void MathCursor::setSize(MathStyles size)
{
cursor().par_->userSetSize(size);
}
-void MathCursor::Interpret(string const & s)
+void MathCursor::interpret(string const & s)
{
- //lyxerr << "Interpret: '" << s << "'\n";
+ //lyxerr << "interpret: '" << s << "'\n";
//lyxerr << "in: " << in_word_set(s) << " \n";
if (s.size() && (s[0] == '^' || s[0] == '_')) {
bool const up = (s[0] == '^');
- SelCut();
+ selCut();
MathScriptInset * p = prevScriptInset();
if (!p) {
MathInset * b = prevInset();
p->down(true);
cursor().idx_ = up ? 0 : 1;
cursor().pos_ = 0;
- SelPaste();
+ selPaste();
return;
}
}
if (p) {
- bool oldsel = selection;
+ bool oldsel = selection_;
if (oldsel)
- SelCut();
+ selCut();
insert(p);
if (p->nargs()) {
plainLeft();
- //push(p, true);
- Right(); // do not push for e.g. MathBigopInset
+ right(); // do not push for e.g. MathBigopInset
if (oldsel)
- SelPaste();
+ selPaste();
}
p->metrics(p->size());
}
}
-void MathCursor::MacroModeOpen()
+void MathCursor::macroModeOpen()
{
- if (!macro_mode) {
- imacro = new MathFuncInset("");
- insert(imacro);
- macro_mode = true;
+ if (!imacro_) {
+ imacro_ = new MathFuncInset("");
+ insert(imacro_);
} else
lyxerr << "Math Warning: Already in macro mode" << endl;
}
-void MathCursor::MacroModeClose()
+void MathCursor::macroModeClose()
{
- if (macro_mode) {
- string name = imacro->name();
+ if (imacro_) {
+ string name = imacro_->name();
plainLeft();
- erase();
- delete imacro;
- macro_mode = false;
- imacro = 0;
- Interpret(name);
+ plainErase();
+ imacro_ = 0;
+ interpret(name);
}
}
-void MathCursor::SelCopy()
+void MathCursor::selCopy()
{
- seldump("SelCopy");
- if (selection) {
+ seldump("selCopy");
+ if (selection_) {
theSelection.grab(*this);
- SelClear();
+ selClear();
}
}
-void MathCursor::SelCut()
+void MathCursor::selCut()
{
- seldump("SelCut");
- if (selection) {
+ seldump("selCut");
+ if (selection_) {
theSelection.grab(*this);
theSelection.erase(*this);
- SelClear();
+ selClear();
}
}
-void MathCursor::SelDel()
+void MathCursor::selDel()
{
- seldump("SelDel");
- if (selection) {
+ seldump("selDel");
+ if (selection_) {
theSelection.erase(*this);
- SelClear();
+ selClear();
}
}
-void MathCursor::SelPaste()
+void MathCursor::selPaste()
{
- seldump("SelPaste");
+ seldump("selPaste");
theSelection.paste(*this);
- SelClear();
+ selClear();
}
-void MathCursor::SelHandle(bool sel)
+void MathCursor::selHandle(bool sel)
{
- if (sel && !selection)
- SelStart();
- if (!sel && selection)
- SelClear();
+ if (sel && !selection_)
+ selStart();
+ if (!sel && selection_)
+ selClear();
}
-void MathCursor::SelStart()
+void MathCursor::selStart()
{
- seldump("SelStart");
- if (selection)
+ seldump("selStart");
+ if (selection_)
return;
Anchor_ = Cursor_;
- selection = true;
+ selection_ = true;
}
-void MathCursor::SelClear()
+void MathCursor::selClear()
{
- selection = false;
+ selection_ = false;
}
void MathCursor::drawSelection(Painter & pain) const
{
- if (!selection)
+ if (!selection_)
return;
MathCursorPos i1;
void MathCursor::handleFont(MathTextCodes t)
{
- if (selection) {
+ if (selection_) {
MathCursorPos i1;
MathCursorPos i2;
getSelection(i1, i2);
if (i1.idx_ == i2.idx_) {
MathArray & ar = i1.cell();
for (int pos = i1.pos_; pos != i2.pos_; ar.next(pos))
- if (!ar.isInset(pos) && isalnum(ar.GetChar(pos))) {
- MathTextCodes c = ar.GetCode(pos) == t ? LM_TC_VAR : t;
+ if (!ar.isInset(pos) && isalnum(ar.getChar(pos))) {
+ MathTextCodes c = ar.getCode(pos) == t ? LM_TC_VAR : t;
ar.setCode(pos, c);
}
}
- } else {
- lastcode = (lastcode == t) ? LM_TC_VAR : t;
- }
+ } else
+ lastcode_ = (lastcode_ == t) ? LM_TC_VAR : t;
}
void MathCursor::handleAccent(string const & name, int code)
{
MathDecorationInset * p = new MathDecorationInset(name, code);
- if (selection) {
- SelCut();
+ if (selection_) {
+ selCut();
p->cell(0) = theSelection.glue();
}
insert(p);
void MathCursor::handleDelim(int l, int r)
{
MathDelimInset * p = new MathDelimInset(l, r);
- if (selection) {
- SelCut();
+ if (selection_) {
+ selCut();
p->cell(0) = theSelection.glue();
}
insert(p);
}
-void MathCursor::GetPos(int & x, int & y)
+void MathCursor::getPos(int & x, int & y)
{
x = xarray().xo() + xarray().pos2x(cursor().pos_);
y = xarray().yo();
MathTextCodes MathCursor::nextCode() const
{
- return array().GetCode(cursor().pos_);
+ return array().getCode(cursor().pos_);
}
MathTextCodes MathCursor::prevCode() const
{
- return array().GetCode(cursor().pos_ - 1);
+ return array().getCode(cursor().pos_ - 1);
}
}
-bool MathCursor::InMacroMode() const
+bool MathCursor::inMacroMode() const
{
- return macro_mode;
+ return imacro_;
}
-bool MathCursor::Selection() const
+bool MathCursor::selection() const
{
- return selection;
+ return selection_;
}
void MathCursor::clearLastCode()
{
- lastcode = LM_TC_MIN;
+ lastcode_ = LM_TC_MIN;
}
void MathCursor::setLastCode(MathTextCodes t)
{
- lastcode = t;
+ lastcode_ = t;
}
MathTextCodes MathCursor::getLastCode() const
{
- return lastcode;
+ return lastcode_;
}
dump("pullarg");
MathArray a = array();
if (pop()) {
- array().erase(cursor().pos_);
+ plainErase();
array().insert(cursor().pos_, a);
if (goright)
cursor().pos_ += a.size();
/*
-char MathCursorPos::GetChar() const
+char MathCursorPos::getChar() const
{
- return array().GetChar(cursor().pos_);
+ return array().getChar(cursor().pos_);
}
string s;
int code = nextCode();
for ( ; OK() && nextCode() == code; Next())
- s += GetChar();
+ s += getChar();
return s;
}
///
void erase();
///
- void Home();
+ void home();
///
- void End();
+ void end();
///
- bool Right(bool sel = false);
+ bool right(bool sel = false);
///
- bool Left(bool sel = false);
+ bool left(bool sel = false);
///
- bool Up(bool sel = false);
+ bool up(bool sel = false);
///
- bool Down(bool sel = false);
+ bool down(bool sel = false);
/// Put the cursor in the first position
void first();
/// Put the cursor in the last position
///
bool plainRight();
///
- void Delete();
+ void plainErase();
///
- void DelLine();
+ void delLine();
/// This is in pixels from (maybe?) the top of inset
- void SetPos(int, int);
+ void setPos(int, int);
///
- void GetPos(int & x, int & y);
+ void getPos(int & x, int & y);
///
MathInset * par() const;
/// return the next enclosing par of the given type and the cursor's
///
int pos() const;
///
- void Interpret(string const &);
+ void interpret(string const &);
///
- void SetSize(MathStyles);
+ void setSize(MathStyles);
///
bool toggleLimits();
///
// Macro mode methods
- void MacroModeOpen();
+ void macroModeOpen();
///
- void MacroModeClose();
+ void macroModeClose();
///
- bool InMacroMode() const;
+ bool inMacroMode() const;
// Local selection methods
///
- bool Selection() const;
+ bool selection() const;
///
- void SelCopy();
+ void selCopy();
///
- void SelCut();
+ void selCut();
///
- void SelDel();
+ void selDel();
///
- void SelPaste();
+ void selPaste();
///
- void SelHandle(bool);
+ void selHandle(bool);
///
- void SelStart();
+ void selStart();
///
- void SelClear();
+ void selClear();
///
void drawSelection(Painter & pain) const;
///
bool pop();
//private:
- ///
- bool macro_mode;
-
- // Selection stuff
- /// do we currently select
- bool selection;
-
///
InsetFormulaBase * const formula_;
///
- MathTextCodes lastcode;
+ MathTextCodes lastcode_;
+ ///
+ MathFuncInset * imacro_;
+ // Selection stuff
+ /// do we currently select
+ bool selection_;
///
MathArray & array() const;
MathScriptInset * prevScriptInset() const;
///
MathSpaceInset * prevSpaceInset() const;
-
- ///
- MathFuncInset * imacro;
};
extern MathCursor * mathcursor;
{
for (int pos = 0; pos < array.size(); array.next(pos))
if (!array.isInset(pos) &&
- MathIsRelOp(array.GetChar(pos), array.GetCode(pos)))
+ MathIsRelOp(array.getChar(pos), array.getCode(pos)))
return pos;
return array.size();
}
des = p->descent();
wid = p->width();
} else {
- char cx = data_.GetChar(pos);
- MathTextCodes fc = data_.GetCode(pos);
+ char cx = data_.getChar(pos);
+ MathTextCodes fc = data_.getCode(pos);
mathed_char_dim(fc, style_, cx, asc, des, wid);
}
ascent_ = max(ascent_, asc);
p->draw(pain, x, y);
x += p->width();
} else {
- char cx = data_.GetChar(pos);
- MathTextCodes fc = data_.GetCode(pos);
+ char cx = data_.getChar(pos);
+ MathTextCodes fc = data_.getCode(pos);
string s;
s += cx;
drawStr(pain, fc, style_, x, y, s);
if (data_.isInset(pos))
return data_.nextInset(pos)->width();
else
- return mathed_char_width(data_.GetCode(pos), style_, data_.GetChar(pos));
+ return mathed_char_width(data_.getCode(pos), style_, data_.getChar(pos));
}
std::ostream & operator<<(std::ostream & os, MathXArray const & ar)