//////////////////////////////TWAIN Specific////////////////////////////////////////
void CFPAnalysisView::OnFileScan() 
{
	
    CFPAnalysisDoc* pDoc = GetDocument();

   	CScanDlg dlg;
	if (dlg.DoModal() == IDOK)
	{
		currentimage.SetFilename(dlg.m_szImageName);
		currentimage.LoadBMP();
		Invalidate(FALSE);
		pDoc->SetTitle(dlg.m_szImageName);
	}

	//set the size of view to image-size...
	  CChildFrame* pParent =(CChildFrame*)GetParentFrame();
	  CRect rcParent;

	  rcParent.left = 0;
	  rcParent.top =0;
	  rcParent.right = (int)currentimage.GetWidth();
	  rcParent.bottom = (int)currentimage.GetHeight();
	  pParent->MoveWindow(&rcParent);

	  
	  SetFPScrollInfo();

      // Refresh the entire view...
	  Invalidate(TRUE);	
}
/////////////////////// Drag & Drop support //////////////////
void CFPAnalysisView::OnDropFiles(HDROP hDropInfo) 
{
	CFPAnalysisDoc* pDoc = GetDocument();

    WORD dwFiles;
    char lpszFile[80];

	//Drop only one file at a time, so if more than one file has been dropped, the 
	//action is disallowed.
 
	dwFiles = ::DragQueryFile(hDropInfo,0xFFFFFFFF,(LPTSTR)NULL,0);

	if (dwFiles > 1)
	   return;

	//Handle one file at a time

	// Get the name of the file dropped...
    ::DragQueryFile(hDropInfo,0,lpszFile,sizeof(lpszFile));
	
	//DEBUG
	AfxMessageBox(lpszFile);

	//Be sure that file is BMP file
	if (strstr(lpszFile,".BMP"))
	{
	    currentimage.SetFilename(lpszFile);
		currentimage.LoadBMP();
		Invalidate(FALSE);
		pDoc->SetTitle(lpszFile);
	}
	else
		AfxMessageBox("Incorrect File Type.", MB_ICONSTOP);

	//set the size of view to image-size...
	 CChildFrame* pParent =(CChildFrame*)GetParentFrame();
	 CRect rcParent;

	 rcParent.left = 0;
	 rcParent.top =0;
	 rcParent.right = (int)currentimage.GetWidth();
	 rcParent.bottom = (int)currentimage.GetHeight();
	 pParent->MoveWindow(&rcParent);

	 //initialize zoom-specific members
	 m_nNum = m_nDen = 1;
	 SetFPScrollInfo();

     // Refresh the entire view...
	 Invalidate(TRUE);		
	
	 //Call base class's implementation
	 CScrollView::OnDropFiles(hDropInfo);
}
void CFPAnalysisView::OnFileOpen() 
{
  CFPAnalysisDoc* pDoc = GetDocument();

  
  CString sFilename;
  CString sFilt="BMP (*.bmp)|*.bmp|All files (*.*)|*.*||";

  CFileDialog dlg(
		TRUE,				// Create an open file dialog
		"*.BMP",			// Default file extension
		NULL,				// Filename
		OFN_HIDEREADONLY |	// Flags - don't show the read only check box)
		OFN_FILEMUSTEXIST,	//       - make sure file exists
		sFilt);				// the file filter

  dlg.m_ofn.lpstrTitle = "Choose The Fingerprint Bitmap...";  //set the title

	if (dlg.DoModal()==IDOK)
	{
		sFilename = dlg.GetPathName();
		CString sExt = dlg.GetFileExt();
		CString sFilenameShort= dlg.GetFileName();

		if (!sExt.CompareNoCase("BMP"))
		{
			currentimage.SetFilename(sFilename);
			currentimage.LoadBMP();
			Invalidate(FALSE);
			pDoc->SetTitle(sFilenameShort);
		}
		else
			AfxMessageBox("Incorrect File Type.", MB_ICONSTOP);
		
	}

	  //set the size of view to image-size...
	  CChildFrame* pParent =(CChildFrame*)GetParentFrame();
	  CRect rcParent;

	  rcParent.left = 0;
	  rcParent.top =0;
	  rcParent.right = (int)currentimage.GetWidth();
	  rcParent.bottom = (int)currentimage.GetHeight();
	  pParent->MoveWindow(&rcParent);

	  //initialize zoom-specific members
	  m_nNum = m_nDen = 1;
	  SetFPScrollInfo();

      // Refresh the entire view...
	  Invalidate(TRUE);				
}
Esempio n. 4
0
void CMainFrame::OnWindowTogglemax() 
{
	BOOL bIfMaximized;
  CChildFrame *pActiveWnd = (CChildFrame *) MDIGetActive( &bIfMaximized);
  if( bIfMaximized)
  {
    MDIRestore( pActiveWnd);
    if( !pActiveWnd->m_bAllreadyUnmaximized)
    {
      pActiveWnd->MoveWindow( 0, 0, 256, 256);
      RECT rectClient;
      pActiveWnd->GetClientRect( &rectClient);
      PIX pixRightWidth = 256+256-rectClient.right+4;
      PIX pixRightHeight = 256+256-rectClient.bottom+4;
      pActiveWnd->MoveWindow( 0, 0, pixRightWidth, pixRightHeight);
      pActiveWnd->m_bAllreadyUnmaximized = TRUE;
    }
  }
  else
  {
    MDIMaximize( pActiveWnd);
  }
  theApp.m_chGlobal.MarkChanged();
}