Пример #1
0
BOOL CBonfireDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	m_xTextBuffer.InitNew();

	((CMainFrame*)AfxGetMainWnd())->m_wndProjectBar.LoadFile(this);

	// MAYBE PUT IN SETPATHNAME() LATER
	// set the syntax highlighting parser
	this->m_fnParse = LookupParser( NULL );

	// draw icon
	POSITION pos = GetFirstViewPosition();
	CChildFrame* pChild = (CChildFrame*)GetNextView(pos)->GetParentFrame();
	pChild->UpdateIcon("");

	UpdateTabs( NULL );

	// initialize the document title
	UpdateDocumentTitle( NULL );

	SwitchToFirstView();

	return TRUE;
}
BOOL CFT2OpenCVDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	//get a pointer to the view object
	POSITION posV = GetFirstViewPosition();
	CFT2OpenCVView * view = (CFT2OpenCVView *) GetNextView(posV);
	ASSERT_VALID(view);
	if (!view) {
		AfxMessageBox(_T("Failed to get view!"));
		OnCloseDocument();
	}

	//start the kinect
	m_hWnd = view->GetParentFrame()->m_hWnd;
	m_FTHelper.Init(m_hWnd, FTHelperCallingBack, this);

	namedWindow("dxColor", WINDOW_AUTOSIZE);
	namedWindow("dxDepth", WINDOW_AUTOSIZE);



	return TRUE;
}
Пример #3
0
void COleDocument::OnIdle()
{
	ASSERT_VALID(this);

	// determine if any visible views are on this document
	BOOL bVisible = FALSE;
	POSITION pos = GetFirstViewPosition();
	while (pos != NULL)
	{
		CView* pView = GetNextView(pos);
		ENSURE_VALID(pView);
		CFrameWnd* pFrameWnd = pView->EnsureParentFrame();
		if (pFrameWnd->GetStyle() & WS_VISIBLE)
		{
			bVisible = TRUE;
			break;
		}
	}

	// when state has changed, call OnShowViews
	if (bVisible != m_bLastVisible)
	{
		OnShowViews(bVisible);
		m_bLastVisible = bVisible;
	}
}
Пример #4
0
BOOL CHtmlViewOWMDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	//if (!CDocument::OnOpenDocument(lpszPathName))
	//	return FALSE;
	
	CString strURL = lpszPathName;

	CString strPath = lpszPathName;
	int posPot = strPath.ReverseFind('.');
	if(posPot > 0)
	{
		CString strExt = strPath.Right(strPath.GetLength() - posPot -1);
		strExt.MakeUpper();
		if(strExt == "BLP")
		{
			strURL = "tcl:<file>";
			strURL += lpszPathName;
		}
	}

	POSITION pos = GetFirstViewPosition();
	CHtmlViewOWMView* pView = (CHtmlViewOWMView*)GetNextView(pos);

	pView->Navigate2(strURL);

	return TRUE;
}
Пример #5
0
void CSpiroDoc::DeleteContents()
{
    INT_PTR nLast = m_arrPFigures.GetUpperBound();
    CFigure* pFig;

    POSITION pos = GetFirstViewPosition();
    CSpiroView* pView;

    if (pos != NULL)  // on shut down the view has been destroyed already
    {
        pView = (CSpiroView*)GetNextView(pos);
        ENSURE(pView != NULL && pView->IsKindOf(RUNTIME_CLASS(CSpiroView)));
        delete pView->m_pAnchor;
        delete pView->m_pWheel;
        pView->m_pAnchor = NULL;
        pView->m_pWheel = NULL;
    }

    for (int i = 0; i <= nLast; i++)
    {
        pFig = (CFigure*)m_arrPFigures.GetAt(i);
        delete pFig;
    }

    m_arrPFigures.RemoveAll();
    delete m_pFigureCurrent;
    m_pFigureCurrent = NULL;

    CDocument::DeleteContents();
}
Пример #6
0
void	 CPackageToolDoc::OnOpenGameResouce(CString strFolder)
{	
	m_nDisplayOriInfo = 2;
	if(m_pOriginResource)
	{
		m_pOriginResource->GetFilesInfo()->SetDisplayWnd(NULL);
		m_pOriginResource->Save();
	}

	if(m_pClientResource)
	{
		delete m_pClientResource;m_pClientResource=NULL;
	}
	
	string strTempt = strFolder;

	Packages TemptPackages;
	m_pClientResource = new CClientResource(GAME_RES,strTempt,TemptPackages,m_strFileInfoName);
	//装载客户端资源文件
	m_pClientResource->LoadEx();

	POSITION pos = GetFirstViewPosition();
	CView* pView = GetNextView(pos);
	if(pView)
	{
		//m_pClientResource->GetFilesInfo()->SetDisplayWnd(pView->m_hWnd);
		//m_pClientResource->GetFilesInfo()->UpdateAllInfoToView(NULL);
		m_pClientResource->GetFilesInfo()->UpdateAllInfoToViewEx(pView->m_hWnd);
	}
}
Пример #7
0
void CMUSHclientDoc::CheckTickTimers ()
  {

  // timer has kicked in unexpectedly - ignore it
  if (m_CurrentPlugin)
    return;

  // check for selection change in command window
  // I know, this is a crappy way of doing it, but the CEditView does 
  // not notify of selection changes.

  for(POSITION commandpos=GetFirstViewPosition();commandpos!=NULL;)
    {
    CView* pView = GetNextView(commandpos);

    if (pView->IsKindOf(RUNTIME_CLASS(CSendView)))
      {
      CSendView* pmyView = (CSendView*)pView;

      pmyView->CheckForSelectionChange ();
      }	  // end of being a CSendView
    }

  SendToAllPluginCallbacks (ON_PLUGIN_TICK);

  } // end of CMUSHclientDoc::CheckTickTimers
