예제 #1
0
/*******************************************************************************
 Function Name  : n64GetPos
 Input(s)       :   -
 Output         : __int64 - 64 bit int value of for the text box
 Functionality  : This method get the current 64 bit int value of the spin
                  button.
 Member of      : CNumSpinCtrl
 Friend of      :
 Author(s)      : Raja N
 Date Created   : 30.07.2004
 Modifications  : 
*******************************************************************************/
__int64 CNumSpinCtrl::n64GetPos()
{
    __int64 n64Val = 0;
    // Get the text control first to get the value
    CWnd* pomEdit = GetBuddy();
    // If the buddy is set then proceed
    if (pomEdit != NULL )
    {
        CString omStrText;
        // Get the text
        pomEdit->GetWindowText (omStrText);
        // This can be used for both decimal and hex mode. So base check is not
        // required
        // Convert the text in to 64bit integer
        BOOL bSuccess = 
						bConvertStringToInt64( omStrText,n64Val, GetBase());
        // Set the default value here incase of failure
        if( bSuccess == FALSE )
        {
            n64Val = 0;
        }
        // Extend the sign bit to get the actual value
        // If the value before is FF ( that is -1 )and data length is 8 bits
        // after extending the sign bit this will become FFFFFFFFFFFFFFFF
        // which is again -1 but the length is 64 bits
        if( m_bSigned == TRUE )
        {
            vExtendSignBit( n64Val, m_nDataLength);
        }
    }
    // Return calculated value
    return n64Val;
}
예제 #2
0
/*******************************************************************************
 Function Name  : dGetPos
 Input(s)       :   -
 Output         : double - Double precession value of for the text box
 Functionality  : This method get the current virtual double precession value of
                  of the spin button.
 Member of      : CNumSpinCtrl
 Friend of      :
 Author(s)      : Raja N
 Date Created   : 22.07.2004
 Modifications  : Raja N on 30.07.2004.
                  Code review changes and Int 64 version implementation to
                  support signals > 52 bits length
*******************************************************************************/
double CNumSpinCtrl::dGetPos()
{
    // Get the text control first to get the value
    CWnd* pomEdit = GetBuddy();
    TCHAR * pDummy = NULL;
    double dVal = 0.0;
    // If the buddy is set then proceed
    if (pomEdit)
    {
        CString omStrText;
        // Get the text
        pomEdit->GetWindowText (omStrText);
        // Check for Base value
        if( GetBase() == defBASE_DEC )
        {
            // In decimal mode floating point values are possible so
            // Use Double Value function to get decimal points also
            dVal = _tcstod( omStrText, &pDummy);
        }
        else
        {
            // Double type should not be used for Hex values
            ASSERT ( FALSE );
        }
    }
    // Return calculated value
    return dVal;
}
예제 #3
0
BOOL MyBitmapButton::ReplaceDlgCtrl(CDialog* pDialog, int buttonID)
{
    CWnd* pWnd = pDialog->GetDlgItem(buttonID);
    if (pWnd == NULL)
        return FALSE;

#if 0
    DWORD styles = pWnd->GetStyle();
    //DWORD stylesEx = pWnd->GetExStyle();
    CString caption;
    CRect rect;
    pWnd->GetWindowText(caption);
    pWnd->GetWindowRect(&rect);
    pDialog->ScreenToClient(&rect);

//  pWnd->DestroyWindow();
    if (Create(caption, styles, rect, pDialog, buttonID) == FALSE) {
        LOGI("ERROR: unable to replace dialog ctrl (buttonID=%d)",
            buttonID);
        return FALSE;
    }
#endif

    /* latch on to their window handle */
    Attach(pWnd->m_hWnd);

    return TRUE;
}
void CReplaceTexDlg::BrowseTex(int iEdit)
{
	CString strTex;
	CWnd *pWnd = GetDlgItem(iEdit);

	pWnd->GetWindowText(strTex);

	CTextureBrowser *pBrowser = new CTextureBrowser(GetMainWnd());
	pBrowser->SetUsed(iEdit == IDC_FIND);
	pBrowser->SetInitialTexture(strTex);

	if (pBrowser->DoModal() == IDOK)
	{
		IEditorTexture *pTex = g_Textures.FindActiveTexture(pBrowser->m_cTextureWindow.szCurTexture);
		char szName[MAX_PATH];
		if (pTex != NULL)
		{
			pTex->GetShortName(szName);
		}
		else
		{
			szName[0] = '\0';
		}
		pWnd->SetWindowText(szName);
	}

	delete pBrowser;
}
예제 #5
0
void CProgressDlg::UpdatePercent(int nNewPos)
{
    CWnd *pWndPercent = GetDlgItem(CG_IDC_PROGDLG_PERCENT);
    int nPercent;

    int nDivisor = m_nUpper - m_nLower;
    ASSERT(nDivisor>0);  // m_nLower should be smaller than m_nUpper

    int nDividend = (nNewPos - m_nLower);
    ASSERT(nDividend>=0);   // Current position should be greater than m_nLower

    nPercent = nDividend * 100 / nDivisor;

    // Since the Progress Control wraps, we will wrap the percentage
    // along with it. However, don't reset 100% back to 0%
    if(nPercent!=100)
        nPercent %= 100;

    // Display the percentage
    CString strBuf;
    strBuf.Format(_T("%d%c"),nPercent,_T('%'));

    CString strCur; // get current percentage
    pWndPercent->GetWindowText(strCur);

    if (strCur != strBuf)
        pWndPercent->SetWindowText(strBuf);
}
예제 #6
0
파일: Malayalam.cpp 프로젝트: vchacko/mmki
BOOL isMalayalam()
{
	if(GetKeyState(VK_SCROLL)&1)
	{
		CWnd * window = CWnd::FromHandle(msg->hwnd);
		
		window = window->GetTopLevelParent();
		CString s;
		window->GetWindowText(s);
		
		if(s.Find("Microsoft Word")>-1)
		{
			preback = FALSE;
			return true;
		}
		else if(s.Find("Paint")>-1)
		{
			paint = TRUE;
			return true;
		}
		else 
		{ 
			
			preback = TRUE;
			return true;
		}
		return true;
	}
	return false;
}
예제 #7
0
void CCoolMenuBarCtrl::UpdateWindowMenu(CMenu* pMenu)
{
	for ( UINT nItem = 0 ; nItem < pMenu->GetMenuItemCount() ; nItem++ )
	{
		UINT nID = pMenu->GetMenuItemID( nItem );
		
		if ( nID >= AFX_IDM_FIRST_MDICHILD )
		{
			for ( UINT nRemove = nItem ; nRemove < pMenu->GetMenuItemCount() ; )
				pMenu->RemoveMenu( nItem, MF_BYPOSITION );
			pMenu->RemoveMenu( nItem - 1, MF_BYPOSITION );
			break;
		}
	}
	
	CMDIFrameWnd* pFrame = (CMDIFrameWnd*)AfxGetMainWnd();
	if ( ! pFrame->IsKindOf( RUNTIME_CLASS(CMDIFrameWnd) ) ) return;
	
	for ( CWnd* pClient = pFrame->GetWindow( GW_CHILD ) ; pClient ; pClient = pClient->GetNextWindow() )
	{
		TCHAR szClass[64];
		GetClassName( pClient->GetSafeHwnd(), szClass, 64 );
		if ( _tcsicmp( szClass, _T("MDIClient") ) == 0 ) break;
	}
	
	if ( pClient == NULL ) return;
	
	CMDIChildWnd* pActive = pFrame->MDIGetActive();
	BOOL bSeparator = TRUE;
	
	for ( UINT nIndex = 1, nID = AFX_IDM_FIRST_MDICHILD ; nIndex <= 10 ; nIndex++, nID++ )
	{
		CWnd* pWnd = pClient->GetDlgItem( nID );
		if ( ! pWnd ) break;
		
#ifdef _SHAREAZA
		CChildWnd* pChildWnd = (CChildWnd*)pWnd;
		if ( pChildWnd->m_bTabMode )
		{
			nIndex--;
			continue;
		}
#endif
		
		if ( bSeparator )
		{
			pMenu->AppendMenu( MF_SEPARATOR, ID_SEPARATOR );
			bSeparator = FALSE;
		}
		
		CString strMenu, strWindow;
		pWnd->GetWindowText( strWindow );
		
		strMenu.Format( _T("&%i %s"), nIndex, (LPCTSTR)strWindow );
		
		pMenu->AppendMenu( MF_STRING | ( pWnd == pActive ? MF_CHECKED : 0 ),
			nID, strMenu );
	}
}
예제 #8
0
파일: Misc.cpp 프로젝트: CyberShadow/Ditto
CString GetWndText( HWND hWnd )
{
	CString text;
	if( !IsWindow(hWnd) )
		return "! NOT A VALID WINDOW !";
	CWnd* pWnd = CWnd::FromHandle(hWnd);
	pWnd->GetWindowText(text);
	return text;
}
int CNumSpinCtrl::GetPos(void)
{
	CWnd* pEdit = GetBuddy();
	if (!pEdit) return 0;
	
	CString str;
	pEdit->GetWindowText(str);
	
	return GfxAtoX(str);
}
예제 #10
0
void CSelectdb::SaveSettings()
{
    //this fuction will save the settings of last selected file in the registry.
    CString strSection       = "Files";
    CString strStringItem    = "Database File";
    CWinApp* pApp = AfxGetApp();
    CString omStrDatabaseName;
    CWnd* pCAPL = GetDlgItem(IDC_EDIT_ADCANOE);
    pCAPL->GetWindowText(omStrDatabaseName);
    pApp->WriteProfileString(strSection, strStringItem,omStrDatabaseName);
}
예제 #11
0
void CFPSOverrider::OnBnClickedcmdsetfps()
{
	// When cmdsetfps is clicked do this:
	CWnd* txtsetfps = GetDlgItem(txtSetFPS);
	txtsetfps->GetWindowText(strFPSValue); //Get value from the text file
	intFPSValue = atoi(strFPSValue);  //Convert Value from String to Int
	FPSValue = CheckFPSRange(intFPSValue); //Check if its between 30 and 120
	if(FPSValue != 0){
		WriteMemory( "SWGANH.exe" ); //Write memory to .exe
	}
}
BOOL CDCGFStringTable::LocWinCallback(HWND hwnd, LPARAM lParam)
{
	CWnd* Window = CWnd::FromHandle(hwnd);
	if(!Window) return FALSE;

	CString WinText;
	Window->GetWindowText(WinText);
	Window->SetWindowText(LOC(WinText));
	
	return TRUE;
}
예제 #13
0
double CFloatSpinCtrl::GetPos() {
    CWnd* pEdit = GetBuddy();
    if (pEdit) {
        CString str;
        pEdit->GetWindowText(str);
        double val = _wtof(str);
        return val;
    } else {
        //ASSERT (FALSE); // you didn't set buddy
        return 0.0;
    }
}
예제 #14
0
void CInsertConstituentDlg::OnOK() 
{
	CWnd* pWnd;

	UpdateData(TRUE);  //retrieve m_strTag
	pWnd=&m_recConstituent;
	pWnd->GetWindowText(m_strWord);
	if (m_strWord.GetLength()==0)    //user is deleting a modifier
	{
//		AfxMessageBox(L"You must enter a modifying word, phrase or clause.");
//		return;
		m_strTag=L"";
	}
	if (m_strWord.GetLength()>0 && m_strTag.GetLength()==0)
	{
		AfxMessageBox(L"You must enter a tag.");
		return;
	}
	pWnd=GetDlgItem(IDC_RICHEDITTARGETGLOSS);
	pWnd->GetWindowText(m_strGloss);
	CDialog::OnOK();
}
예제 #15
0
CString
SetupWizard::SetNextText (/*[in]*/ LPCTSTR lpszText)
{
  CWnd * pWnd = GetDlgItem(ID_WIZNEXT);
  if (pWnd == 0)
    {
      UNEXPECTED_CONDITION ("SetupWizard::SetNextText");
    }
  CString ret;
  pWnd->GetWindowText (ret);
  pWnd->SetWindowText (lpszText);
  return (ret);
}
예제 #16
0
void CStageGripperDlg::OnKillfocusGripperDisplacementOpen() 
{
	CFrameWnd *pMainFrame = GetTopLevelFrame(); 
	CView *pView = pMainFrame->GetActiveView();
	CStageDoc *pDoc = ((CStageView *)pView)->GetDocument();
	CWnd *pCBox;
	char s[32];

	pCBox = (CComboBox*)GetDlgItem(IDC_GRIPPER_DISPLACEMENT_OPEN);
	pCBox->GetWindowText(s, 32);
	sscanf(s, "%lf", &((CStageGripper *)pDoc->m_currentDevice)->m_displacementOpen);
	return;
}
예제 #17
0
BOOL CDialogSound::PreTranslateMessage(MSG* pMsg)
{
	CWnd *wnd = GetDlgItem( IDC_EDIT_VOLUME );
	if ( wnd && pMsg->hwnd == wnd->GetSafeHwnd() ) {
		if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN ) {
			CString str;
			wnd->GetWindowText( str );
			SetVolume( atof( str ) );
			return TRUE;
		}
	}
	return CDialog::PreTranslateMessage(pMsg);
}
예제 #18
0
BOOL CExportDlg::OnInitDialog()
{
	CHorizontalResizableStandAloneDialog::OnInitDialog();
	CAppUtils::MarkWindowAsUnpinnable(m_hWnd);

	if (g_Git.m_CurrentDir == m_orgPath.GetWinPathString())
	{
		GetDlgItem(IDC_WHOLE_PROJECT)->EnableWindow(FALSE);
		((CButton *)GetDlgItem(IDC_WHOLE_PROJECT))->SetCheck(TRUE);
	}

	AddAnchor(IDC_REPOGROUP, TOP_LEFT, TOP_RIGHT);
	AddAnchor(IDC_EXPORTFILE_LABEL, TOP_LEFT);
	AddAnchor(IDC_EXPORTFILE_BROWSE, TOP_RIGHT);
	AddAnchor(IDC_EXPORTFILE, TOP_LEFT, TOP_RIGHT);

	AddAnchor(IDOK, BOTTOM_RIGHT);
	AddAnchor(IDCANCEL, BOTTOM_RIGHT);
	AddAnchor(IDHELP, BOTTOM_RIGHT);

	AdjustControlSize(IDC_RADIO_BRANCH);
	AdjustControlSize(IDC_RADIO_TAGS);
	AdjustControlSize(IDC_RADIO_VERSION);

	SetDlgTitle();

	CHOOSE_VERSION_ADDANCHOR;
	this->AddOthersToAnchor();
	InitChooseVersion();
	if (m_initialRefName.IsEmpty() || m_initialRefName == _T("HEAD"))
	{
		SetDefaultChoose(IDC_RADIO_HEAD);
	}
	else if (m_initialRefName.Left(10) == _T("refs/tags/"))
		SetDefaultChoose(IDC_RADIO_TAGS);

	CWnd* pHead = GetDlgItem(IDC_RADIO_HEAD);
	CString headText;
	pHead->GetWindowText(headText);
	pHead->SetWindowText(headText + " (" + g_Git.GetCurrentBranch() + ")");
	AdjustControlSize(IDC_RADIO_HEAD);

	m_tooltips.AddTool(IDC_EXPORTFILE, IDS_EXPORTFILE_TT);

	SHAutoComplete(GetDlgItem(IDC_EXPORTFILE)->m_hWnd, SHACF_FILESYSTEM);

	if ((m_pParentWnd==NULL)&&(hWndExplorer))
		CenterWindow(CWnd::FromHandle(hWndExplorer));
	EnableSaveRestore(_T("ExportDlg"));
	return TRUE;
}
예제 #19
0
LRESULT CDlgAddItem::OnCaptureLBtnUp( WPARAM wParam, LPARAM lParam )
{
	// 根据坐标获取窗体 [7/10/2014 Brilliance]
	POINT pot;
	GetCursorPos(&pot);
	CWnd* pWnd = WindowFromPoint(pot);
	// 获取标题 [7/10/2014 Brilliance]
	pWnd->GetWindowText(m_csTitle);	
	// 获取类名 [7/10/2014 Brilliance]
	TCHAR sClass[128] = {0};
	GetClassName(pWnd->GetSafeHwnd(), sClass, sizeof(sClass)/sizeof(TCHAR));
	m_csClass = sClass;
	// 获取大小 [7/10/2014 Brilliance]
	CRect rt;
	pWnd->GetClientRect(&rt);
	ClientToScreen(&rt);
	//m_csRect.Format(_T("(%d,%d),%d*%d"), rt.left, rt.top, rt.Width(), rt.Height());
	m_csRect.Format(_T("%d,%d"), rt.Width(), rt.Height());
	// 获取进程ID [7/10/2014 Brilliance]
	DWORD dwProcessId = 0;
	GetWindowThreadProcessId(pWnd->GetSafeHwnd(), &dwProcessId);
	m_csProcessId.Format(_T("%d"), dwProcessId);
	// 获取进程名 [7/10/2014 Brilliance]
	HANDLE hProcess =  OpenProcess(/*PROCESS_ALL_ACCESS*/PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE, dwProcessId);
	TCHAR sProcessName[MAX_PATH] = {0};
	TCHAR sProcessPath[MAX_PATH] = {0};
	if (NULL != hProcess )
	{
		HMODULE hMod;
		DWORD cbNeeded;
		if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), &cbNeeded) )
		{
			GetModuleBaseName( hProcess, hMod, sProcessName, sizeof(sProcessName)/sizeof(TCHAR) );
			GetModuleFileName(hMod, sProcessPath, sizeof(sProcessPath)/sizeof(TCHAR));
		}
	}	
	m_csProcessName = sProcessName;
	m_csProcessPath = sProcessPath;
	// 获取线程ID [7/10/2014 Brilliance]
