MathCell* SubCell::Copy() { SubCell* tmp = new SubCell; CopyData(this, tmp); tmp->SetBase(m_baseCell->CopyList()); tmp->SetIndex(m_indexCell->CopyList()); return tmp; }
MathCell* SubCell::Copy(bool all) { SubCell* tmp = new SubCell; CopyData(this, tmp); tmp->SetBase(m_baseCell->Copy(true)); tmp->SetIndex(m_indexCell->Copy(true)); if (all && m_next != NULL) tmp->AppendCell(m_next->Copy(all)); return tmp; }
bool Cell::update(int i, int j) { bool a = false; subCells[i][j].setIsPassed(true); SubCell* sub = &subCells[i][j]; int subSt = sub->getStatus(); if( subSt != settings->posnum-1) { subCells[i][j].setIsUpdated(true); a=true; sub->setStatus(subSt + 1); ++subSt; } if(subSt != 1) { // it isn't the first hit of this subcell - update adjacent subcells. if(i != 0) { if(j != 0 && subCells[i-1][j-1].getIsPassed()==false){ if(update(i-1, j-1)) a=true; } if(j != settings->numOfSubCells-1 && subCells[i-1][j+1].getIsPassed() == false){ if(update(i-1, j+1)) a=true; } if(subCells[i-1][j].getIsPassed() == false){ if(update(i-1, j)) a=true; } } if(i != settings->numOfSubCells - 1) { if(j != 0 && subCells[i+1][j-1].getIsPassed() == false) { if(update(i+1, j-1)) a=true; } if(j != settings->numOfSubCells-1 && subCells[i+1][j+1].getIsPassed() == false) { if(update(i+1, j+1)) a=true; } if(subCells[i+1][j].getIsPassed() == false) { if(update(i+1, j)) a=true; } } if(j != 0 && subCells[i][j-1].getIsPassed() == false) { if(update(i, j-1)) a=true; } if(j != settings->numOfSubCells - 1 && subCells[i][j+1].getIsPassed() == false) { if(update(i, j+1)) a=true; } } return a; }
MathCell* MathParser::ParseSubTag(wxXmlNode* node) { SubCell *sub = new SubCell; wxXmlNode* child = node->GetChildren(); if (child) { sub->SetBase(ParseTag(child, false)); child = child->GetNext(); if (child) { MathCell* index = ParseTag(child, false); index->SetExponentFlag(); sub->SetIndex(index); sub->SetType(m_ParserStyle); sub->SetStyle(TS_VARIABLE); return sub; } } delete sub; return NULL; }