void MathedCursor::SetPar(MathParInset * p)
{
- win = 0;
- is_visible = False;
macro_mode = false;
selection = false; // not SelClear() ?
mathstk.Reset();
bool MathedCursor::Left(bool sel)
{
if (macro_mode) {
- MacroModeBack();
+ // was MacroModeBack()
+ if (!imacro->GetName().empty()) {
+ imacro->SetName(imacro->GetName()
+ .substr(0, imacro->GetName()
+ .length() - 1));
+ imacro->Metrics();
+ } else
+ MacroModeClose();
return true;
}
result = true;
if (selection)
SelClear();
- } else
- if (result && cursor->IsActive()) {
+ } else if (result && cursor->IsActive()) {
if (cursor->IsScript()) {
cursor->Prev();
if (!cursor->IsScript())
MathMatrixInset * mt = create_multiline(type, cols);
mt->SetStyle(LM_ST_DISPLAY);
mt->SetType(type);
- mt->SetData(p->GetData());
- p->SetData(0); // BUG duda
+ mt->setData(p->GetData());
+ p->setData(0); // BUG duda
delete p;
par = mt;
p = mt;
} else {
if (macro_mode) {
if (MathIsAlphaFont(t) || t == LM_TC_MIN) {
- MacroModeInsert(c);
+ // was MacroModeInsert(c);
+ imacro->SetName(imacro->GetName() + static_cast<char>(c));
return;
}
}
if (selection) {
if (MathIsActive(t)) {
SelCut();
- static_cast<MathParInset*>(p)->SetData(selarray);
+ static_cast<MathParInset*>(p)->setData(selarray);
} else
SelDel();
}
void MathedCursor::Interpret(string const & s)
{
MathedInset * p = 0;
- latexkeys * l = 0;
+ latexkeys const * l = 0;
MathedTextCodes tcode = LM_TC_INSET;
if (s[0] == '^' || s[0] == '_') {
if (!p) {
lyxerr[Debug::MATHED] << "Macro2 " << s << ' ' << tcode << endl;
if (s == "root") {
- p = new MathRootInset();
+ p = new MathRootInset;
tcode = LM_TC_ACTIVE_INSET;
} else
p = new MathFuncInset(s, LM_OT_UNDEF);
return false;
MathedArray * a = p->GetData();
- p->SetData(0);
+ p->setData(0);
Delete();
if (a) {
cursor->Merge(a);
{
if (macro_mode) {
macro_mode = false;
- latexkeys * l = in_word_set(imacro->GetName());
+ latexkeys const * l = in_word_set(imacro->GetName());
if (!imacro->GetName().empty()
&& (!l || (l && IsMacro(l->token, l->id))) &&
!MathMacroTable::mathMTable.getMacro(imacro->GetName())) {
}
-void MathedCursor::MacroModeBack()
-{
- if (macro_mode) {
- if (!imacro->GetName().empty()) {
- imacro->SetName(
- imacro->GetName().substr(0, imacro->GetName().length() - 1));
- imacro->Metrics();
- } else
- MacroModeClose();
- } else
- lyxerr << "Mathed Warning: we are not in macro mode" << endl;
-}
-
-
-void MathedCursor::MacroModeInsert(char c)
-{
- if (macro_mode) {
- imacro->SetName(imacro->GetName() + c);
- imacro->Metrics();
- } else
- lyxerr << "Mathed Warning: we are not in macro mode" << endl;
-}
-
-
void MathedCursor::SelCopy()
{
if (selection) {