Exemplo n.º 1
0
void CZoomCombo::NotifyChanged(int code)
{
	int		nIndex;
	int 	iPercentages[NUM_PERCENTAGES] = {1600, 800, 400, 200, 100, 75, 50, 25};
	int		idCommands[NUM_COMMANDS] = {IDC_CUSTOMVIEW, IDC_VIEWLAST, IDC_VIEW1TO1, IDC_VIEWALL, IDC_VIEWFULL};
	int		iPercentage = 0;

	CServerView *pView = PictPubApp.GetActiveView();
	if (pView == NULL)
		return;

	if (code == CBN_KILLFOCUS)
	{
		BOOL 	bTranslated;
		iPercentage = GetDlgItemInt(GetParent(m_hWnd), GetDlgCtrlID(m_hWnd), &bTranslated, FALSE);
		if (!iPercentage)
			return;
	}
	else
	{
		if ( code != CBN_SELCHANGE )
			return;
		nIndex = ComboBox_GetCurSel(m_hWnd);
	}
	if (iPercentage || nIndex < NUM_PERCENTAGES)
	{
		if (!iPercentage)
			iPercentage = iPercentages[nIndex];
		if (iPercentage != ZoomForum.GetViewPercentage())
		{
			if (!ZoomEnable( pView->GetSafeHwnd(), iPercentage, FALSE))
			{
			    Message( IDS_BADZOOM );
				SetFocus(m_hWnd);
				return;
			}
    		int x = ( pView->m_lpDisplay->FileRect.left 
            		+ pView->m_lpDisplay->FileRect.right ) / 2;
    		int y = ( pView->m_lpDisplay->FileRect.top 
            		+ pView->m_lpDisplay->FileRect.bottom ) / 2;
    		SaveLastView(pView->GetSafeHwnd());
    		Zoom(pView->GetSafeHwnd(), x, y, iPercentage, NO, CONTROL );
		}
	}
	else
	{
		nIndex -= NUM_PERCENTAGES;
		int idCommand = idCommands[nIndex];
		HWND hWnd = PictPubApp.m_pMainWnd->GetSafeHwnd();
		FORWARD_WM_COMMAND(hWnd, idCommand, m_hWnd, 0, SendMessage);
	}
}							  
Exemplo n.º 2
0
afx_msg void CServerView::on_update_zoom(int idCmd, CCmdUI* pCmdUI)
{
    if (IsCmdEnabled(0, this) && m_lpDisplay->ViewPercentage)
    {
        int inc;

        if (idCmd == IDC_ZOOMIN)
            inc = 100;
        else
            inc = -100;
        pCmdUI->Enable(	ZoomEnable(GetSafeHwnd(), inc, YES) );
    }
    else
        pCmdUI->Enable( FALSE );
}