コード例 #1
0
void DTViewClass::menuSelected( const MIMenuID & id )
//---------------------------------------------------
{
#ifdef DETAIL_STUFF_IMPLEMENTED
    switch( id.mainID() ) {
    case MMDetail:
        switch( id.subID() ) {
        case DMInheritance:
            viewManager()->showDetailView( _symbol, ViewInherit );
            break;
        case DMStructure:
            viewManager()->showDetailView( _symbol, ViewStructure );
            break;
        }
    }
#endif

    DTViewSymbol::menuSelected( id );
}
コード例 #2
0
ファイル: browse.cpp プロジェクト: Azarien/open-watcom-v2
void Browse::setupMenus()
//-----------------------
{
    int i;

    menuManager()->setupMenus( this );

    for( i = 0; i < NumBrowseMenus; i += 1 ) {
        menuManager()->registerForMenu( this, BrowseMenus[ i ] );
    }

    viewManager()->setMenus( menuManager() );
    optManager()->setMenus( menuManager() );
    dbManager()->setMenus( menuManager() );

    menuManager()->registerForViewEvents( viewManager() );

    viewManager()->enableMenus( false );
}
コード例 #3
0
// public virtual [base kpCommand]
void kpToolTextBackspaceCommand::execute ()
{
    viewManager ()->setTextCursorPosition (m_row, m_col);

    m_deletedText.clear ();
    int oldNumBackspaces = m_numBackspaces;
    m_numBackspaces = 0;

    for (int i = 0; i < oldNumBackspaces; i++)
        addBackspace ();
}
コード例 #4
0
ファイル: gbvlist.cpp プロジェクト: ArmstrongJ/open-watcom-v2
void GlobalViewList::toggleDetail( WWindow * )
//--------------------------------------------
{
    WRect           rect;
    int             sel = selected();
    Symbol *        sym;
    DetailView *    dtv;

    sym = getSymbol( sel );
    if( sym ) {
        dtv = viewManager()->findDetailView( sym, DetailView::ViewDetail );

        if( !dtv ) {
            popDetail( sym );
        } else {
            dtv->aboutToClose();
            viewManager()->kill();
        }
    }
}
コード例 #5
0
kpToolTextBackspaceCommand::kpToolTextBackspaceCommand (const QString &name,
    int row, int col, Action action,
    kpCommandEnvironment *environ)
    : kpNamedCommand (name, environ),
      m_row (row), m_col (col),
      m_numBackspaces (0)
{
    viewManager ()->setTextCursorPosition (m_row, m_col);

    if (action == AddBackspaceNow)
        addBackspace ();
}
コード例 #6
0
void DesignDocument::updateFileName(const QString & /*oldFileName*/, const QString &newFileName)
{
    if (m_documentModel)
        m_documentModel->setFileUrl(QUrl::fromLocalFile(newFileName));

    if (m_inFileComponentModel)
        m_inFileComponentModel->setFileUrl(QUrl::fromLocalFile(newFileName));

    viewManager().setItemLibraryViewResourcePath(QFileInfo(newFileName).absolutePath());

    emit displayNameChanged(displayName());
}
コード例 #7
0
ファイル: gbvlist.cpp プロジェクト: ArmstrongJ/open-watcom-v2
void GlobalViewList::menuSelected( const MIMenuID & id )
//------------------------------------------------------
{
    switch( id.mainID() ) {
    case MMDetail:
        if( selected() >= 0 ) {
            Symbol * sym = getSymbol( selected() );
            switch( id.subID() ) {
            case DMDetail:
                popDetail( sym );
                break;
            case DMDefinition:
                browseTop->showSource( sym );
                break;
            case DMReferences:
                viewManager()->showDetailView( sym, DetailView::ViewSourceRefs );
                break;
            case DMUsers:
                viewManager()->showDetailView( sym, DetailView::ViewSymbolRefs );
                break;
            }
        }
        break;
    case MMLocate:
        switch( id.subID() ) {
        case LMFind:
            findFirst();
            break;

        case LMFindNext:
            findNext();
            break;

        case LMFindSelected:
            scrollToSelected();
            break;
        }
        break;
    }
}
コード例 #8
0
ファイル: dtvclass.cpp プロジェクト: ABratovic/open-watcom-v2
DTViewClass::DTViewClass( const Symbol * sym )
                : DTViewSymbol( sym, TRUE )
                , _filter( optManager()->getMemberFilter() )
