Exemple #1
0
void VMsgLog::addLine( const WString& str, bool newline )
{
    if( str.match( "cd *" ) ) {
        if( str == lastCD ) {
            return;
        }
        lastCD = str;
    }
//drw    int length = str.size();
//drw    if( length > _maxLength ) {
//drw   _maxLength = length;
//drw   _batcher->setExtent( _batcher->getTextExtentX( str ) + WSystemMetrics::vScrollBarWidth() );
//drw    }
    if( _data.count() > 999 ) {
        delete _data.removeAt( 0 );
        _batcher->deleteString( 0 );
    }
    WString* s = new WString( str );
    if( !newline ) {
        int dcount = _data.count();
        if( dcount > 0 ) {
            delete _data.removeAt( dcount - 1 );
        }
        int bcount = _batcher->count();
        if( bcount > 0 ) {
            _batcher->deleteString( bcount - 1 );
        }
    }
    _data.add( s );
    _batcher->insertString( *s );
    _batcher->select( _batcher->count() -1 );
//    _batcher->update();
}
Exemple #2
0
bool VMsgLog::matchLine( int index, char* file, int& line, int& offset, char* help )
{
    file[0] = '\0';     line = 0; offset = 0; help[0] = '\0';
    for( int i=0; i<_config->logScanPatterns().count(); i++ ) {
        WString& p = *(WString*)_config->logScanPatterns()[i];
        if( matchPattern( p, index, file, line, offset, help ) ) {
            WFileName f( file );
            while( index > 0 ) {
                index --;
                WString* data = (WString*)_data[index];
                if( data->match( "cd *" ) ) {
                    WString dir( &(*data)[3] );
                    int dirLen = dir.size()-1;
                    if( dir[dirLen] != '\\' ) {
                        dir.concat( '\\' );
                    }
                    f.absoluteTo( dir );
                    strcpy( file, f );
                    break;
                }
            }
            return TRUE;
        }
    }
    return FALSE;
}