// 	DWORD dwThreadId = 0;
// 	dwThreadId = GetThreadId(pWnd->m_hWnd);
	
	CString csText;
	csText.Format(_T("左键弹起,x=%d,y=%d,Title:%s,Class:%s\r\n"), pot.x, pot.y, m_csTitle, m_csClass);
	TRACE(csText);
	//m_csOutput = m_csOutput + csText;
	//UpdateData(FALSE);

	UpdateData(FALSE);
	return 0;
}
예제 #20
0
void CStageEyeDialog::OnKillfocusEyeClipfront()
{
    // TODO: Add your control notification handler code here
    CMainFrame *pMainFrame = (CMainFrame *)GetTopLevelFrame();
    if (!pMainFrame || !pMainFrame->IsKindOf(RUNTIME_CLASS(CMainFrame)))
    {
        return;
    }
    CStageView *pView = (CStageView *)pMainFrame->GetActiveView();
    if (!pView || !pView->IsKindOf(RUNTIME_CLASS(CStageView)))
    {
        return;
    }
    CStageDoc *pDoc = pView->GetDocument();
    if (!pDoc || !pDoc->IsKindOf(RUNTIME_CLASS(CStageDoc)))
    {
        return;
    }
    CWnd *pCBox;
    char s[32];
    GLdouble clipFront;
    RECT rect;

    pMainFrame->GetWindowRect(&rect);
    if (rect.right - rect.left < YO_THRESH_WIDTH || pMainFrame->m_wndDlgEyeVisible == FALSE
            || pMainFrame->m_wndDlgEye == NULL)
    {
        return;
    }

    pCBox = (CComboBox*)pMainFrame->m_wndDlgEye->GetDlgItem(IDC_EYE_CLIPFRONT);
    pCBox->GetWindowText(s, 32);
    sscanf(s, "%lf", &clipFront);
    pView->m_clipFront = clipFront / pDoc->m_unitScaleFactor;

    pView->m_clipFront = YO_MAX(pView->m_clipFront, 0.1);
    pView->m_clipFront = YO_MIN(pView->m_clipFront, pView->m_clipRear);
    sprintf(s, "%.2lf", pView->m_clipFront * pDoc->m_unitScaleFactor);
    pCBox->SetWindowText(s);
    pCBox->UpdateWindow();

    ::glMatrixMode(GL_PROJECTION);
    ::glLoadIdentity();
    ::gluPerspective(pView->m_fieldOfView, pView->m_aspectRatio,
                     pView->m_clipFront, pView->m_clipRear);
    ::glMatrixMode(GL_MODELVIEW);

    pView->YoRender(YO_RENDER_LIGHT);
    pView->YoRender(YO_RENDER_FULL);
    return;
}
//******************************************************************************
void CBCGPDragFrameImpl::PlaceTabPreDocking (CBCGPBaseTabbedBar* pTabbedBar, BOOL bFirstTime)
{
	if (m_nInsertedTabID != -1)
	{
		return;
	}
	if (!bFirstTime)
	{
		EndDrawDragFrame (FALSE);
	}
	CString strLabel;
	if (m_pDraggedWnd->IsKindOf (RUNTIME_CLASS (CBCGPMultiMiniFrameWnd)))
	{
		CBCGPMultiMiniFrameWnd* pMultiMiniFrame = 
			DYNAMIC_DOWNCAST (CBCGPMultiMiniFrameWnd, m_pDraggedWnd);
		if (pMultiMiniFrame != NULL)
		{
			CWnd* pBar = pMultiMiniFrame->GetFirstVisibleBar ();
			ASSERT_VALID (pBar);

			if (pBar != NULL)
			{
				pBar->GetWindowText (strLabel);
			}
		}
	}
	else
	{
		m_pDraggedWnd->GetWindowText (strLabel);
	}	
	
	if (m_pWndDummy == NULL)
	{
		m_pWndDummy = new CBCGPDummyDockingControlBar;
		m_pWndDummy->CreateEx (0, _T (""), BCGCBProGetTopLevelFrame (m_pDraggedWnd), CRect (0, 0, 0, 0), 
							FALSE, BCGP_DUMMY_WND_ID, WS_CHILD);
	}

	pTabbedBar->GetUnderlinedWindow ()->AddTab (m_pWndDummy, strLabel);
	
	CBCGPSmartDockingManager* pSDManager = NULL;
	if ((pSDManager = m_pDockManager->GetSDManagerPermanent()) != NULL
		&& pSDManager->IsStarted())
	{
		m_pDraggedWnd->ShowWindow (SW_HIDE);
	}

	m_nInsertedTabID = pTabbedBar->GetUnderlinedWindow ()->GetTabFromHwnd (*m_pWndDummy);
	m_pOldTargetBar = pTabbedBar;
}
예제 #22
0
void CPhoneticFeaturesDlg::OnOK() 
{
	CString T;
	CWnd* pWnd;

	if (m_nType==2)        //if capital letters
	{
		pWnd=&m_recSentenceFinalCharacters;
		pWnd->GetWindowText(T);
		if (T!=m_strSentenceFinalCharacters) m_pDoc->SetSentenceFinalCharacters(T);
	}
	
	CDialog::OnOK();
}
예제 #23
0
파일: MainDlg.cpp 프로젝트: ohosrry/wtldemo
//=================================================
// Callback for shell directory browser
//=================================================
static int __stdcall BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
	TCHAR strInitDir[MAX_PATH] = {NULL};
    if(uMsg == BFFM_INITIALIZED)
    {
		CString strInitDir = _T("");
		CWnd* pWnd = (CWnd*)lpData;
		pWnd->GetWindowText(strInitDir);
		::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, 
			(LPARAM)strInitDir.GetBuffer(255));
		strInitDir.ReleaseBuffer();
    }
	return 0;
}
예제 #24
0
/**
 *  This gets the text of a child control.
 *
 *  @param parent       The parent control.
 *  @param id           The id of the child control.
 *  @returns            The text of the child control.
 */
