newntui/discovermdi/src/dockablebrowser.cpp
//----------------------------------------------------------------------------
// This callback runs every time the user doubleclicked the file in the project
// modules window
//----------------------------------------------------------------------------
This callback runs every time the user doubleclicked the file in the project
modules window
This callback runs every time the user doubleclicked the file in the project modules window
void CDockableBrowser::OnFileDoubleclicked(LPCTSTR element)  {
CString serverQuery;
CString filename;
CString viewable;
CString kind;
BSTR query;
    CDataSource* DataSource;
	DataSource = (CDataSource *)     GetDlgItem(IDC_DATASOURCE);
	if(DataSource==NULL) return;
	CCodeRoverIntegrator* integrator=(CCodeRoverIntegrator*) GetDlgItem(IDC_CODEROVERINTEGRATORCTRL);
	if(integrator==NULL) return;
    serverQuery.Format("viewable %s", element);
    query=serverQuery.AllocSysString();
    viewable=DataSourceAccessSync(DataSource, &query);
    ::SysFreeString(query);
	viewable.TrimLeft();
	viewable.TrimRight();
    serverQuery.Format("kind %s", element);
    query=serverQuery.AllocSysString();
    kind=DataSourceAccessSync(DataSource, &query);
    ::SysFreeString(query);
	kind.MakeUpper();
	kind.TrimLeft();
	kind.TrimRight();
    if(!(viewable=="0") || kind=="AST" || kind=="INSTANCE") {
        serverQuery.Format("fname %s",element);
	    query=serverQuery.AllocSysString();
	    filename=DataSourceAccessSync(DataSource, &query);
        ::SysFreeString(query);
        integrator->MakeSelection(filename,1,1,0);
    }
    else {
        ((CMainFrame *)AfxGetMainWnd())->MessageBox(
            _T("File cannot be viewed as text"), _T("File View Error"),MB_OK|MB_ICONERROR);
    }
}
void CDockableBrowser :: OnFileDoubleclicked ( LPCTSTR element ) { CString serverQuery ; CString filename ; CString viewable ; CString kind ; BSTR query ; CDataSource * DataSource ; DataSource = ( CDataSource * ) GetDlgItem ( IDC_DATASOURCE ) ; if ( DataSource == NULL ) return ; CCodeRoverIntegrator * integrator = ( CCodeRoverIntegrator * ) GetDlgItem ( IDC_CODEROVERINTEGRATORCTRL ) ; if ( integrator == NULL ) return ; serverQuery . Format ( " " , element ) ; query = serverQuery . AllocSysString ( ) ; viewable = DataSourceAccessSync ( DataSource , & query ) ; :: SysFreeString ( query ) ; viewable . TrimLeft ( ) ; viewable . TrimRight ( ) ; serverQuery . Format ( " " , element ) ; query = serverQuery . AllocSysString ( ) ; kind = DataSourceAccessSync ( DataSource , & query ) ; :: SysFreeString ( query ) ; kind . MakeUpper ( ) ; kind . TrimLeft ( ) ; kind . TrimRight ( ) ; if ( ! ( viewable == " " ) || kind == " " || kind == " " ) { serverQuery . Format ( " " , element ) ; query = serverQuery . AllocSysString ( ) ; filename = DataSourceAccessSync ( DataSource , & query ) ; :: SysFreeString ( query ) ; integrator -> MakeSelection ( filename , 1 , 1 , 0 ) ; } else { ( ( CMainFrame * ) AfxGetMainWnd ( ) ) -> MessageBox ( _T ( " " ) , _T ( " " ) , MB_OK | MB_ICONERROR ) ; } }
This callback runs every time the user doubleclicked the file in the project
modules window
This callback runs every time the user doubleclicked the file in the project modules window