Пример #1
0
bool Browse::canEdit()
//--------------------
{
    if( optManager()->isEditorDLL() ) {
        if( _editorDLL != NULL && _editorDLL->isInitialized() ) {
            return true;
        } else {
            return false;
        }
    } else {
        return( optManager()->getEditorName() != NULL );
    }
}
Пример #2
0
void Browse::postTitle()
//----------------------
{
    const char * titleText = "Open Watcom Source Browser";
    WString      title;

    title.printf( "%s -- (%s%s), (%s)", titleText,
                  optManager()->fileName(),
                  (optManager()->isModified()) ? "*" : "",
                  dbManager()->fileName() );

    setText( title );
}
Пример #3
0
Browse::Browse( char * cmdLine )
    : WMdiWindow( "" )
    , _helpInfo( NULL )
    , _status( new WStatWindow( this, WRect(0,0,0,0), "Ready" ) )
    , _editorDLL( NULL )
//---------------------------------------------------------------
{
    WString         errMessage;

    CommandParser   prs( cmdLine, true );
    _searchPath = prs.searchPath();

    WFlashPage *    flash_page = showFlashPage( 0 );

    browseTop = this;
    topWindow = browseTop;
    _helpInfo = new WSystemHelp( this, BrowseTitle, _BrowseHelpFile,
                                 _BrowseHtmlHelpFile );

    setIcon( WBRWIcon );
    setupMenus();
    viewManager()->registerForEvents( this );

    // important that options comes before the database
    // since the option file can set the query and cause a re-load
    // of the inheritance graph

    if( prs.options() ) {
        optManager()->loadFrom( prs.options() );
    } else {
        optManager()->loadDefault();
    }

    // this must come after the option loads
    if( optManager()->isEditorDLL() ) {
        setEditorDLL( optManager()->getEditorName() );
    }

    if( prs.database() ) {
        dbManager()->setModule( prs.database(), prs.files() );
    } else {
        /* if there is no database, disable interesting menus */
        viewManager()->enableMenus( false );
    }

    postTitle();

    delete flash_page;
    show();
    hookF1Key( true );
}
Пример #4
0
void Browse::event( ViewEvent ve, View * )
//----------------------------------------
{
    switch( ve ) {
    case VEOptionValChange:
        if( _editorDLLName != optManager()->getEditorName() ) {
            if( optManager()->isEditorDLL() ) {
                setEditorDLL( optManager()->getEditorName() );
            } else {
            }
        }
        break;
    }
}
Пример #5
0
void DTViewClass::event( ViewEvent ev, View * )
//---------------------------------------------
{
    MemberFilter test = optManager()->getMemberFilter();

    switch( ev ) {
    case VEOptionValChange:
        if( memcmp( &_filter, &test, sizeof( MemberFilter ) ) ) {
            _filter = optManager()->getMemberFilter();
            load();
        }
        break;
    default:
        NODEFAULT;
    }
}
Пример #6
0
void Outline::query()
//-------------------
{
    delete _loadFilter;
    _loadFilter = new KeySymbol( optManager()->getQueryFilt() );
    resetOutline();
    load();             // re-load using new filters
    reset();            // paranoia
}
Пример #7
0
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();
}
Пример #8
0
Symbol * GlobalViewList::getSymbol( int index )
//---------------------------------------------
// FIXME -- have to cast away constness
{
    int             page = IDXTOPAGE( index );
    int             off = IDXTOOFF( index );
    Module *        mod = dbManager()->module();
    KeySymbol *     key = (KeySymbol *) &optManager()->getQueryFilt();
    SearchContext * prev;
    SearchContext * ctxt;
    WVList *        list;
    GBVListPage *   prevPage;
    GBVListPage *   currPage;

    if( index < 0 ) {
        return NULL;
    }

    try {
        while( !full() && _pages->count() <= page ) {
            if( page < 0 || page > _pages->count() ) {
                return NULL;
            } else {
                prevPage = page ? (GBVListPage *)(*_pages)[ page - 1 ] : NULL;
                prev = prevPage ? prevPage->_context : NULL;
            }
            list = new WVList;
            ctxt = mod->findSymbols( list, key, prev, OFFSETMASK + 1 );
            _pages->add( new GBVListPage( ctxt, list ) );

            if( ctxt == NULL ) {
                _full = true;
            }
        }

        if( page < _pages->count() ) {
            currPage = (GBVListPage *)(*_pages)[ page ];
            if( off < currPage->_symbols->count() ) {
                return (Symbol *) (*currPage->_symbols)[ off ];
            }
        }

    } catch( CauseOfDeath cause ) {
        IdentifyAssassin( cause );
    }

    return NULL;
}
Пример #9
0
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 );
}
Пример #10
0
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;
    }
}
Пример #11
0
void Browse::positionEditor( char * fileName, ulong line, uint col,
                             int hiliteLen )
//-----------------------------------------------------------------
{
    FileInfo finf( fileName );

    if( finf.exists() ) {
        if( optManager()->isEditorDLL() ) {
            if( _editorDLL->isInitialized() ) {
                if( _editorDLL->EDITConnect() ) {
                    _editorDLL->EDITFile( fileName, "" );
                    _editorDLL->EDITLocate( line, col, hiliteLen );
                    _editorDLL->EDITShowWindow( EDIT_SHOWNORMAL );
                } else {
                    errMessage( "Unable to connect to editor" );
                }
            } else {
                ASSERTION( 0 /* uh-oh -- the menu item should be grayed */ );
            }
        } else {
            WString cmd( optManager()->getEditorName() );
            WString editorParms( optManager()->getEditorParms() );

            cmd.concat( ' ' ); // space after editor name before parms
            int parmsize = editorParms.size();

            for( int i=0; i < parmsize; i++ ) {
                switch( editorParms[i] ) {
                case '%':
                    switch( editorParms[i+1] ) {
                    case 'f': // file name
                        cmd.concat( fileName );
                        break;
                    case 'r': // row to go to
                        cmd.concatf( "%ld", line );
                        break;
                    case 'c': // column to go to
                        cmd.concatf( "%d", col );
                        break;
                    case 'l': // length of hilight
                        cmd.concatf( "%d", hiliteLen );
                        break;
                    #if 0
                    case 'h': // helpid
                        cmd.concat( x.stringAt( 5 ) );
                        break;
                    case 'e': // error message
                        cmd.concat( x.stringAt( 6 ) );
                        break;
                    #endif
                    case '%': // a real '%'
                        cmd.concat( '%' );
                        break;
                    default:
                        // ignore the '%' and the character
                        break;
                    }
                    i+=2; // skip % and following char
                default:
                    cmd.concat( editorParms[i] );
                    break;
                }
            }
            WSystemService::sysExec( cmd, WWinStateShowNormal, 0 );
        }
    } else {
        errMessage( "File \"%s\" not found", fileName );
    }
}