std::string controls::getWindowText(CWnd const &parent, UINT id)
{
    std::string result;
    if (parent.GetSafeHwnd() != 0)
    {
        CWnd *child = parent.GetDlgItem(id);
        if (child != NULL)
        {
            CString txt;
            child->GetWindowText(txt);
            result = txt.GetBuffer();
        }
    }
    return result;
}
예제 #25
0
void CSignalDefinerDlg::OnEnUpdateEditSignalSamplingTime()
{
    CWnd* pEdit = GetDlgItem(IDC_EDIT_SIGNAL_SAMPLING_TIME);
    if(pEdit != NULL)
    {
        CString strTime = L"";
        pEdit->GetWindowText(strTime);
        double dTime = _wtof(strTime);
        if(dTime > 0)
        {
            m_dblSamplingTimePeriod = dTime;
        }
    }
    UpdateData(FALSE);
}
예제 #26
0
void CEditViewDlg::OnBnClickedButtonGoto() {
	CWnd *wnd = GetDlgItem(IDC_EDIT_GOTO);
	if (wnd) {
		CString str;
		wnd->GetWindowText(str);
		if (str.GetLength()) {
			int l = atoi(str);
			editInfo.SetSel(0, 0);
			editInfo.LineScroll(l);
			int cindex = editInfo.LineIndex(l);
			int len = editInfo.LineLength(l);
			editInfo.SetSel(cindex, cindex);
			editInfo.RedrawWindow();
			editInfo.SetFocus();
		}
	}
}
예제 #27
0
void CStageEyeDialog::OnKillfocusEyeFov()
{
    CMainFrame *pMainFrame = (CMainFrame *)GetTopLevelFrame();
    if (!pMainFrame || !pMainFrame->IsKindOf(RUNTIME_CLASS(CMainFrame)))
    {
        return;
    }
    CStageView *pView = (CStageView *)pMainFrame->GetActiveView();
    if (!pView || !pView->IsKindOf(RUNTIME_CLASS(CStageView)))
    {
        return;
    }
    CWnd *pCBox;
    char s[32];
    RECT rect;

    pMainFrame->GetWindowRect(&rect);
    if (rect.right - rect.left < YO_THRESH_WIDTH || pMainFrame->m_wndDlgEyeVisible == FALSE
            || pMainFrame->m_wndDlgEye == NULL)
    {
        return;
    }

    pCBox = (CComboBox*)pMainFrame->m_wndDlgEye->GetDlgItem(IDC_EYE_FOV);
    pCBox->GetWindowText(s, 32);
    sscanf(s, "%lf", &pView->m_fieldOfView);

    pView->m_fieldOfView = YO_MAX(pView->m_fieldOfView, 0.0);
    pView->m_fieldOfView = YO_MIN(pView->m_fieldOfView, 180.0);
    sprintf(s, "%.1lf", pView->m_fieldOfView);
    pCBox->SetWindowText(s);
    pCBox->UpdateWindow();

    m_eyeSliderFOV.SetPos((int)pView->m_fieldOfView);

    ::glMatrixMode(GL_PROJECTION);
    ::glLoadIdentity();
    ::gluPerspective(pView->m_fieldOfView, pView->m_aspectRatio,
                     pView->m_clipFront, pView->m_clipRear);
    ::glMatrixMode(GL_MODELVIEW);

    pView->YoRender(YO_RENDER_LIGHT);
    pView->YoRender(YO_RENDER_FULL);
    return;
}
예제 #28
0
void CStageEyeDialog::OnKillfocusEyeToy()
{
    // TODO: Add your control notification handler code here
    CMainFrame *pMainFrame = (CMainFrame *)GetTopLevelFrame();
    if (!pMainFrame || !pMainFrame->IsKindOf(RUNTIME_CLASS(CMainFrame)))
    {
        return;
    }
    CStageView *pView = (CStageView *)pMainFrame->GetActiveView();
    if (!pView || !pView->IsKindOf(RUNTIME_CLASS(CStageView)))
    {
        return;
    }
    CStageDoc *pDoc = pView->GetDocument();
    if (!pDoc || !pDoc->IsKindOf(RUNTIME_CLASS(CStageDoc)))
    {
        return;
    }
    CWnd *pCBox;
    char s[32];
    GLdouble toY;
    RECT rect;

    pMainFrame->GetWindowRect(&rect);
    if (rect.right - rect.left < YO_THRESH_WIDTH || pMainFrame->m_wndDlgEyeVisible == FALSE
            || pMainFrame->m_wndDlgEye == NULL)
    {
        return;
    }

    pCBox = (CComboBox*)pMainFrame->m_wndDlgEye->GetDlgItem(IDC_EYE_TOY);
    pCBox->GetWindowText(s, 32);
    sscanf(s, "%lf", &toY);
    pView->m_eye[4] = toY / pDoc->m_unitScaleFactor;

    ::glMatrixMode(GL_MODELVIEW);
    ::glLoadIdentity();
    ::gluLookAt(pView->m_eye[0], pView->m_eye[1], pView->m_eye[2],
                pView->m_eye[3], pView->m_eye[4], pView->m_eye[5],
                pView->m_eye[6], pView->m_eye[7], pView->m_eye[8]);

    pView->YoRender(YO_RENDER_LIGHT);
    pView->YoRender(YO_RENDER_FULL);
    return;
}
void CIwProgressPropertyPage::UpdateProgress(int nTotal, int nProcessed, const CString& sSupplierName)
{
	CProgressCtrl* ctlProgress = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS);
	ASSERT(ctlProgress != 0);
	CWnd* pWnd = GetDlgItem(IDC_STATIC_PROCESSED);
	ASSERT(pWnd != 0);
	CWnd* pManager = GetDlgItem(IDC_STATIC_MANAGER);
	ASSERT(pManager != 0);

	
	if (nTotal == -1) {
		ctlProgress->SetPos(0);
		CString sStatus = LS (L_PROCESSED_LABEL);
		pWnd->SetWindowText(sStatus);
		pManager->SetWindowText(sSupplierName);
		return;
	}

	int nPos;
	if (nProcessed == nTotal)
	{
		nPos = 100;
	}
	else
	{
		assert (nTotal != 0);
		nPos = (100 * nProcessed) / nTotal;
	}

	ctlProgress->SetPos(nPos);

	CString sManager;
	pManager->GetWindowText(sManager);
	if (sManager.Compare(sSupplierName) != 0) {
		pManager->SetWindowText(sSupplierName);
	}

	CString sStatus = LS (L_PROCESSED_LABEL);
	sStatus += " ";
	CString sTmp;
	CString sFmt = LS (L_PART_OF_TOTAL_FMT);
	sTmp.Format(sFmt, nProcessed, nTotal);
	sStatus += sTmp;
	pWnd->SetWindowText(sStatus);
}
void CNumSpinCtrl::SetValueForBuddy(int val)
{
	CWnd* pEdit = GetBuddy();
	if (!pEdit) return;
	
	int lower=0,upper=0;
	GetRange32(lower,upper);
	val=max(lower,min(upper,val));

	CString str;
	pEdit->GetWindowText(str);
	if (str.Left(2).CompareNoCase("0x")==0)
		str.Format("0x%X", val);
	else
		str.Format("%d", val);
	
	pEdit->SetWindowText (str);
}