Esempio n. 1
0
bool FixedElement::moveHorSituation(FormulaCursor& newcursor, FormulaCursor& oldcursor, int pos1, int pos2) {
    if ((newcursor.position()/2==pos1 && newcursor.direction()==MoveUp) ||
        (newcursor.position()/2==pos2 && newcursor.direction()==MoveDown) ||
        (newcursor.position()==2*pos1 && newcursor.direction()==MoveLeft) ||
        (newcursor.position()==2*pos2+1 && newcursor.direction()==MoveRight) ) {
        return false;
    }
    switch (newcursor.direction()) {
    case MoveLeft:
        if (newcursor.position()==2*pos2+1) {
            newcursor.moveTo(newcursor.currentElement()->childElements()[pos2]);
        } else {
            newcursor.moveTo(newcursor.currentElement()->childElements()[pos1]);
        }
        break;
    case MoveRight:
        if (newcursor.position()==2*pos1) {
            newcursor.moveTo(newcursor.currentElement()->childElements()[pos1]);
        } else {
            newcursor.moveTo(newcursor.currentElement()->childElements()[pos2]);
        }
        break;
    case MoveUp:
    case MoveDown:
        return newcursor.moveCloseTo(childElements()[newcursor.direction()==MoveUp ? pos1 : pos2],oldcursor);
    case NoDirection:
        break;
    }
    return true;
}
Esempio n. 2
0
FormulaCursor::FormulaCursor (const FormulaCursor& other )
{
    m_currentElement=other.currentElement();
    m_position=other.position();
    m_mark=other.mark();
    m_selecting=other.isSelecting();
}
Esempio n. 3
0
void FormulaCursor::moveTo ( const FormulaCursor& pos )
{
    m_currentElement=pos.currentElement();
    m_position=pos.position();
    m_selecting=pos.isSelecting();
    m_mark=pos.mark();
}