예제 #1
0
void CServerDoc::OnSetItemRects(LPCRECT lpPosRect, LPCRECT lpClipRect)
{
	// get first view of document
	POSITION pos = GetFirstViewPosition();
	ASSERT(pos != NULL);
	CServerView* pView = (CServerView*)GetNextView(pos);
	ASSERT_KINDOF(CServerView, pView);
	ASSERT_VALID(pView);

	CSize sizeNum(lpPosRect->right - lpPosRect->left,
		lpPosRect->bottom - lpPosRect->top);
	// for denom -- get extent in device
	// create a view dc
	CServerDC dc(pView);
	// set zoom to 100%
	dc.SetViewportExt(CSize(1,1));
	dc.SetWindowExt(CSize(1,1));
	// get extents in device
	CSize sizeDenom = pView->CalcActualItemSize(m_pRoot, &dc);

	// notify first view of potential zoom factor change!
	pView->SetZoomFactor(sizeNum, sizeDenom);
	// resize the window
	COleServerDoc::OnSetItemRects(lpPosRect, lpClipRect);
	// set scrollbar state (if necessary)
	pView->SetScrollInfo();
}
예제 #2
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);
	}
}							  
예제 #3
0
void CMainFrame::OnPingboosterChangevalue()
{
	// TODO: Add your command handler code here
	CServerView* serverview = (CServerView*)m_wndSplitter.GetPane(0,0);
	CServerDoc* doc = (CServerDoc*)serverview->GetDocument();
	
	CPingBoosterDialog dlg(doc->getBoosterValue(),this);

	if (dlg.DoModal() == IDOK)
	{
		doc->setBoosterValue(dlg.getValue());
	}
}
예제 #4
0
afx_msg LRESULT CMainFrame::OnUpdateMenu(WPARAM wParam, LPARAM lParam)
{
	CServerView* serverview = (CServerView*)m_wndSplitter.GetPane(0,0);
	CServerDoc* doc = (CServerDoc*)serverview->GetDocument();

	CMenu* menu = GetMenu();
	ASSERT(menu);

	if (doc->boosts())
	{
		menu->CheckMenuItem(ID_PINGBOOSTER_RUN,MF_BYCOMMAND | MF_CHECKED);
		menu->EnableMenuItem(ID_PINGBOOSTER_CHANGEVALUE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}
	return 0;
}
예제 #5
0
void CMainFrame::OnClose()
{
	// TODO: Add your message handler code here and/or call default

	// stopping the servers must be done here for some reason I forgot (prolly cause else the program crashes when trying to get the document)
	CServerView* serverview = (CServerView*)m_wndSplitter.GetPane(0,0);
	CServerDoc* doc = (CServerDoc*)serverview->GetDocument();
	bool no_kill = false;
	if (doc->runningServers())
	{
		int res = MessageBox("Shut down servers?\r\n\r\nNote: When running ServerChecker again, you must stop these servers manually first!\r\nServerChecker cannot obtain control over running servers.","Servers:",MB_YESNOCANCEL |MB_APPLMODAL | MB_ICONQUESTION );
		if (res != IDCANCEL)
			no_kill = (res == IDNO);
		else
			return;
	}
	doc->stopAllServers(no_kill);
	CFrameWnd::OnClose();
}
예제 #6
0
void CImage::SetViewMode(VIEW_MODE ViewMode)
{
if (m_ViewMode == ViewMode)
    return;
m_ViewMode = ViewMode;
if (InMaskEditMode())
    {
    ImgColorMapChanged(this);
	ImgInitDisplay(this);
	CServerDoc *pDoc = PictPubApp.GetDocument(this);
	if (pDoc)
		{
		CServerView *pView = pDoc->GetActiveView();
		if (pView)
	    	pView->SetupImageDisplayPalette();
		}
   }
UpdateImage(this, NULL, YES);
}
예제 #7
0
void CMainFrame::OnPingboosterRun()
{
	// TODO: Add your command handler code here
	CMenu* menu = GetMenu();
	UINT state = menu->GetMenuState(ID_PINGBOOSTER_RUN,MF_BYCOMMAND);
	UINT teststate = menu->GetMenuState(ID_PINGBOOSTER_CHANGEVALUE,MF_BYCOMMAND);
	bool turnon = !(state & MF_CHECKED);
	if (!turnon)
	{
		menu->CheckMenuItem(ID_PINGBOOSTER_RUN,MF_BYCOMMAND | MF_UNCHECKED);
		menu->EnableMenuItem(ID_PINGBOOSTER_CHANGEVALUE, MF_BYCOMMAND | MF_ENABLED);
	}
	else
	{
		menu->CheckMenuItem(ID_PINGBOOSTER_RUN,MF_BYCOMMAND | MF_CHECKED);
		menu->EnableMenuItem(ID_PINGBOOSTER_CHANGEVALUE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
	}

	CServerView* serverview = (CServerView*)m_wndSplitter.GetPane(0,0);
	CServerDoc* doc = (CServerDoc*)serverview->GetDocument();
	doc->boost(turnon);
}
예제 #8
0
LOCAL BOOL FullScreenView_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
{
	CPPMDIChildWnd *pMDIChild;
	HWND hMDIWnd;
	RECT ClientRect;
	int npix, nlin, cx, cy, dx, dy;
	HWND hControl, hMDIChild, hView;
	LPOBJECT lpBase;
	LPFRAME lpFrame;

	// Make the window as big as the screen
	dx = GetSystemMetrics( SM_CXSCREEN );
	dy = GetSystemMetrics( SM_CYSCREEN );
	MoveWindow( hDlg, 0, 0, dx, dy, NO );

	// Compute the center of the window
	GetClientRect( hDlg, &ClientRect );
	cx = ( ClientRect.right + ClientRect.left ) / 2;
	cy = ( ClientRect.bottom + ClientRect.top ) / 2;

	// Link all of the images to image controls
	hControl = GetDlgItem( hDlg, IDC_VIEWFULL );

	CServerView *pView = PictPubApp.GetActiveView();
	BOOL bInplaceActive = (pView && pView->GetDocument()->IsInPlaceActive());
	if (bInplaceActive)
	{
		hMDIChild = pView->GetParentFrame()->GetSafeHwnd();
		hView = pView->GetSafeHwnd();
	}
	else
	{
		pMDIChild = (CPPMDIChildWnd*)((CMDIFrame*)PictPubApp.m_pMainWnd)->MDIGetActive();
		hMDIWnd = pMDIChild->GetSafeHwnd();
		if (hMDIWnd)
			hView = pMDIChild->GetActiveView()->GetSafeHwnd();
		else
			hView = NULL;
	}

	while ( hView )
 	{
		lpBase = ImgGetBase((LPIMAGE)GetImagePtr(hView));
		if ( !lpBase || !hControl )
			break;
		lpFrame = ObjGetEditFrame(lpBase);

		// Link the frame to the image control
		SetWindowLong( hControl, GWL_IMAGE, (long)lpBase );
			
		// The destination size can be no bigger the the screen
		npix = FrameXSize(lpFrame);
		nlin = FrameYSize(lpFrame);
		if ( npix > dx || nlin > dy )
 		{
			npix = dx;
			nlin = dy;
			ScaleToFit( &npix, &nlin,
				FrameXSize(lpFrame), FrameYSize(lpFrame));
 		}

		// Position the control in the center of the window
		ClientRect.left = cx - npix/2;
		ClientRect.right = ClientRect.left + npix;
		ClientRect.top = cy - nlin/2;
		ClientRect.bottom = ClientRect.top + nlin;
		MoveWindow( hControl,
			ClientRect.left, ClientRect.top, // New position
			RectWidth( &ClientRect ),
			RectHeight( &ClientRect ), // New size
			NO /* No repaint*/ );

		if (bInplaceActive)
			break;

		// Check to see if these get destroyed when the window does
		do	
		{
			hView = NULL;
			if (hMDIWnd = GetWindow( hMDIWnd, GW_HWNDNEXT ))
			{
				if ((CWnd::FromHandle(hMDIWnd))->
					IsKindOf(RUNTIME_CLASS(CPPMDIChildWnd)))
					hView = ((CPPMDIChildWnd*)CWnd::FromHandle(hMDIWnd))->
						GetActiveView()->GetSafeHwnd();
			}

		} while (hMDIWnd && !hView);

		if (!hView)
			break;

		// Get another image control				 
		hControl = CopyWindow( hControl );
	}

	return TRUE;
}
예제 #9
0
/***********************************************************************/
{
clr ((LPTR)lpDisp, sizeof(DISPLAY));
lpDisp->ResizeType = SIZE_RESTORED;
}

//************************************************************************
//	HookZoom
//		hooks the zoom window into the current image.
//		If there is no zoom window one is created.
//		If there is No acive window, or no active Image then
//			it destroys itself;
//		Returns true if zoom window is successfuly hooked.
//************************************************************************/
BOOL HookZoom()
//************************************************************************/
{
	LPIMAGE lpNewImage;
	BOOL fHide;
	CServerView *pView = PictPubApp.GetActiveView();
 	HWND hZoomParentWnd = PictPubApp.Get_hWndAstral();;

	if (!Window.fHasZoom)
		return (FALSE);

	if (pView && pView->GetDocument() && pView->GetDocument()->m_lpImage)
	{
		lpNewImage = pView->GetDocument()->m_lpImage;
    	if (pView->GetDocument()->IsInPlaceActive())
			hZoomParentWnd = ((CInPlaceFrame*)pView->GetParentFrame())->GetClientFrameWnd();
	}
	else
		lpNewImage = NULL;

	if (!hZoomWindow && pView->GetSafeHwnd()) // try to create zoom window
	{
		if (!NewZoomWindow( hZoomParentWnd ))
		{
			Window.fHasZoom = FALSE;
			return (FALSE);
		}
	}

	if (pView->GetSafeHwnd() == NULL && hZoomWindow) // Must destroy itself
	{
		DestroyWindow(hZoomWindow);
		hZoomWindow = NULL;
		return(FALSE);
	}

	if (pView->GetSafeHwnd() == GetZoomOwner(hZoomWindow))
		return(TRUE);

 	fHide = (pView->GetSafeHwnd() != PictPubApp.Get_hActiveWindow());
	ShowWindow(hZoomWindow, SW_HIDE);

	SetZoomOwner(hZoomWindow, pView->GetSafeHwnd());

    SetImagePtr (hZoomWindow, lpNewImage);

	ZoomSizeToDef(); // recompute size & pos
	ComputeZoomDisp();

	if (!fHide && !IsWindowVisible(hZoomWindow))
		 ShowWindow(hZoomWindow, SW_SHOWNA);

	return (TRUE);
}
예제 #10
0
LOCAL LPCMDLIST ProgActivateWindow(LPACTIVATEWINDOW_PARMS lpParms)
/***********************************************************************/
{
int iOffset, nDocs;
CWnd *pActiveWnd, *pNextWnd, *pChild;
CMDIFrameWnd *pMainWnd;
	
pNextWnd = NULL;

pMainWnd = (CMDIFrameWnd *)PictPubApp.m_pMainWnd;

// first look for the filename
CServerDoc *pDoc = PictPubApp.GetDocument(lpParms->szFileName);
if (pDoc)
	{
	// ignore if we are in place
	if (pDoc->IsInPlaceActive())
		return(NULL);

	POSITION ViewPos = pDoc->GetFirstViewPosition();
	if (ViewPos)
		{
	    CView* pView = pDoc->GetNextView( ViewPos );
		if (pView)
			pNextWnd = pView->GetParent();
		}
	}

// if not found, try using windows offsets
if (!pNextWnd && lpParms->iOffset)
	{
	nDocs = 0;
	pChild = pActiveWnd = pMainWnd->MDIGetActive();
	while (pChild)
		{
		++nDocs;
		pChild = pChild->GetWindow(GW_HWNDNEXT);
		}

	if (nDocs)
		{
		iOffset = lpParms->iOffset;
		pNextWnd = pActiveWnd;
		if (iOffset > 0)
			{
			if (iOffset >= nDocs)
				iOffset = nDocs - 1;
			while(pNextWnd && (--iOffset >= 0))
				pNextWnd = pNextWnd->GetWindow(GW_HWNDNEXT);
			}
		else
			{
			if (iOffset <= (-nDocs))
				iOffset = (-nDocs) + 1;
			while(pNextWnd && (++iOffset <= 0))
				pNextWnd = pNextWnd->GetWindow(GW_HWNDPREV);
			}
		}
	}

if (pNextWnd)
	{
	CPPMDIChildWnd *pMDIChild = (CPPMDIChildWnd *)pNextWnd;
	CServerView *pView = (CServerView*)pMDIChild->GetActiveView();
	if (pView)
		{
        CServerDoc *pDoc = pView->GetDocument();
       	ASSERT(pDoc && pDoc->m_lpImage);
		if (pDoc && pDoc->m_lpImage && !pDoc->IsInPlaceActive())
			{
			pMainWnd->MDIActivate(pNextWnd);
			return(pDoc->m_lpImage->lpCmdList);
			}
		}
	}
return(NULL);
}