Exemple #1
0
void CMainDlg::StatusAppendLine( char *lpszStatusString )
{
	WTL::CEdit status ;
	status.Attach( GetDlgItem( IDC_EDIT_STATUS ) ) ;
	status.AppendText( "\r\n" ) ;
	status.AppendText( lpszStatusString ) ;
	status.Detach( ) ;
}
Exemple #2
0
void CMainDlg::Status( char *lpszStatusString ) 
{
	WTL::CEdit status ;
	status.Attach( GetDlgItem( IDC_EDIT_STATUS ) ) ;
	status.SetReadOnly( FALSE ) ;
	status.SetSelAll( ) ;
	status.Clear( ) ;
	status.SetReadOnly( ) ;
	status.AppendText( lpszStatusString ) ;
	status.Detach( ) ;
}
Exemple #3
0
void CMainDlg::StatusResult( unsigned __int64 u64Accum , DWORD dwCycles )
{
	WTL::CEdit res ;
	res.Attach( GetDlgItem( IDC_EDIT_RESULT ) ) ;
	res.SetReadOnly( FALSE ) ;
	res.SetSelAll( ) ;
	res.Clear( ) ;
	res.SetReadOnly( ) ;
	if ( dwCycles == 0 ){
		res.AppendText( "##.##" ) ;
	}else{
		float fRes = ( float )u64Accum / ( float )dwCycles ;
		char szRes[ 256 ] ;
		*szRes = NULL ;
		sprintf( szRes , "%.6f" , fRes / ( float )( ( 1 << 24 ) - 1 ) ) ;
		res.AppendText( szRes ) ;
	}
	res.Detach( ) ;
}
Exemple #4
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
        return -1;

    m_wndClientArea.ModifyStyleEx(WS_EX_CLIENTEDGE, 0);

    // create a view to occupy the client area of the frame
    //if (!m_wndView.Create(IDD_ABOUTBOX, this))
    //m_wndView.Create(GetSafeHwnd(), CRect(10,300,100,330), _T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, NULL, 2);
    //if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
    //{
    //	TRACE0("Failed to create view window\n");
    //	return -1;
    //}
    // set the visual manager and style based on persisted value
    OnApplicationLook(theApp.m_nAppLook);

    //// create a view to occupy the client area of the frame
    //if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
    //{
    //	TRACE0("Failed to create view window\n");
    //	return -1;
    //}

    boost::filesystem::path iniPath;
    GetIniPath(iniPath);
    CComPtr<IConfig> ini = CreateIConfig(AMT_INI, iniPath);
    CString config1( ini->Get(g_szConfigSection, RepLabel1, _T("0")) );
    CString config2( ini->Get(g_szConfigSection, RepLabel2, _T("1")) );

    m_splitter.Create(m_hWndMDIClient, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

    m_repositoryDlg.Create(m_splitter);

    //m_detailSheetView.SetReflectNotifications(true);
    m_detailSheetView.SetTabStyles(CTCS_BOTTOM | CTCS_TOOLTIPS);
    m_detailSheetView.Create(m_splitter, ATL::CWindow::rcDefault);
    //m_detailView.SetFont(WTL::AtlGetDefaultGuiFont());

    m_sourceEclView.Create(m_detailSheetView, ATL::CWindow::rcDefault);
    m_sourceEclView.DoInit();
    m_sourceEclView.SetReadOnly(true);
    //TODO:  InitEclCommandMixin(this, this, &m_sourceEclView, this);
    m_detailSheetView.AddTab(m_sourceEclView, _T("Source ECL"));

    m_diffView.Create(m_detailSheetView, ATL::CWindow::rcDefault, _T(""), WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_CLIENTEDGE);
    m_detailSheetView.AddTab(m_diffView, _T("Differences"));

    m_targetEclView.Create(m_detailSheetView, ATL::CWindow::rcDefault);
    m_targetEclView.DoInit();
    m_targetEclView.SetReadOnly(true);
    //TODO:  InitEclCommandMixin(this, this, &m_targetEclView, this);
    m_detailSheetView.AddTab(m_targetEclView, _T("Target ECL"));

    m_dependees.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_CLIENTEDGE);
    m_dependees.SetFont(WTL::AtlGetDefaultGuiFont());
    m_detailSheetView.AddTab(m_dependees, _T("Dependee Check"));

    m_logView.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VSCROLL | LBS_NOINTEGRALHEIGHT, WS_EX_CLIENTEDGE);
    m_logView.SetFont(WTL::AtlGetDefaultGuiFont());
    m_detailSheetView.AddTab(m_logView, _T("Log"));

    WTL::CEdit edit;
    edit.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE);

    CString face = _T("MS Shell Dlg");
    int nPointSize = 8;

    WTL::CFont font;
    WTL::CLogFont logFont;
    logFont.lfCharSet = DEFAULT_CHARSET;
    logFont.lfHeight = nPointSize*10;
    ::_tcsncpy(logFont.lfFaceName, face, LF_FACESIZE);
    logFont.lfWeight = FW_LIGHT;
    logFont.lfQuality = PROOF_QUALITY;
    logFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
    logFont.lfOutPrecision = OUT_TT_PRECIS;
    if ( font.CreatePointFontIndirect(&logFont,0) )
    {
        edit.SetFont(font.Detach(),false);
    }
    m_warnView.SetEditCtrl(edit.Detach());

    m_detailSheetView.AddTab(m_warnView, _T("Warnings"));
    m_detailSheetView.GetTabCtrl().SetCurSel(1);

    m_splitter.SetSplitterPanes(m_repositoryDlg, m_detailSheetView);
    m_splitter.SetSplitterPosPct(50);

    m_wndRibbonBar.Create(this);
    InitializeRibbon();

    if (!m_wndStatusBar.Create(this))
    {
        TRACE0("Failed to create status bar\n");
        return -1;      // fail to create
    }

    m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, _T(""), TRUE), _T(""));
    m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, _T(""), TRUE), _T(""));
    CMFCRibbonProgressBar * elem = new CMFCRibbonProgressBar(ID_STATUSBAR_PANE3);
    m_wndStatusBar.AddExtendedElement(elem, _T("Progress"));
    elem->SetRange(1, 1);
    elem->SetPos(0);

    // enable Visual Studio 2005 style docking window behavior
    CDockingManager::SetDockingMode(DT_SMART);
    // enable Visual Studio 2005 style docking window auto-hide behavior
    EnableAutoHidePanes(CBRS_ALIGN_ANY);

    // Enable enhanced windows management dialog
    //EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE);

    HICON newIcon = LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME_AMT));
    HICON oldIcon = SetIcon(newIcon, false);
    HICON oldIcon2 = SetIcon(newIcon, true);

    RecalcLayout();
    if ( !m_bStreamInit )
    {
        m_pOldBuf = std::cerr.rdbuf(&m_EditStrBuf);
        m_pOldBufW = std::wcerr.rdbuf(&m_EditStrBufW);
        m_bStreamInit = true;
    }

    PostMessage(UM_INITIALIZE);
    return 0;
}
Exemple #5
0
void CMainDlg::UpdateControls( ) 
{
	WTL::CButton btnConnect,btnDisconnect,btnStart ;
	WTL::CButton	btnVoltPosSet , btnVoltPosGet ;
	WTL::CButton	btnVoltNegSet , btnVoltNegGet ;
	WTL::CButton	btnTableTimeout ;
	WTL::CButton	btnTableZero , btnTableStop ;
	WTL::CButton	btnTableSpeedX , btnTableSpeedY ;
	WTL::CButton	btnTableStepX , btnTableStepY ;

	WTL::CButton	btnTableSpeedXGet , btnTableSpeedYGet ;
	WTL::CButton	btnTableStepXGet , btnTableStepYGet ;

	WTL::CButton	btnTableEchoStepX , btnTableEchoStepY ;

	WTL::CButton	btnMirrorZero ;
	WTL::CButton	btnMirrorPos1 , btnMirrorPos2 ;
	WTL::CButton	btnMirrorPos1Set , btnMirrorPos2Set ;
	WTL::CButton	btnMirrorPos1Get , btnMirrorPos2Get ;

	WTL::CEdit	editCount ;
	WTL::CEdit	editVoltPos , editVoltNeg ;
	WTL::CEdit	editTableTimeout ; 
	WTL::CEdit	editTableSpeedX , editTableSpeedY ;
	WTL::CEdit	editTableStepX	, editTableStepY ;
	WTL::CEdit	editTableEchoStepX	, editTableEchoStepY ;
	
	WTL::CEdit	editMirrorPos1 , editMirrorPos2 ;


	btnConnect.Attach( GetDlgItem( IDC_BUTTON_CONNECT ) ) ;
	btnDisconnect.Attach( GetDlgItem( IDC_BUTTON_DISCONNECT ) ) ;
	btnStart.Attach( GetDlgItem( IDC_BUTTON_START ) ) ;
	editCount.Attach( GetDlgItem( IDC_EDIT_COUNT ) ) ;

	btnVoltPosSet.Attach( GetDlgItem( IDC_BUTTON_VOLT_POS_SET ) ) ;  
	btnVoltPosGet.Attach( GetDlgItem( IDC_BUTTON_VOLT_POS_GET ) ) ;
	btnVoltNegSet.Attach( GetDlgItem( IDC_BUTTON_VOLT_NEG_SET ) ) ;  
	btnVoltNegGet.Attach( GetDlgItem( IDC_BUTTON_VOLT_NEG_GET ) ) ;
	editVoltPos.Attach( GetDlgItem( IDC_EDIT_VOLT_POS ) ) ; 
	editVoltNeg.Attach( GetDlgItem( IDC_EDIT_VOLT_NEG ) ) ;

	editTableTimeout.Attach( GetDlgItem( IDC_EDIT_TIMEOUT ) ) ; 
	editTableSpeedX.Attach( GetDlgItem( IDC_EDIT_TABLE_SPEED_X ) ) ;
	editTableSpeedY.Attach( GetDlgItem( IDC_EDIT_TABLE_SPEED_Y ) )  ;
	editTableStepX.Attach( GetDlgItem( IDC_EDIT_TABLE_STEP_X ) ) 	;
	editTableStepY.Attach( GetDlgItem( IDC_EDIT_TABLE_STEP_Y ) )  ;

	btnTableTimeout.Attach( GetDlgItem( IDC_BUTTON_TIMEOUT ) ) ;
	btnTableZero.Attach( GetDlgItem( IDC_BUTTON_TABLE_ZERO ) ) ; 
	btnTableStop.Attach( GetDlgItem( IDC_BUTTON_TABLE_STOP ) ) ;
	btnTableSpeedX.Attach( GetDlgItem( IDC_BUTTON_TABLE_SPEED_X ) ) ; 
	btnTableSpeedY.Attach( GetDlgItem( IDC_BUTTON_TABLE_SPEED_Y ) ) ;
	btnTableStepX.Attach( GetDlgItem( IDC_BUTTON_TABLE_STEP_X ) ) ;
	btnTableStepY.Attach( GetDlgItem( IDC_BUTTON_TABLE_STEP_Y ) ) ;
	btnTableSpeedXGet.Attach( GetDlgItem( IDC_BUTTON_TABLE_SPEED_X_GET ) ) ; 
	btnTableSpeedYGet.Attach( GetDlgItem( IDC_BUTTON_TABLE_SPEED_Y_GET ) ) ;
	btnTableStepXGet.Attach( GetDlgItem( IDC_BUTTON_TABLE_STEP_X_GET ) ) ;
	btnTableStepYGet.Attach( GetDlgItem( IDC_BUTTON_TABLE_STEP_Y_GET ) ) ;

	btnTableEchoStepX.Attach( GetDlgItem( IDC_BUTTON_TABLE_ECHO_STEP_X ) ) ;
	btnTableEchoStepY.Attach( GetDlgItem( IDC_BUTTON_TABLE_ECHO_STEP_Y ) ) ;
	editTableEchoStepX.Attach( GetDlgItem( IDC_EDIT_TABLE_ECHO_STEP_X ) )	; 
	editTableEchoStepY.Attach( GetDlgItem( IDC_EDIT_TABLE_ECHO_STEP_Y ) )  ;

	editMirrorPos1.Attach( GetDlgItem( IDC_EDIT_MIRROR_POS1 ) ) ;
	editMirrorPos2.Attach( GetDlgItem( IDC_EDIT_MIRROR_POS2 ) ) ;

	btnMirrorZero.Attach( GetDlgItem( IDC_BUTTON_MIRROR_ZERO ) ) ;
	btnMirrorPos1.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS1 ) ) ; 
	btnMirrorPos2.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS2 ) ) ;
	btnMirrorPos1Set.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS1_SET ) ) ; 
	btnMirrorPos2Set.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS2_SET ) ) ;
	btnMirrorPos1Get.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS1_GET ) ) ; 
	btnMirrorPos2Get.Attach( GetDlgItem( IDC_BUTTON_MIRROR_POS2_GET ) ) ;

	switch( m_status ){
	case NOT_CONNECTED:
		btnConnect.EnableWindow( TRUE ) ;
		btnDisconnect.EnableWindow( FALSE ) ;
		btnStart.EnableWindow( FALSE ) ;
		
		btnVoltPosSet.EnableWindow( FALSE ) ;  
		btnVoltPosGet.EnableWindow( FALSE ) ;
		btnVoltNegSet.EnableWindow( FALSE ) ;  
		btnVoltNegGet.EnableWindow( FALSE ) ;

		btnTableTimeout.EnableWindow( FALSE ) ;
		btnTableZero.EnableWindow( FALSE ) ; 
		btnTableStop.EnableWindow( FALSE ) ;
		btnTableSpeedX.EnableWindow( FALSE ) ; 
		btnTableSpeedY.EnableWindow( FALSE ) ;
		btnTableStepX.EnableWindow( FALSE ) ;
		btnTableStepY.EnableWindow( FALSE ) ;
		btnTableSpeedXGet.EnableWindow( FALSE ) ; 
		btnTableSpeedYGet.EnableWindow( FALSE ) ;
		btnTableStepXGet.EnableWindow( FALSE ) ;
		btnTableStepYGet.EnableWindow( FALSE ) ;

		btnMirrorZero.EnableWindow( FALSE ) ;
		btnMirrorPos1.EnableWindow( FALSE ) ; 
		btnMirrorPos2.EnableWindow( FALSE ) ;
		btnMirrorPos1Set.EnableWindow( FALSE ) ; 
		btnMirrorPos2Set.EnableWindow( FALSE ) ;
		btnMirrorPos1Get.EnableWindow( FALSE ) ; 
		btnMirrorPos2Get.EnableWindow( FALSE ) ;

		btnTableEchoStepX.EnableWindow( FALSE ) ;
		btnTableEchoStepY.EnableWindow( FALSE ) ;
		editTableEchoStepX.EnableWindow( FALSE ) ; 
		editTableEchoStepY.EnableWindow( FALSE )  ;
		
		editVoltPos.SetReadOnly( ) ; 
		editVoltNeg.SetReadOnly( ) ;

		editTableTimeout.SetReadOnly( ) ; 
		editTableSpeedX.SetReadOnly( ) ;
		editTableSpeedY.SetReadOnly( ) ;
		editTableStepX.SetReadOnly( ) ;
		editTableStepY.SetReadOnly( ) ;
		
		editCount.SetReadOnly( ) ;

		editMirrorPos1.SetReadOnly( ) ;
		editMirrorPos2.SetReadOnly( ) ;

		break ;
	case CONNECTED:
		btnConnect.EnableWindow( FALSE ) ;
		btnDisconnect.EnableWindow( TRUE ) ;
		btnStart.EnableWindow( TRUE ) ;

		btnVoltPosSet.EnableWindow( TRUE ) ;  
		btnVoltPosGet.EnableWindow( TRUE ) ;
		btnVoltNegSet.EnableWindow( TRUE ) ;  
		btnVoltNegGet.EnableWindow( TRUE ) ;

		btnTableTimeout.EnableWindow( TRUE ) ;
		btnTableZero.EnableWindow( TRUE ) ; 
		btnTableStop.EnableWindow( TRUE ) ;
		btnTableSpeedX.EnableWindow( TRUE ) ; 
		btnTableSpeedY.EnableWindow( TRUE ) ;
		btnTableStepX.EnableWindow( TRUE ) ;
		btnTableStepY.EnableWindow( TRUE ) ;
		btnTableSpeedXGet.EnableWindow( TRUE ) ; 
		btnTableSpeedYGet.EnableWindow( TRUE ) ;
		btnTableStepXGet.EnableWindow( TRUE ) ;
		btnTableStepYGet.EnableWindow( TRUE ) ;
		btnTableEchoStepX.EnableWindow( TRUE ) ;
		btnTableEchoStepY.EnableWindow( TRUE ) ;
		editTableEchoStepX.EnableWindow( TRUE ) ; 
		editTableEchoStepY.EnableWindow( TRUE )  ;

		btnMirrorZero.EnableWindow( TRUE ) ;
		btnMirrorPos1.EnableWindow( TRUE ) ; 
		btnMirrorPos2.EnableWindow( TRUE ) ;
		btnMirrorPos1Set.EnableWindow( TRUE ) ; 
		btnMirrorPos2Set.EnableWindow( TRUE ) ;
		btnMirrorPos1Get.EnableWindow( TRUE ) ; 
		btnMirrorPos2Get.EnableWindow( TRUE ) ;
		
		editVoltPos.SetReadOnly( FALSE ) ; 
		editVoltNeg.SetReadOnly( FALSE ) ;

		editTableTimeout.SetReadOnly( FALSE ) ; 
		editTableSpeedX.SetReadOnly( FALSE ) ;
		editTableSpeedY.SetReadOnly( FALSE ) ;
		editTableStepX.SetReadOnly( FALSE ) ;
		editTableStepY.SetReadOnly( FALSE ) ;

		editCount.SetReadOnly( FALSE ) ;

		editMirrorPos1.SetReadOnly( FALSE ) ;
		editMirrorPos2.SetReadOnly( FALSE ) ;

		break ;
	case PROCESSING:
		btnConnect.EnableWindow( FALSE ) ;
		btnDisconnect.EnableWindow( FALSE ) ;
		btnStart.EnableWindow( FALSE ) ;
		editCount.SetReadOnly( ) ;
		
		break ;
	}

	btnConnect.Detach(  ) ;
	btnDisconnect.Detach(  ) ;
	btnStart.Detach(  ) ;
	editCount.Detach( ) ;

	btnVoltPosSet.Detach( ) ;  
	btnVoltPosGet.Detach( ) ;
	btnVoltNegSet.Detach( ) ;  
	btnVoltNegGet.Detach( ) ;

	editVoltPos.Detach( ) ; 
	editVoltNeg.Detach( ) ;

	editTableTimeout.Detach( ) ; 
	editTableSpeedX.Detach( ) ;
	editTableSpeedY.Detach( ) ;
	editTableStepX.Detach( ) ;
	editTableStepY.Detach( ) ;

	btnTableTimeout.Detach( ) ;
	btnTableZero.Detach( ) ; 
	btnTableStop.Detach( ) ;
	btnTableSpeedX.Detach( ) ; 
	btnTableSpeedY.Detach( ) ;
	btnTableStepX.Detach( ) ;
	btnTableStepY.Detach( ) ;

	btnTableSpeedXGet.Detach( ) ; 
	btnTableSpeedYGet.Detach( ) ;
	btnTableStepXGet.Detach( ) ;
	btnTableStepYGet.Detach( ) ;

	btnTableEchoStepX.Detach( ) ;
	btnTableEchoStepY.Detach( ) ;
	editTableEchoStepX.Detach( ) ; 
	editTableEchoStepY.Detach( )  ;

	editMirrorPos1.Detach( ) ;
	editMirrorPos2.Detach( ) ;
	btnMirrorZero.Detach( ) ;
	btnMirrorPos1.Detach( ) ; 
	btnMirrorPos2.Detach( ) ;
	btnMirrorPos1Set.Detach( ) ; 
	btnMirrorPos2Set.Detach( ) ;
	btnMirrorPos1Get.Detach( ) ; 
	btnMirrorPos2Get.Detach( ) ;
}