From: André Pönitz Date: Thu, 26 Jul 2001 09:01:36 +0000 (+0000) Subject: lowercase method names X-Git-Tag: 1.6.10~20991 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=50ea0354bd72ba454eeda41df968a7df380ed7ce;p=lyx.git lowercase method names git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2354 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/array.C b/src/mathed/array.C index 5349db0d5e..264002ea0a 100644 --- a/src/mathed/array.C +++ b/src/mathed/array.C @@ -82,7 +82,7 @@ void MathArray::substitute(MathMacro const & m) 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); } @@ -114,29 +114,29 @@ MathInset * MathArray::prevInset(int pos) const } -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; } @@ -305,8 +305,8 @@ void MathArray::write(ostream & os, bool fragile) const } 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); diff --git a/src/mathed/array.h b/src/mathed/array.h index 5f1bf949ab..6ff72c6a3c 100644 --- a/src/mathed/array.h +++ b/src/mathed/array.h @@ -109,12 +109,12 @@ public: /// 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); /// diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 5d9959adb1..1f82753e6c 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -166,7 +166,7 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action, bv->lockedInsetStoreUndo(Undo::INSERT); int x; int y; - mathcursor->GetPos(x, y); + mathcursor->getPos(x, y); mathcursor->breakLine(); mathcursor->normalize(); updateLocal(bv, true); @@ -249,9 +249,9 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action, 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; @@ -261,12 +261,12 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action, { 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; diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 5c7d71f8c3..21d1696ec2 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -71,7 +71,7 @@ string nicelabel(string const & label) void handleFont(BufferView * bv, MathTextCodes t) { - if (mathcursor->Selection()) + if (mathcursor->selection()) bv->lockedInsetStoreUndo(Undo::EDIT); mathcursor->handleFont(t); } @@ -212,8 +212,8 @@ void InsetFormulaBase::edit(BufferView * bv, bool front) void InsetFormulaBase::insetUnlock(BufferView * bv) { if (mathcursor) { - if (mathcursor->InMacroMode()) { - mathcursor->MacroModeClose(); + if (mathcursor->inMacroMode()) { + mathcursor->macroModeClose(); updateLocal(bv, true); } delete mathcursor; @@ -225,7 +225,7 @@ void InsetFormulaBase::insetUnlock(BufferView * bv) void InsetFormulaBase::getCursorPos(BufferView *, int & x, int & y) const { - mathcursor->GetPos(x, y); + mathcursor->getPos(x, y); x -= par_->xo(); y -= par_->yo(); } @@ -241,7 +241,7 @@ void InsetFormulaBase::toggleInsetCursor(BufferView * bv) else { int x; int y; - mathcursor->GetPos(x, y); + mathcursor->getPos(x, y); //x -= par_->xo(); y -= par_->yo(); int asc; @@ -260,7 +260,7 @@ void InsetFormulaBase::showInsetCursor(BufferView * bv, bool) if (mathcursor) { int x; int y; - mathcursor->GetPos(x, y); + mathcursor->getPos(x, y); x -= par_->xo(); y -= par_->yo(); int asc; @@ -313,7 +313,7 @@ void InsetFormulaBase::insetButtonRelease(BufferView * bv, hideInsetCursor(bv); x += par_->xo(); y += par_->yo(); - mathcursor->SetPos(x, y); + mathcursor->setPos(x, y); showInsetCursor(bv); if (sel_flag) { sel_flag = false; @@ -331,8 +331,8 @@ void InsetFormulaBase::insetButtonPress(BufferView * bv, 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); } } @@ -344,17 +344,17 @@ void InsetFormulaBase::insetMotionNotify(BufferView * bv, 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; @@ -365,8 +365,7 @@ void InsetFormulaBase::insetMotionNotify(BufferView * bv, void InsetFormulaBase::insetKeyPress(XKeyEvent *) { - lyxerr[Debug::MATHED] - << "Used InsetFormulaBase::InsetKeyPress." << endl; + lyxerr[Debug::MATHED] << "Used InsetFormulaBase::InsetKeyPress." << endl; } @@ -382,9 +381,9 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, 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); @@ -402,7 +401,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, sel = true; // fall through... case LFUN_RIGHT: - result = DISPATCH_RESULT(mathcursor->Right(sel)); + result = DISPATCH_RESULT(mathcursor->right(sel)); updateLocal(bv, false); break; @@ -411,7 +410,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, sel = true; // fall through case LFUN_LEFT: - result = DISPATCH_RESULT(mathcursor->Left(sel)); + result = DISPATCH_RESULT(mathcursor->left(sel)); updateLocal(bv, false); break; @@ -420,7 +419,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, sel = true; case LFUN_UP: - result = DISPATCH_RESULT(mathcursor->Up(sel)); + result = DISPATCH_RESULT(mathcursor->up(sel)); updateLocal(bv, false); break; @@ -429,23 +428,23 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, 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; @@ -466,15 +465,15 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, 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... @@ -484,7 +483,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, if (mathcursor->pos() == mathcursor->array().size()) mathcursor->pullArg(true); else - mathcursor->Delete(); + mathcursor->erase(); bv->updateInset(this, true); break; @@ -502,7 +501,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, 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; @@ -510,20 +509,20 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, 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: @@ -578,7 +577,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, #ifndef NO_LATEX case LFUN_TEX: - if (!mathcursor->Selection()) { + if (!mathcursor->selection()) { mathcursor->handleFont(LM_TC_TEX); //bv->owner()->message(_("TeX mode toggled")); } @@ -595,7 +594,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, if (!arg.empty()) { bv->lockedInsetStoreUndo(Undo::INSERT); latexkeys const * l = in_word_set(arg); - mathcursor->SetSize(MathStyles(l ? l->id : static_cast(-1))); + mathcursor->setSize(MathStyles(l ? l->id : static_cast(-1))); updateLocal(bv, true); } break; @@ -603,7 +602,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, case LFUN_INSERT_MATRIX: if (!arg.empty()) { bv->lockedInsetStoreUndo(Undo::INSERT); - mathcursor->Interpret("matrix " + arg); + mathcursor->interpret("matrix " + arg); updateLocal(bv, true); } break; @@ -611,7 +610,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, case LFUN_INSERT_MATH: if (!arg.empty()) { bv->lockedInsetStoreUndo(Undo::INSERT); - mathcursor->Interpret(arg); + mathcursor->interpret(arg); updateLocal(bv, true); } break; @@ -784,7 +783,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, if (isalpha(c)) { if (mathcursor->getLastCode() == LM_TC_TEX) { - mathcursor->MacroModeOpen(); + mathcursor->macroModeOpen(); mathcursor->clearLastCode(); varcode = LM_TC_MIN; } else if (!varcode) { @@ -825,7 +824,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, mathcursor->insert(c, LM_TC_TEX); if (c == '{') { mathcursor->insert('}', LM_TC_TEX); - mathcursor->Left(); + mathcursor->left(); } mathcursor->clearLastCode(); // varcode = LM_TC_MIN; @@ -834,7 +833,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, 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)) { @@ -856,7 +855,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, char s[2]; s[0] = c; s[1] = 0; - mathcursor->Interpret(s); + mathcursor->interpret(s); } else if (c == ' ') { if (!varcode) { MathTextCodes f = (mathcursor->getLastCode()) ? @@ -868,7 +867,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, 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 { @@ -880,7 +879,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, 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); } @@ -895,11 +894,11 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, 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 || diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 961e826817..b0811d3b57 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -68,16 +68,9 @@ struct Selection if (i1.idx_ == i2.idx_) data_.push_back(MathArray(i1.cell(), i1.pos_, i2.pos_)); else { -#ifdef RECTANGULAR_SELECT std::vector 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 } } @@ -133,11 +126,8 @@ std::ostream & operator<<(std::ostream & os, MathCursorPos const & p) 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(); } @@ -180,7 +170,7 @@ void MathCursor::dump(char const * what) const << " idx: " << Cursor_[i].idx_ << " par: " << Cursor_[i].par_ << "\n"; - //lyxerr << " sel: " << selection << " data: " << array() << "\n"; + //lyxerr << " sel: " << selection_ << " data: " << array() << "\n"; } @@ -233,19 +223,19 @@ bool MathCursor::plainLeft() } -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(); @@ -270,14 +260,14 @@ bool MathCursor::plainRight() } -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(); @@ -310,13 +300,13 @@ void MathCursor::last() } -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(); @@ -345,43 +335,43 @@ void MathCursor::SetPos(int x, int y) // << 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_); } @@ -390,39 +380,37 @@ void MathCursor::erase() 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(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); @@ -432,23 +420,23 @@ void MathCursor::insert(MathInset * 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; } @@ -458,23 +446,23 @@ void MathCursor::Delete() 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; } @@ -483,13 +471,13 @@ void MathCursor::DelLine() } -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); @@ -508,7 +496,7 @@ bool MathCursor::Up(bool sel) push(p, true); cursor().idx_ = idx; cursor().pos_ = pos; - dump("Up 3"); + dump("up 3"); return true; } } @@ -521,7 +509,7 @@ bool MathCursor::Up(bool sel) push(p, false); cursor().idx_ = idx; cursor().pos_ = pos; - dump("Up 4"); + dump("up 4"); return true; } } @@ -537,13 +525,13 @@ bool MathCursor::Up(bool sel) } -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); @@ -602,21 +590,21 @@ bool MathCursor::toggleLimits() } -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(); @@ -637,7 +625,7 @@ void MathCursor::Interpret(string const & s) p->down(true); cursor().idx_ = up ? 0 : 1; cursor().pos_ = 0; - SelPaste(); + selPaste(); return; } @@ -726,115 +714,111 @@ void MathCursor::Interpret(string const & s) } 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; @@ -867,29 +851,28 @@ void MathCursor::drawSelection(Painter & pain) const 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); @@ -900,8 +883,8 @@ void MathCursor::handleAccent(string const & name, int code) 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); @@ -910,7 +893,7 @@ void MathCursor::handleDelim(int l, int r) } -void MathCursor::GetPos(int & x, int & y) +void MathCursor::getPos(int & x, int & y) { x = xarray().xo() + xarray().pos2x(cursor().pos_); y = xarray().yo(); @@ -919,13 +902,13 @@ void MathCursor::GetPos(int & x, int & y) 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); } @@ -947,33 +930,33 @@ int MathCursor::pos() const } -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_; } @@ -996,7 +979,7 @@ void MathCursor::pullArg(bool goright) dump("pullarg"); MathArray a = array(); if (pop()) { - array().erase(cursor().pos_); + plainErase(); array().insert(cursor().pos_, a); if (goright) cursor().pos_ += a.size(); @@ -1042,9 +1025,9 @@ int MathCursor::row() const /* -char MathCursorPos::GetChar() const +char MathCursorPos::getChar() const { - return array().GetChar(cursor().pos_); + return array().getChar(cursor().pos_); } @@ -1053,7 +1036,7 @@ string MathCursorPos::readString() string s; int code = nextCode(); for ( ; OK() && nextCode() == code; Next()) - s += GetChar(); + s += getChar(); return s; } diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index 766cc1c26d..8b796cc82a 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -78,17 +78,17 @@ public: /// 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 @@ -98,13 +98,13 @@ public: /// 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 @@ -115,36 +115,36 @@ public: /// 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; /// @@ -197,17 +197,15 @@ public: 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; @@ -264,9 +262,6 @@ public: MathScriptInset * prevScriptInset() const; /// MathSpaceInset * prevSpaceInset() const; - - /// - MathFuncInset * imacro; }; extern MathCursor * mathcursor; diff --git a/src/mathed/math_matrixinset.C b/src/mathed/math_matrixinset.C index fec3f1ea11..d8a60c2bce 100644 --- a/src/mathed/math_matrixinset.C +++ b/src/mathed/math_matrixinset.C @@ -70,7 +70,7 @@ int firstRelOp(MathArray const & array) { 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(); } diff --git a/src/mathed/xarray.C b/src/mathed/xarray.C index ae078a1921..636ef7d8a4 100644 --- a/src/mathed/xarray.C +++ b/src/mathed/xarray.C @@ -42,8 +42,8 @@ void MathXArray::metrics(MathStyles st) 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); @@ -69,8 +69,8 @@ void MathXArray::draw(Painter & pain, int x, int y) 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); @@ -113,7 +113,7 @@ int MathXArray::width(int pos) const 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)