Exemple #1
0
void Foam::primitiveEntry::append
(
    const token& currToken,
    const dictionary& dict,
    Istream& is
)
{
    if (currToken.isWord())
    {
        const word& w = currToken.wordToken();

        if
        (
            w.size() == 1
         || (
                !(w[0] == '$' && expandVariable(w, dict))
             && !(w[0] == '#' && expandFunction(w, dict, is))
            )
        )
        {
            newElmt(tokenIndex()++) = currToken;
        }
    }
    else
    {
        newElmt(tokenIndex()++) = currToken;
    }
}
Exemple #2
0
void QSAEditor::makeFunctionVisible( Q3TextParagraph *p )
{
    if ( p->isVisible() )
	return;
    while ( p && ( (ParagData*)p->extraData() )->lineState != ParagData::FunctionStart )
	p = p->prev();
    if ( !p )
	return;
    expandFunction( p );
}
bool ViewManager::qt_emit( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: markersChanged(); break;
    case 1: expandFunction((QTextParagraph*)static_QUType_ptr.get(_o+1)); break;
    case 2: collapseFunction((QTextParagraph*)static_QUType_ptr.get(_o+1)); break;
    case 3: collapse((bool)static_QUType_bool.get(_o+1)); break;
    case 4: expand((bool)static_QUType_bool.get(_o+1)); break;
    case 5: editBreakPoints(); break;
    case 6: isBreakpointPossible((bool&)static_QUType_bool.get(_o+1),(const QString&)static_QUType_QString.get(_o+2),(int)static_QUType_int.get(_o+3)); break;
    default:
	return QWidget::qt_emit(_id,_o);
    }
    return TRUE;
}
Exemple #4
0
void QSAEditor::expand( bool all /*else only functions*/ )
{
    Q3TextParagraph *p = document()->firstParagraph();
    while ( p ) {
	if ( ( (ParagData*)p->extraData() )->lineState == ParagData::FunctionStart ) {
	    if ( all ||
		 p->string()->toString().simplified().left(QString::fromLatin1("function").length() ) == QString::fromLatin1("function") ||
		 p->string()->toString().simplified().left(QString::fromLatin1("constructor").length() ) == QString::fromLatin1("constructor") ) {
		p = expandFunction( p, false );
		continue;
	    }
	}
	p = p->next();
    }
    doRecalc();
}
void Foam::primitiveEntry::append
(
    const token& currToken,
    const dictionary& dict,
    Istream& is
)
{
    if (currToken.isWord())
    {
        const word& w = currToken.wordToken();

        if
        (
            disableFunctionEntries
         || w.size() == 1
         || (
                !(w[0] == '$' && expandVariable(w, dict))
             && !(w[0] == '#' && expandFunction(w, dict, is))
            )
        )
        {
            newElmt(tokenIndex()++) = currToken;
        }
    }
    else if (currToken.isVariable())
    {
        const string& w = currToken.stringToken();

        if
        (
            disableFunctionEntries
         || w.size() <= 3
         || !(
                w[0] == '$'
             && w[1] == token::BEGIN_BLOCK
             && expandVariable(w, dict)
            )
        )
        {
            newElmt(tokenIndex()++) = currToken;
        }
    }
    else
    {
        newElmt(tokenIndex()++) = currToken;
    }
}
Exemple #6
0
void MarkerWidget::mousePressEvent( QMouseEvent *e )
{
    if ( e->button() != LeftButton )
	return;
    bool supports = ( (Editor*)viewManager->currentView() )->supportsBreakPoints();
    QTextParagraph *p = ( (Editor*)viewManager->currentView() )->document()->firstParagraph();
    int yOffset = ( (Editor*)viewManager->currentView() )->contentsY();
    while ( p ) {
	if ( e->y() >= p->rect().y() - yOffset && e->y() <= p->rect().y() + p->rect().height() - yOffset ) {
	    QTextParagraphData *d = p->extraData();
	    if ( !d )
		return;
	    ParagData *data = (ParagData*)d;
	    if ( supports && ( e->x() < width() - 15 ) ) {
		if ( data->marker == ParagData::Breakpoint ) {
		    data->marker = ParagData::NoMarker;
		} else {
		    bool ok = TRUE;
		    isBreakpointPossible( ok, ( (Editor*)viewManager->currentView() )->text(), p->paragId() );
		    if ( ok )
			data->marker = ParagData::Breakpoint;
		    else
			emit showMessage( tr( "<font color=red>Can't set breakpoint here!</font>" ) );
		}
	    } else {
		if ( data->lineState == ParagData::FunctionStart ) {
		    if ( data->functionOpen )
			emit collapseFunction( p );
		    else
			emit expandFunction( p );
		}
	    }
	    break;
	}
	p = p->next();
    }
    doRepaint();
    emit markersChanged();
}