//--------------------------------------------------------------
{
    _members = new WCPtrSortedVector<ClassMember>;

    _symbolBox->onDblClick( this, (cbw) &DTViewClass::elementClicked );

    viewManager()->registerForEvents( this );

    load();
}
コード例 #9
0
void DesignDocument::goIntoSelectedComponent()
{
    if (currentModel())
        return;

    QList<ModelNode> selectedNodes;
    if (rewriterView())
        selectedNodes = qmlModelView()->selectedModelNodes();

    if (selectedNodes.count() == 1) {
        viewManager().setComponentNode(selectedNodes.first());
        ModelNodeOperations::goIntoComponent(selectedNodes.first());
    }
}
コード例 #10
0
ファイル: dtvfunc.cpp プロジェクト: ABratovic/open-watcom-v2
void DTViewFunction::menuSelected( const MIMenuID & id )
//------------------------------------------------------
{
#ifdef DETAIL_STUFF_IMPLEMENTED
    switch( id.mainID() ) {
    case MMDetail:
        switch( id.subID() ) {
        case DMCalls:
            viewManager()->showDetailView( _symbol, ViewCalls );
            break;
        }
    }
#endif

    DTViewSymbol::menuSelected( id );
}
コード例 #11
0
// public
void kpToolTextEnterCommand::addEnter ()
{
    QList <QString> textLines = textSelection ()->textLines ();

    const QString rightHalf = textLines [m_row].mid (m_col);

    textLines [m_row].truncate (m_col);
    textLines.insert (textLines.begin () + m_row + 1, rightHalf);

    textSelection ()->setTextLines (textLines);

    m_row++;
    m_col = 0;

    viewManager ()->setTextCursorPosition (m_row, m_col);

    m_numEnters++;
}
コード例 #12
0
// protected
void kpToolText::handleDownKeyPress (QKeyEvent *e,
    const QList <QString> &textLines, int cursorRow, int cursorCol)
{
#if DEBUG_KP_TOOL_TEXT
    qCDebug(kpLogTools) << "\tdown pressed";
#endif

    if (hasBegunShape ())
        endShape (currentPoint (), normalizedRect ());

    if (!textLines.isEmpty () && cursorRow < (int) textLines.size () - 1)
    {
        cursorRow++;
        cursorCol = qMin (cursorCol, (int) textLines [cursorRow].length ());
        viewManager ()->setTextCursorPosition (cursorRow, cursorCol);
    }

    e->accept ();
}
コード例 #13
0
ファイル: outline.cpp プロジェクト: Azarien/open-watcom-v2
Outline::Outline( const char * text )
        : HotWindowList( text )
        , GlobalViewTree( menuManager() )
        , _findStack( NULL )
//----------------------------------------------------------------
{
    _sentinel = new OutlineElement;
    _queryConfig = new QueryConfig( this, "Find" );
    _findFilter = new KeySymbol;
    _loadFilter = new KeySymbol( WBRWinBase::optManager()->getQueryFilt() );

    onHotPress( this, (cbw) &Outline::toggleExpand );
    onDblClick( this, (cbw) &Outline::detailView );
    onChanged( this, (cbw) &Outline::changed );

    menuManager()->trackPopup( this, MMTree );
    viewManager()->registerForEvents( this );

    resetCache();
}
コード例 #14
0
// protected
void kpToolText::handleEndKeyPress (QKeyEvent *e,
    const QList <QString> &textLines, int cursorRow, int cursorCol)
{
#if DEBUG_KP_TOOL_TEXT
    qCDebug(kpLogTools) << "\tend pressed";
#endif

    if (hasBegunShape ())
        endShape (currentPoint (), normalizedRect ());

    if (!textLines.isEmpty ())
    {
        if (e->modifiers () & Qt::ControlModifier)
            cursorRow = textLines.size () - 1;
    
        cursorCol = textLines [cursorRow].length ();
    
        viewManager ()->setTextCursorPosition (cursorRow, cursorCol);
    }

    e->accept ();
}
コード例 #15
0
ファイル: gbvlist.cpp プロジェクト: ArmstrongJ/open-watcom-v2
GlobalViewList::GlobalViewList( const char * text )
            : HotWindowList( text, true,
                             WBRWinStyleDefault
                                | (WStyleVScroll | WStyleVRows )
                                | WStyleVRows
                                | WStyleVScrollEvents
                                | WStyleHScrollAll )
            , _full( false )