void CNuGenDimensionDoc::OnSTLImport()
{
	CString     Path;

	CFileDialog dlg(
		TRUE,
		NULL,               // Open File Dialog
		_T("*.stl"),              // Default extension
		OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, // No default filename
		_T("STL (*.stl)|*.stl||"));// Filter string

	if (dlg.DoModal() != IDOK)
		return;
	Path = dlg.GetPathName();

	GetDocTemplate()->OpenDocumentFile(NULL);

	sgFileManager::ImportSTL(sgGetScene(),Path.GetBuffer());

	POSITION pos = GetFirstViewPosition();
	while (pos != NULL)
	{
		CView* pView = GetNextView(pos);
		pView->OnInitialUpdate();
	}
	//AfxMessageBox("Sorry, its DEMO");
}
Пример #9
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();
}
Пример #10
0
void CDrawDoc::ComputePageSize()
{
	CSize new_size(850, 1100);  // 8.5" x 11" default

	CPrintDialog dlg(FALSE);
	if (AfxGetApp()->GetPrinterDeviceDefaults(&dlg.m_pd))
	{
		// GetPrinterDC returns a HDC so attach it
		CDC dc;
		HDC hDC= dlg.CreatePrinterDC();
		ASSERT(hDC != NULL);
		dc.Attach(hDC);

		// Get the size of the page in loenglish
		new_size.cx = MulDiv(dc.GetDeviceCaps(HORZSIZE), 1000, 254);
		new_size.cy = MulDiv(dc.GetDeviceCaps(VERTSIZE), 1000, 254);
	}

	// if size changed then iterate over views and reset
	if (new_size != m_size)
	{
		m_size = new_size;
		POSITION pos = GetFirstViewPosition();
		while (pos != NULL)
			((CDrawView*)GetNextView(pos))->SetPageSize(m_size);
	}
}
Пример #11
0
// **************************************************************************
// RouteCmdMsg ()
//
// Description:
//	Routes a message onto all inactive views or until one of the views 
//	processes the message.
//
// Parameters:
//	CView				*pActiveView	Pointer to the active view.
//	UINT				nID				Specifies the container for the 
//										  command identifier. 
//	int					nCode			Identifies the command notification
//										  code.
//	void				*pExtra			Used according to the value of 
//										  nCode.
//	AFX_CMDHANDLERINFO	*pHandlerInfo	If not NULL, OnCmdMsg fills in the
//										  pTarget and pmf members of the 
//										  pHandlerInfo structure instead of
//										  dispatching the command. Typically, 
//										  this parameter should be NULL.
//
// Returns:
//  BOOL - TRUE if message was processed.
// **************************************************************************
BOOL CKDocument::RouteCmdMsg (CView *pActiveView, UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo)
	{
	// Get the position of the first view in the list of views associated
	// with this document:
	POSITION pos = GetFirstViewPosition ();

	// Exhaust all views.  When we get to end of list of views, pos will be NULL:
	while (pos != NULL)
		{
		// Get pointer to view at present POSITION (pos).  Function will
		// automatically reset pos to POSITION of next view, or NULL if 
		// end of list:
		CView *pNextView = GetNextView (pos);

		// By definition, we do no send message to active view:
		// (We shouldn't get called if active view processes the message.)
		if (pNextView != pActiveView)
			{
			// If the view processes the message then we are a success.  Return TRUE
			// to indicate message was processed:
			if (((CCmdTarget *) pNextView)->OnCmdMsg (nID, nCode, pExtra, pHandlerInfo))
				return (TRUE);
			}
		}

	// If we make it here, then message not processed.  Return FALSE to
	// indicate that message was not processed.
	return (FALSE);
	}
