Ejemplo n.º 1
0
void Cursor::setDocumentHeight(int height, int currentCursorBlock, int currentScrollBackHeight)
{
    Q_UNUSED(currentCursorBlock);
    resetScrollArea();
    if (m_document_height > height) {
        const int to_remove = m_document_height - height;
        const int removeLinesBelowCursor =
            std::min(m_document_height - new_y(), to_remove);
        const int removeLinesAtTop = to_remove - removeLinesBelowCursor;
        if (!removeLinesAtTop) {
            new_ry() -= removeLinesAtTop;
            notifyChanged();
        }
    } else {
        int height_diff = height - m_document_height;
        if (currentScrollBackHeight >= height_diff) {
            new_ry() += height_diff;
        } else if (currentScrollBackHeight > 0) {
            const int move = height_diff - currentScrollBackHeight;
            new_ry() += move;
        }
    }

    m_document_height = height;

    if (new_y() >= height) {
        new_ry() = height - 1;
        notifyChanged();
    }
    if (new_y() <= 0) {
        new_ry() = 0;
    }
}
Ejemplo n.º 2
0
void EditNotifyDialog::slotOk()
{
    int id = m_networkNameCombo->itemData(m_networkNameCombo->currentIndex()).toInt();
    if (id == -1)
    {
      // add nickname to every server
      for (int i = 1; i < m_networkNameCombo->count(); ++i)
        emit notifyChanged(m_networkNameCombo->itemData(i).toInt(), m_nicknameInput->text());
    }
    else
      emit notifyChanged(id, m_nicknameInput->text());
    delayedDestruct();
}
Ejemplo n.º 3
0
bool GGConditionPage::removeConnection(GGConnection *connection)
{
    Q_ASSERT(connection && connection->source() == this);
    if (connection == m_true) {
        m_true = NULL;
        notifyChanged(GGAbstractModel::Connections);
        return true;
    }
    if (connection == m_false) {
        m_false = NULL;
        notifyChanged(GGAbstractModel::Connections);
        return true;
    }
    return false;
}
Ejemplo n.º 4
0
void GGConditionPage::setFalseConnection(GGConnection *f)
{
    if (f != m_false) {
        m_false = f;
        notifyChanged(GGAbstractModel::Connections);
    }
}
Ejemplo n.º 5
0
void GGConditionPage::setTrueConnection(GGConnection *t)
{
    if (t != m_true) {
        m_true = t;
        notifyChanged(GGAbstractModel::Connections);
    }
}
Ejemplo n.º 6
0
void Cursor::replaceAtCursor(const QByteArray &data)
{
    //if (m_selection_valid ) {
    //    if (current_cursor_new_y() >= m_selection_start.new_y() && current_cursor_new_y() <= m_selection_end.new_y())
    //        //don't need to schedule as event since it will only happen once
    //        setSelectionEnabled(false);
    //}

    const QString text = m_gl_text_codec->toUnicode(data);

    if (new_x() + text.size() <= m_screen->width()) {
        Block *block = screen_data()->blockContainingLine(new_y());
        block->replaceAtPos(new_x(), text, m_current_text_style);
        new_rx() += text.size();
    } else if (m_wrap_around) {
        Block *block = screen_data()->blockContainingLine(new_y());
        block->replaceAtPos(new_x(), text, m_current_text_style);
        int line_feeds = (new_x() + text.size()) / m_screen->width();
        new_rx() = (new_x() + text.size()) % m_screen->width();
        for (int i = 0; i < line_feeds; i++) {
            lineFeed();
        }
    }else {
        const int size = m_document_width - new_x();
        QString toBlock = text.mid(0,size);
        toBlock.replace(toBlock.size() - 1, 1, text.at(text.size()-1));
        Block *block = screen_data()->blockContainingLine(new_y());
        block->replaceAtPos(new_x(),toBlock, m_current_text_style);
        new_rx() += toBlock.size();
    }
    if (new_x() >= m_document_width)
        new_rx() = m_document_width - 1;
    notifyChanged();
}
Ejemplo n.º 7
0
void GGPage::setName(QString n)
{
    if (n != m_name) {
        m_name = n;
        notifyChanged(GGAbstractModel::PageData);
    }
}
Ejemplo n.º 8
0
void GGContentPage::setCaption(QString cap)
{
    if (m_caption != cap) {
        m_caption = cap;
        notifyChanged(GGAbstractModel::Caption);
    }
}
Ejemplo n.º 9
0
PyObject *PyLink::getRotationAxis()
{
    boost::python::list retval;
    VectorToPyList(a, retval);
    notifyChanged();
    return boost::python::incref(retval.ptr());
}
Ejemplo n.º 10
0
void GGStartPage::setStartConnection(GGConnection *conn)
{
    if (conn != m_conn) {
        m_conn = conn;
        notifyChanged(GGAbstractModel::Connections);
    }
}
Ejemplo n.º 11
0
URegistryKey
ICUService::registerFactory(ICUServiceFactory* factoryToAdopt, UErrorCode& status) 
{
    if (U_SUCCESS(status) && factoryToAdopt != NULL) {
        Mutex mutex(&lock);

        if (factories == NULL) {
            factories = new UVector(deleteUObject, NULL, status);
            if (U_FAILURE(status)) {
                delete factories;
                return NULL;
            }
        }
        factories->insertElementAt(factoryToAdopt, 0, status);
        if (U_SUCCESS(status)) {
            clearCaches();
        } else {
            delete factoryToAdopt;
            factoryToAdopt = NULL;
        }
    }

    if (factoryToAdopt != NULL) {
        notifyChanged();
    }

    return (URegistryKey)factoryToAdopt;
}
Ejemplo n.º 12
0
void Cursor::setScreenWidth(int newWidth, int removedBeginning, int reclaimed)
{
    if (newWidth > m_screen_width) {
        for (int i = m_screen_width -1; i < newWidth; i++) {
            if (i % 8 == 0) {
                m_tab_stops.append(i);
            }
        }
    }

    m_screen_width = newWidth;

    auto it = m_screen->currentScreenData()->it_for_block(m_resize_block);
    if (m_screen->currentScreenData()->it_is_end(it)) {
        if (removedBeginning > reclaimed) {
            new_ry() = 0;
            new_rx() = 0;
        } else {
            new_ry() = m_screen_height - 1;
            new_rx() = 0;
        }
    } else {
        new_ry() = (*it)->screenIndex() + m_current_pos_in_block / newWidth;
        new_rx() = m_current_pos_in_block % newWidth;
    }
    m_resize_block = 0;
    m_current_pos_in_block = 0;
    notifyChanged();
}
Ejemplo n.º 13
0
void Cursor::move(int new_x, int new_y)
{
    int width = m_screen->width();

    if (m_origin_at_margin) {
        new_y += m_top_margin;
    }

    if (new_x < 0) {
        new_x = 0;
    } else if (new_x >= width) {
        new_x = width - 1;
    }

    if (new_y < adjusted_top()) {
        new_y = adjusted_top();
    } else if (new_y > adjusted_bottom()) {
        new_y = adjusted_bottom();
    }

    if (this->new_y() != new_y || this->new_x() != new_x) {
        m_new_position = QPoint(new_x, new_y);
        notifyChanged();
    }
}
Ejemplo n.º 14
0
void RenderableLightEntityItem::checkFading() {
    bool transparent = isTransparent();
    if (transparent != _prevIsTransparent) {
        notifyChanged();
        _isFading = false;
        _prevIsTransparent = transparent;
    }
}
Ejemplo n.º 15
0
void
SimpleActionsModel::addNewElement(QString& t)
{
    this->beginInsertRows(QModelIndex(), 0, 0);
    this->entries_.prepend(t);
    emit(notifyChanged());
    this->endInsertRows();
}
Ejemplo n.º 16
0
void GGContentPage::setContent(GGContentElement *cont)
{
    if (m_content != cont) {
        delete m_content;
        m_content = cont;
        notifyChanged(GGAbstractModel::Content);
    }
}
Ejemplo n.º 17
0
void Cursor::lineFeed()
{
    if(new_y() >= bottom()) {
        screen_data()->insertLine(bottom(), top());
    } else {
        new_ry()++;
        notifyChanged();
    }
}
Ejemplo n.º 18
0
void Cursor::reverseLineFeed()
{
    if (new_y() == top()) {
        scrollUp(1);
    } else {
        new_ry()--;
        notifyChanged();
    }
}
Ejemplo n.º 19
0
void PyBody::setPosture(PyObject *v)
{
    if (PySequence_Size(v) != numJoints()) return;
    for (unsigned int i=0; i<numJoints(); i++) {
        hrp::Link *j = joint(i);
        if (j) j->q = boost::python::extract<double>(PySequence_GetItem(v, i));
    }
    notifyChanged(KINEMATICS);
}
Ejemplo n.º 20
0
GGContentElement *GGContentPage::exchangeContent(GGContentElement *cont)
{
    if (m_content != cont) {
        GGContentElement *oldContent = m_content;
        m_content = cont;
        notifyChanged(GGAbstractModel::Content);
        return oldContent;
    }
    return cont;
}
Ejemplo n.º 21
0
void 
ICUService::reset() 
{
    {
        Mutex mutex(&lock);
        reInitializeFactories();
        clearCaches();
    }
    notifyChanged();
}
Ejemplo n.º 22
0
void Cursor::moveLeft(int positions)
{
    if (!new_x() || !positions)
        return;
    if (positions < new_x()) {
        new_rx() -= positions;
    } else {
        new_rx() = 0;
    }
    notifyChanged();
}
Ejemplo n.º 23
0
void UserData::setNotify(int id, int value)
{
    QSqlQuery notify_query(p->db);
    notify_query.prepare("INSERT OR REPLACE INTO notifysettings (id,value) VALUES (:id,:val)");
    notify_query.bindValue(":id",id);
    notify_query.bindValue(":val",value);
    notify_query.exec();
    CHECK_QUERY_ERROR(notify_query);

    p->notifies.insert(id,value);
    emit notifyChanged(id, value);
}
Ejemplo n.º 24
0
void PyLink::setRelPosition(PyObject *v)
{
    if (PySequence_Size(v) != 3) return;
    if (parent){
        PyListToVector(v, b);
        GLcoordinates::setPosition(b);
    }else{
        PyListToVector(v, p);
        GLcoordinates::setPosition(p);
    }
    notifyChanged();
}
Ejemplo n.º 25
0
bool
SimpleActionsModel::removeRows(int row, int c, const QModelIndex& parent)
{
    this->beginRemoveRows(parent, row, row + 1);
    this->entries_.removeAt(row);
    emit(notifyChanged());
    this->endRemoveRows();

    return true;

    Q_UNUSED(c);
}
Ejemplo n.º 26
0
void Cursor::moveRight(int positions)
{
    int width = m_screen->width();
    if (new_x() == width -1 || !positions)
        return;
    if (positions < width - new_x()) {
        new_rx() += positions;
    } else {
        new_rx() = width -1;
    }

    notifyChanged();
}
Ejemplo n.º 27
0
Zerobuf& Zerobuf::operator = ( const Zerobuf& rhs )
{
    if( this == &rhs || !_allocator || !rhs._allocator )
        return *this;

    if( getTypeIdentifier() != rhs.getTypeIdentifier( ))
        throw std::runtime_error( "Can't assign Zerobuf of a different type" );

    _allocator->copyBuffer( rhs._allocator->getData(),
                            rhs._allocator->getSize( ));
    notifyChanged();
    return *this;
}
Ejemplo n.º 28
0
void Cursor::moveToCharacter(int character)
{
    const int width = m_screen->width();
    if (character < 0) {
        character = 1;
    } else if (character > width) {
        character = width;
    }
    if (character != new_x()) {
        new_rx() = character;
        notifyChanged();
    }
}
Ejemplo n.º 29
0
void Cursor::moveUp(int lines)
{
    int adjusted_new_y = this->adjusted_new_y();
    if (!adjusted_new_y || !lines)
        return;

    if (lines < adjusted_new_y) {
        new_ry() -= lines;
    } else {
        new_ry() = adjusted_top();
    }
    notifyChanged();
}
Ejemplo n.º 30
0
void Cursor::moveDown(int lines)
{
    int bottom = adjusted_bottom();
    if (new_y() == bottom || !lines)
        return;

    if (new_y() + lines <= bottom) {
        new_ry() += lines;
    } else {
        new_ry() = bottom;
    }
    notifyChanged();
}