//-------------------------------------------------------------------
{
    _findFilter = new KeySymbol;
    _queryConfig = new QueryConfig( _findFilter, this, "Find" );
    _pages = new WVList;

    viewManager()->registerForEvents( this );
    onDblClick( this, (cbw) &GlobalViewList::toggleDetail );
    onHotPress( this, (cbw) &GlobalViewList::toggleDetail );
    onChanged( this, (cbw) &GlobalViewList::changed );
    setIcon( GBList );

    reLoad();
    show();
}
コード例 #16
0
ファイル: browse.cpp プロジェクト: Azarien/open-watcom-v2
bool Browse::reallyClose()
//------------------------
{
    if( optManager()->exit() ) {
        viewManager()->eventOccured( VEBrowseTopDying, NULL );

        delete _status;
        _status = NULL;

        delete _helpInfo;
        _helpInfo = NULL;

        if( _editorDLL != NULL) {
            _editorDLL->EDITDisconnect();
        }
        delete _editorDLL;
        _editorDLL = NULL;

        return true;
    } else {
        return false;
    }
}
コード例 #17
0
// public
void kpToolTextBackspaceCommand::addBackspace ()
{
    QList <QString> textLines = textSelection ()->textLines ();

    if (m_col > 0)
    {
        m_deletedText.prepend (textLines [m_row][m_col - 1]);

        textLines [m_row] = textLines [m_row].left (m_col - 1) +
                            textLines [m_row].mid (m_col);
        m_col--;
    }
    else
    {
        if (m_row > 0)
        {
            int newCursorRow = m_row - 1;
            int newCursorCol = textLines [newCursorRow].length ();

            m_deletedText.prepend ('\n');

            textLines [newCursorRow] += textLines [m_row];

            textLines.erase (textLines.begin () + m_row);

            m_row = newCursorRow;
            m_col = newCursorCol;
        }
    }

    textSelection ()->setTextLines (textLines);

    viewManager ()->setTextCursorPosition (m_row, m_col);

    m_numBackspaces++;
}
コード例 #18
0
// public slot virtual [base kpView]
void kpUnzoomedThumbnailView::adjustToEnvironment ()
{
    if (!buddyView () || !buddyViewScrollableContainer () || !document ())
        return;

    const int scrollViewContentsX =
        buddyViewScrollableContainer()->horizontalScrollBar()->value();
    const int scrollViewContentsY =
        buddyViewScrollableContainer ()->verticalScrollBar()->value();

#if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW
    qCDebug(kpLogViews) << "kpUnzoomedThumbnailView(" << name ()
               << ")::adjustToEnvironment("
               << scrollViewContentsX
               << ","
               << scrollViewContentsY
               << ") width=" << width ()
               << " height=" << height ()
               << endl;
#endif


#if 1
    int x;
    if (document ()->width () > width ())
    {
        x = (int) buddyView ()->transformViewToDocX (scrollViewContentsX);
        const int rightMostAllowedX = qMax (0, document ()->width () - width ());
    #if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW
        qCDebug(kpLogViews) << "\tdocX=" << x
                << " docWidth=" << document ()->width ()
                << " rightMostAllowedX=" << rightMostAllowedX
                << endl;
    #endif
        if (x > rightMostAllowedX)
            x = rightMostAllowedX;
    }
    // Thumbnail width <= doc width
    else
    {
        // Center X (rather than flush left to be consistent with
        //           kpZoomedThumbnailView)
        x = -(width () - document ()->width ()) / 2;
    }


    int y;
    if (document ()->height () > height ())
    {
        y = (int) buddyView ()->transformViewToDocY (scrollViewContentsY);
        const int bottomMostAllowedY = qMax (0, document ()->height () - height ());
    #if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW
        qCDebug(kpLogViews) << "\tdocY=" << y
                    << " docHeight=" << document ()->height ()
                    << " bottomMostAllowedY=" << bottomMostAllowedY
                    << endl;
    #endif
        if (y > bottomMostAllowedY)
            y = bottomMostAllowedY;
    }
    // Thumbnail height <= doc height
    else
    {
        // Center Y (rather than flush top to be consistent with
        //           kpZoomedThumbnailView)
        y = -(height () - document ()->height ()) / 2;
    }
// Prefer to keep visible area centred in thumbnail instead of flushed left.
// Gives more editing context to the left and top.
// But feels awkward for left-to-right users.  So disabled for now.
// Not totally tested.
#else
    if (!buddyViewScrollableContainer ())
        return;

    QRect docRect = buddyView ()->transformViewToDoc (
        QRect (buddyViewScrollableContainer ()->horizontalScrollBar()->value(),
               buddyViewScrollableContainer ()->verticalScrollBar()->value(),
               qMin (buddyView ()->width (), buddyViewScrollableContainer ()->viewport()->width ()),
               qMin (buddyView ()->height (), buddyViewScrollableContainer ()->viewport()->height ())));

    x = docRect.x () - (width () - docRect.width ()) / 2;
    qCDebug(kpLogViews) << "\tnew suggest x=" << x;
    const int rightMostAllowedX = qMax (0, document ()->width () - width ());
    if (x < 0)
        x = 0;
    if (x > rightMostAllowedX)
        x = rightMostAllowedX;

    y = docRect.y () - (height () - docRect.height ()) / 2;
    qCDebug(kpLogViews) << "\tnew suggest y=" << y;
    const int bottomMostAllowedY = qMax (0, document ()->height () - height ());
    if (y < 0)
        y = 0;
    if (y > bottomMostAllowedY)
        y = bottomMostAllowedY;
#endif


    if (viewManager ())
    {
        viewManager ()->setFastUpdates ();
        viewManager ()->setQueueUpdates ();
    }

    {
        // OPT: scrollView impl would be much, much faster
        setOrigin (QPoint (-x, -y));
        setMaskToCoverDocument ();

        // Above might be a NOP even if e.g. doc size changed so force
        // update
        if (viewManager ())
            viewManager ()->updateView (this);
    }

    if (viewManager ())
    {
        viewManager ()->restoreQueueUpdates ();
        viewManager ()->restoreFastUpdates ();
    }
}
コード例 #19
0
ファイル: outline.cpp プロジェクト: Azarien/open-watcom-v2
void Outline::treeViewEvent( TreeViewEvent event )
//------------------------------------------------
{
    OutlineElement * elm;

    elm = element( selected() );

    switch( event ) {
    case ShowDetail:
        if( elm && elm->_symbol ) {
            popDetail( elm->_symbol );
        }
        break;
    case ShowDefinition:
        if( elm && elm->_symbol ) {
            browseTop->showSource( elm->_symbol );
        }
        break;
    case ShowReferences:
        if( elm && elm->_symbol ) {
            viewManager()->showDetailView( elm->_symbol, DetailView::ViewSourceRefs );
        }
        break;
    case ShowUsers:
        if( elm && elm->_symbol ) {
            viewManager()->showDetailView( elm->_symbol, DetailView::ViewSymbolRefs );
        }
        break;
    case ScrollToSelected:
        scrollToSelected();
        break;
    case SelectRoots:
        selectRoots();
        break;
    case ExpandOne:
        elm->expand( false );
        resetCache();
        reset();    // paranoia
        break;
    case ExpandBranch:
        elm->expand( true );
        resetCache();
        reset();    // paranoia
        break;
    case ExpandAll:
        for( elm = _sentinel->next(); elm != NULL; elm = elm->visibleSib() ) {
            elm->expand( true );
        }
        resetCache();
        reset();    // paranoia
        break;
    case CollapseBranch:
        if( elm->state() == OutlineElement::ESExpanded ) {
            elm->collapse( false );
            resetCache();
            reset();    // paranoia
        }
        break;
    case CollapseAll:
        for( elm = _sentinel->next(); elm != NULL; elm = elm->visibleSib() ) {
            elm->collapse( true );
        }
        resetCache();
        reset();    // paranoia
        break;
    default:
        NODEFAULT;
    }
}
コード例 #20
0
QmlModelView *DesignDocument::qmlModelView()
{
    return viewManager().qmlModelView();
}
コード例 #21
0
// public virtual [base kpCommand]
void kpToolTextGiveContentCommand::execute ()
{
#if DEBUG_KP_TOOL_SELECTION && 1
    qCDebug(kpLogCommands) << "kpToolTextGiveContentCommand::execute()";
#endif

    kpDocument *doc = document ();
    Q_ASSERT (doc);

    kpViewManager *vm = viewManager ();
    Q_ASSERT (vm);

    // See API Doc for kpViewManager::textCursorRow() & textCursorCol().
    Q_ASSERT (vm->textCursorRow () == 0 && vm->textCursorCol () == 0);

    vm->setQueueUpdates ();
    {
        //
        // Recreate border
        //

        // The previously executed command is required to have been a
        // kpToolSelectionCreateCommand, which must have been given a text
        // selection with no content.
        //
        // However, there is a tricky case.  Suppose we are called for the first
        // time, where the above precondition holds.  We would add content
        // to the selection as expected.  But the user then undoes (CTRL+Z) the
        // operation, calling unexecute().  There is now no content again.
        // Since selection is only a border, the user can freely deselect it
        // and/or select another region without changing the command history
        // or document modified state.  Therefore, if they now call us again
        // by redoing (CTRL+Shift+Z), there is potentially no selection at all
        // or it is at an arbitrary location.
        //
        // This assertion covers all 3 possibilities:
        //
        // 1. First call: text selection with no content
        // 2. Later calls:
        //    a) no text selection (due to deselection)
        //    b) text selection with no content, at an arbitrary location
        Q_ASSERT (!textSelection () || !textSelection ()->hasContent ());

        const kpTextSelection *originalTextSel =
            static_cast <const kpTextSelection *> (originalSelection ());
        if (originalTextSel->textStyle () != environ ()->textStyle ())
            environ ()->setTextStyle (originalTextSel->textStyle ());

        doc->setSelection (*originalSelection ());


        //
        // Add Content
        //

        QList <QString> listOfOneEmptyString;
        listOfOneEmptyString.append (QString ());
        textSelection ()->setTextLines (listOfOneEmptyString);
    }
    vm->restoreQueueUpdates ();

    // This should not have changed from the start of the method.
    Q_ASSERT (vm->textCursorRow () == 0 && vm->textCursorCol () == 0);
}
コード例 #22
0
// private
void kpAbstractSelectionTool::setCursorMove ()
{
    viewManager ()->setCursor (Qt::SizeAllCursor);
}
コード例 #23
0
ファイル: designdocument.cpp プロジェクト: gs93/qt-creator
AbstractView *DesignDocument::view()
{
    return viewManager().nodeInstanceView();
}
コード例 #24
0
ファイル: gbvlist.cpp プロジェクト: ArmstrongJ/open-watcom-v2
bool GlobalViewList::losingFocus( WWindow * )
//-------------------------------------------
{
    viewManager()->eventOccured( VELosingFocus, this );
    return false;
}
コード例 #25
0
ファイル: gbvolcll.cpp プロジェクト: ABratovic/open-watcom-v2
bool GBVCallOutline::reallyClose()
//-----------------------------------
{
    viewManager()->viewDying( this );
    return TRUE;
}
コード例 #26
0
// public slot virtual [base kpView]
void kpZoomedThumbnailView::adjustToEnvironment ()
{
#if DEBUG_KP_ZOOMED_THUMBNAIL_VIEW
    kdDebug () << "kpZoomedThumbnailView(" << name ()
               << ")::adjustToEnvironment()"
               << " width=" << width ()
               << " height=" << height ()
               << endl;
#endif

    if (!document ())
        return;

#if DEBUG_KP_ZOOMED_THUMBNAIL_VIEW
    kdDebug () << "\tdoc: width=" << document ()->width ()
               << " height=" << document ()->height ()
               << endl;
#endif

    if (document ()->width () <= 0 || document ()->height () <= 0)
    {
        kdError () << "kpZoomedThumbnailView::adjustToEnvironment() doc:"
                   << " width=" << document ()->width ()
                   << " height=" << document ()->height ()
                   << endl;
        return;
    }


    int hzoom = QMAX (1, width () * 100 / document ()->width ());
    int vzoom = QMAX (1, height () * 100 / document ()->height ());

    // keep aspect ratio
    if (hzoom < vzoom)
        vzoom = hzoom;
    else
        hzoom = vzoom;

#if DEBUG_KP_ZOOMED_THUMBNAIL_VIEW && 1
    kdDebug () << "\tproposed zoom=" << hzoom << endl;
#endif
    if (hzoom > 100 || vzoom > 100)
    {
#if DEBUG_KP_ZOOMED_THUMBNAIL_VIEW && 1
        kdDebug () << "\twon't magnify - setting zoom to 100%" << endl;
#endif
        hzoom = 100, vzoom = 100;
    }


    if (viewManager ())
        viewManager ()->setQueueUpdates ();

    {
        setZoomLevel (hzoom, vzoom);

        setOrigin (QPoint ((width () - zoomedDocWidth ()) / 2,
                           (height () - zoomedDocHeight ()) / 2));
        setMaskToCoverDocument ();

        if (viewManager ())
            viewManager ()->updateView (this);
    }

    if (viewManager ())
        viewManager ()->restoreQueueUpdates ();
}
コード例 #27
0
ファイル: gbvolcll.cpp プロジェクト: ABratovic/open-watcom-v2
bool GBVCallOutline::losingFocus( WWindow * )
//----------------------------------------------
{
    viewManager()->eventOccured( VELosingFocus, this );
    return FALSE;
}
コード例 #28
0
// protected virtual [base kpAbstractSelectionTool]
void kpToolText::keyPressEvent (QKeyEvent *e)
{
#if DEBUG_KP_TOOL_TEXT
    qCDebug(kpLogTools) << "kpToolText::keyPressEvent(e->text='" << e->text () << "')";
#endif


    e->ignore ();


    if (hasBegunDraw ())
    {
    #if DEBUG_KP_TOOL_TEXT
        qCDebug(kpLogTools) << "\talready began draw with mouse - passing on event to kpTool";
    #endif
        kpAbstractSelectionTool::keyPressEvent (e);
        return;
    }


    kpTextSelection * const textSel = document ()->textSelection ();

    if (!textSel)
    {
    #if DEBUG_KP_TOOL_TEXT
        qCDebug(kpLogTools) << "\tno text sel - passing on event to kpTool";
    #endif
        //if (hasBegunShape ())
        //    endShape (currentPoint (), normalizedRect ());

        kpAbstractSelectionTool::keyPressEvent (e);
        return;
    }


    // (All handle.+()'s require this info)
    const QList <QString> textLines = textSel->textLines ();
    const int cursorRow = viewManager ()->textCursorRow ();
    const int cursorCol = viewManager ()->textCursorCol ();


    // TODO: KTextEdit::keyPressEvent() uses KStandardShortcut instead of hardcoding; same fix for kpTool?
    switch (e->key ())
    {
    case Qt::Key_Up:
        handleUpKeyPress (e, textLines, cursorRow, cursorCol);
        break;

    case Qt::Key_Down:
        handleDownKeyPress (e, textLines, cursorRow, cursorCol);
        break;

    case Qt::Key_Left:
        handleLeftKeyPress (e, textLines, cursorRow, cursorCol);
        break;

    case Qt::Key_Right:
        handleRightKeyPress (e, textLines, cursorRow, cursorCol);
        break;


    case Qt::Key_Home:
        handleHomeKeyPress (e, textLines, cursorRow, cursorCol);
        break;

    case Qt::Key_End:
        handleEndKeyPress (e, textLines, cursorRow, cursorCol);
        break;


    case Qt::Key_Backspace:
        handleBackspaceKeyPress (e, textLines, cursorRow, cursorCol);
        break;

    case Qt::Key_Delete:
        handleDeleteKeyPress (e, textLines, cursorRow, cursorCol);
        break;


    case Qt::Key_Enter:
    case Qt::Key_Return:
        handleEnterKeyPress (e, textLines, cursorRow, cursorCol);
        break;


    default:
        handleTextTyped (e, textLines, cursorRow, cursorCol);
        break;
    }


    if (!e->isAccepted ())
    {
    #if DEBUG_KP_TOOL_TEXT
        qCDebug(kpLogTools) << "\tkey processing did not accept (text was '"
                   << e->text ()
                   << "') - passing on event to kpAbstractSelectionTool"
                   << endl;
    #endif
        //if (hasBegunShape ())
        //    endShape (currentPoint (), normalizedRect ());

        kpAbstractSelectionTool::keyPressEvent (e);
        return;
    }
}
コード例 #29
0
ファイル: kptool.cpp プロジェクト: serghei/kde3-kdegraphics
void kpTool::mouseMoveEvent (QMouseEvent *e)
{
#if DEBUG_KP_TOOL && 0
    kdDebug () << "kpTool::mouseMoveEvent pos=" << e->pos ()
               << " btnStateAfter=" << (int) e->stateAfter () << endl;
    kpView *v0 = viewUnderCursor (),
           *v1 = viewManager ()->viewUnderCursor (true/*use Qt*/),
           *v2 = viewUnderStartPoint ();
    kdDebug () << "\tviewUnderCursor=" << (v0 ? v0->name () : "(none)")
               << " viewUnderCursorQt=" << (v1 ? v1->name () : "(none)")
               << " viewUnderStartPoint=" << (v2 ? v2->name () : "(none)")
               << endl;
    kdDebug () << "\tfocusWidget=" << kapp->focusWidget () << endl;
#endif

    Qt::ButtonState buttonState = e->stateAfter ();
    m_shiftPressed = (buttonState & Qt::ShiftButton);
    m_controlPressed = (buttonState & Qt::ControlButton);
    m_altPressed = (buttonState & Qt::AltButton);

    if (m_beganDraw)
    {
        kpView *view = viewUnderStartPoint ();
        if (!view)
        {
            kdError () << "kpTool::mouseMoveEvent() without a view under the start point!" << endl;
            return;
        }

        m_currentPoint = view->transformViewToDoc (e->pos ());
        m_currentViewPoint = e->pos ();

    #if DEBUG_KP_TOOL && 0
        kdDebug () << "\tDraw!" << endl;
    #endif

        bool dragScrolled = false;
        movedAndAboutToDraw (m_currentPoint, m_lastPoint, view->zoomLevelX (), &dragScrolled);

        if (dragScrolled)
        {
            m_currentPoint = currentPoint ();
            m_currentViewPoint = currentPoint (false/*view point*/);

            // Scrollview has scrolled contents and has scheduled an update
            // for the newly exposed region.  If draw() schedules an update
            // as well (instead of immediately updating), the scrollview's
            // update will be executed first and it'll only update part of
            // the screen resulting in ugly tearing of the viewManager's
            // tempPixmap.
            viewManager ()->setFastUpdates ();
        }

        draw (m_currentPoint, m_lastPoint, QRect (m_startPoint, m_currentPoint).normalize ());

        if (dragScrolled)
            viewManager ()->restoreFastUpdates ();

        m_lastPoint = m_currentPoint;
    }
    else
    {
        kpView *view = viewUnderCursor ();
        if (!view)  // possible if cancelShape()'ed but still holding down initial mousebtn
        {
            m_currentPoint = KP_INVALID_POINT;
            m_currentViewPoint = KP_INVALID_POINT;
            return;
        }

        m_currentPoint = view->transformViewToDoc (e->pos ());
        m_currentViewPoint = e->pos ();
        hover (m_currentPoint);
    }
}
コード例 #30
0
ファイル: kptool.cpp プロジェクト: serghei/kde3-kdegraphics
kpView *kpTool::viewUnderCursor () const
{
    kpViewManager *vm = viewManager ();
    return vm ? vm->viewUnderCursor () : 0;
}