Пример #12
0
CFracticeView *CFracticeDoc::GetView() const
{
	POSITION	pos = GetFirstViewPosition();
	CFracticeView	*View = DYNAMIC_DOWNCAST(CFracticeView, GetNextView(pos));
	ASSERT(View);
	return(View);
}
Пример #13
0
void CPhotoPubDoc::OnBnClickedWatch()
{
	char szDir[MAX_PATH];
	BROWSEINFO bi;
	ITEMIDLIST *pidl;
	bi.hwndOwner = NULL;
	bi.pidlRoot = NULL;
	bi.pszDisplayName = szDir;
	bi.lpszTitle = "请选择要监视的文件夹:";
	bi.ulFlags = BIF_RETURNONLYFSDIRS;
	bi.lpfn = NULL;
	bi.lParam = 0;
	bi.iImage = 0;
	pidl = SHBrowseForFolder(&bi);
	if(pidl == NULL)
		return;
	if(!SHGetPathFromIDList(pidl, szDir))
		return;
	CString SrcPath(szDir);

	POSITION pos=GetFirstViewPosition();
	CPhotoPubView* pView=(CPhotoPubView*) GetNextView(pos);
	if (!pView->SetupWatching(SrcPath))
		return;
	
	m_bWatching=true;
	((CMainFrame *)pView->GetParentFrame())->SetWatching(m_bWatching);
}
void CABMOfficeSystemcppDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}

	// Calling the base class COleDocument enables serialization
	//  of the container document's COleClientItem objects.
	COleDocument::Serialize(ar);
	// activate the first one
	if (!ar.IsStoring())
	{
		POSITION posItem = GetStartPosition();
		if (posItem != NULL)
		{
			CDocItem* pItem = GetNextItem(posItem);
			POSITION posView = GetFirstViewPosition();
			COleDocObjectItem *pDocObjectItem = DYNAMIC_DOWNCAST(COleDocObjectItem, pItem);
			if (posView != NULL && pDocObjectItem != NULL)
			{
				CView* pView = GetNextView(posView);
				pDocObjectItem->DoVerb(OLEIVERB_SHOW, pView);
			}
		}
	}
}
Пример #15
0
//当打开一个文件时调用
void CPackageToolDoc::OnOpenfolder(CString strFolder)
{
	if(strFolder == "")	return;
	if(m_nDisplayOriInfo == 1)
	{
		::AfxMessageBox("已打开原始资源信息!");
		return;
	}
	m_nDisplayOriInfo=1;

	m_strCurFolder = strFolder;

	if(m_pOriginResource)
	{
		delete m_pOriginResource;
	}

	POSITION pos = GetFirstViewPosition();
	CView* pView = GetNextView(pos);
	if(pView)
	{
		Packages TemptPackages;
		m_pOriginResource = new CClientResource(ORIGIN_RES,m_strCurFolder,TemptPackages,m_strFileInfoName,
			pView->m_hWnd);
		m_pOriginResource->LoadClientResource();
	}
}
Пример #16
0
void	CPackageToolDoc::OpenDefaultProject()
{

	if(m_nDisplayOriInfo == 1)
	{
		AfxMessageBox("已打开原始资源信息!");
		return;
	}
	m_nDisplayOriInfo=1;

	if(m_pOriginResource)
	{
		delete m_pOriginResource;
	}

	POSITION pos = GetFirstViewPosition();
	CView* pView = GetNextView(pos);
	if(pView)
	{
		Packages TemptPackages;
		m_pOriginResource = new CClientResource(ORIGIN_RES,m_strCurFolder,TemptPackages,m_strFileInfoName,pView->m_hWnd);
		CString strTempt2("");
		if(m_pOriginResource->Load()==false)
		{
			CString str;
			str.Format("没有信息文件,请重新打开该文件夹进行信息统计.");
			AfxMessageBox((LPCTSTR)str);
		}

	}
}
Пример #17
0
void CMUSHclientDoc::SetWorldWindowStatus(short Parameter) 
{

CFrameWnd* pParent = NULL;

  for(POSITION pos=GetFirstViewPosition();pos!=NULL;)
    {
    CView* pView = GetNextView(pos);

    if (pView->IsKindOf(RUNTIME_CLASS(CSendView)))
      {
      CSendView* pmyView = (CSendView*)pView;

      pParent = pmyView->GetParentFrame ();

      break;

      }	
    }

  if (pParent)
    {
    switch (Parameter)
      {
      case 1: pParent->ShowWindow(SW_SHOWMAXIMIZED); break;
      case 2: pParent->ShowWindow(SW_MINIMIZE); break;
      case 3: pParent->ShowWindow(SW_RESTORE); break;
      case 4: pParent->ShowWindow(SW_SHOWNORMAL); break;
      } // end of switch
    } // have parent
}  // end of CMUSHclientDoc::SetWorldWindowStatus
Пример #18
0
BOOL CDocument::CanCloseFrame(CFrameWnd* pFrameArg)
	// permission to close all views using this frame
	//  (at least one of our views must be in this frame)
{
	ASSERT_VALID(pFrameArg);
	UNUSED(pFrameArg);   // unused in release builds

	POSITION pos = GetFirstViewPosition();
	while (pos != NULL)
	{
		CView* pView = GetNextView(pos);
		ASSERT_VALID(pView);
		CFrameWnd* pFrame = pView->GetParentFrame();
		// assume frameless views are ok to close
		if (pFrame != NULL)
		{
			// assumes 1 document per frame
			ASSERT_VALID(pFrame);
			if (pFrame->m_nWindow > 0)
				return TRUE;        // more than one frame refering to us
		}
	}

	// otherwise only one frame that we know about
	return SaveModified();
}
Пример #19
0
void CMUSHclientDoc::MoveWorldWindowX(long Left, 
                                      long Top, 
                                      long Width, 
                                      long Height, 
                                      short Which) 
{
int i = 0;

  for(POSITION pos=GetFirstViewPosition();pos!=NULL;)
    {
    CView* pView = GetNextView(pos);

    if (pView->IsKindOf(RUNTIME_CLASS(CSendView)))
      {
      CSendView* pmyView = (CSendView*)pView;

      i++;

      if (i != Which)
        continue;   // wrong one

      pmyView->GetParentFrame ()->MoveWindow (Left, Top, Width, Height);

      break;

      }	
    }

}   // end of CMUSHclientDoc::MoveWorldWindowX
Пример #20
0
// warning - different in Lua
BSTR CMUSHclientDoc::GetWorldWindowPositionX(short Which) 
{
CString strResult;
int i = 0;

  CWindowPlacement wp;

  for(POSITION pos=GetFirstViewPosition();pos!=NULL;)
    {
    CView* pView = GetNextView(pos);

    if (pView->IsKindOf(RUNTIME_CLASS(CSendView)))
      {
      CSendView* pmyView = (CSendView*)pView;

      i++;

      if (i != Which)
        continue;   // wrong one

      pmyView->GetParentFrame ()->GetWindowPlacement(&wp); 
    	windowPositionHelper (strResult, wp.rcNormalPosition);

      break;

      }	
    }

	return strResult.AllocSysString();
}   // end of CMUSHclientDoc::GetWorldWindowPositionX
Пример #21
0
void CLlinesDoc::GetView()
{
				// Позиция первого Вида, связанного с Документом
	POSITION pos = GetFirstViewPosition();
				// Указатель на первый Вид из списка всех Видов Документа
	pView =(CLlinesView*) GetNextView(pos);
}
Пример #22
0
void CMUSHclientDoc::NoteHr() 
{
  // wrap up previous line if necessary
  if (m_pCurrentLine->len > 0)
     StartNewLine (true, 0);

  // mark line as HR line
  m_pCurrentLine->flags = HORIZ_RULE;
  
  StartNewLine (true, 0); // now finish this line

  // refresh views

  for(POSITION pos=GetFirstViewPosition();pos!=NULL;)
	  {
	  CView* pView = GetNextView(pos);
	  
	  if (pView->IsKindOf(RUNTIME_CLASS(CMUSHView)))
  	  {
		  CMUSHView* pmyView = (CMUSHView*)pView;

		  pmyView->addedstuff();
	    }	
    }

}  // end of CMUSHclientDoc::NoteHr
Пример #23
0
void 
CTimeSliceDoc::initAllViews()
{
   POSITION	     pos = GetFirstViewPosition();
   CTimeSliceView*   pView = NULL;

   unsigned int   uiCameraToView = 0;
   
   while ( pos != NULL )
   {
      pView = (CTimeSliceView*)GetNextView( pos );
      
      if( uiCameraToView >= m_uiNumCameras )
      {
	 //
	 // Special case - the last view is the panning view.
	 //
	 pView->setViewType( PANNING );	    
      }
      else
      {
	 pView->setCamera( uiCameraToView );
	 pView->setViewType( SINGLE_CAMERA );
      }
      
      uiCameraToView++;
   }  
}
Пример #24
0
void
DviDoc::OnIdle ()
{
  try
    {
      CDocument::OnIdle ();
      DviFileStatus oldStatus = fileStatus;
      DviFileStatus newStatus = GetDviFileStatus();
      if (newStatus == DVIFILE_MODIFIED)
	{
	  YapLog (T_("document has been modified"));
	  POSITION posView = GetFirstViewPosition();
	  while (posView != 0)
	    {
	      CView * pView = GetNextView(posView);
	      if (pView->IsKindOf(RUNTIME_CLASS(DviView)))
		{
		  DviView * pDviView = reinterpret_cast<DviView*>(pView);
		  if (! pDviView->PostMessage(WM_COMMAND, ID_VIEW_REFRESH))
		    {
		      // unexpected
		    }
		}
	    }
	}
      else if (pDvi != 0)
	{
	  pSession->UnloadFilenameDatabase (); // <fixme/>
	}
    }
  catch (const exception &)
    {
    }
}
Пример #25
0
void CxEditDoc::Serialize(CArchive& ar)
{
   POSITION pos = GetFirstViewPosition();
   CxEditView* pView = (CxEditView*)GetNextView(pos);
   ASSERT_KINDOF(CxEditView, pView);
   pView->SerializeRaw(ar);
}
Пример #26
0
/*****************************************************************************************
	<< --- CNPainterDoc::computePageSize	2013-12-04 --- >>
	说明:根据系统设定的打印机得到itobjPage信息
	参数:
	返回值:
*****************************************************************************************/
void CNPainterDoc::computePageSize()
{
	PRINTDLG pd = {0};
	CSize oldSize = m_objAdmin.getPager()->getPaperInfo().bsSize.toMSSize();// m_objPaper.getPaperInfo().bsSize.toMSSize();
	if(AfxGetApp()->GetPrinterDeviceDefaults(&pd))
	{
		DEVMODE *pdev = (DEVMODE*)GlobalLock(pd.hDevMode);
		if(pdev)
		{
			gtc::BSPaperInfo &paper = m_objAdmin.getPager()->getPaperInfo();
			paper.iOrientation = pdev->dmOrientation;
			paper.iSize = pdev->dmPaperSize;
			paper.bsSize.width = pdev->dmPaperWidth;
			paper.bsSize.height = pdev->dmPaperLength;
			paper.wsName = pdev->dmFormName;
			GlobalUnlock(pd.hDevMode);

			m_objAdmin.getPager()->refresh();
		}
	}
	//if(oldSize != m_objPaper.getPaperInfo().bsSize.toMSSize())
	{	// 刷新工作区
		POSITION pos = GetFirstViewPosition();
		if(pos != NULL)
			((CNPainterView*)GetNextView(pos))->OnUpdate(nullptr, HINT_UPDATE_WINDOW, nullptr);
	}

}
Пример #27
0
CProjectView* CProjectDoc::GetProjectView()
{
   POSITION pos = GetFirstViewPosition();
   if (pos == NULL)
      return NULL;
   else
      return (CProjectView*)GetNextView(pos);
}
Пример #28
0
CDComView *CDComDoc::GetView()
{
    POSITION viewPos;
    CDComView *pView;
    viewPos = GetFirstViewPosition();
    pView = (CDComView*)GetNextView(viewPos);
    return pView;
}
Пример #29
0
/**
 * @brief Stash away our view pointer.
 */
void CDirDoc::SetDirView(CDirView * newView)
{
	m_pDirView = newView;
	// MFC has a view list for us, so lets check against it
	POSITION pos = GetFirstViewPosition();
	CDirView * temp = static_cast<CDirView *>(GetNextView(pos));
	ASSERT(temp == m_pDirView); // verify that our stashed pointer is the same as MFC's
}
Пример #30
0
BOOL CScintillaDoc::OnSaveDocument(LPCTSTR lpszPathName) 
{  
   POSITION pos = GetFirstViewPosition();
   CScintillaView *pFirstView = (CScintillaView*)GetNextView( pos ); // assume only one view
   if (pFirstView != NULL)
      return pFirstView->Save(lpszPathName);
	return CDocument::OnSaveDocument(lpszPathName);
}