コード例 #1
0
ファイル: oledoc1.cpp プロジェクト: anyue100/winscp
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);
		ASSERT_VALID(pView);
		CFrameWnd* pFrameWnd = pView->GetParentFrame();
		ASSERT_VALID(pFrameWnd);
		if (pFrameWnd->GetStyle() & WS_VISIBLE)
		{
			bVisible = TRUE;
			break;
		}
	}

	// when state has changed, call OnShowViews
	if (bVisible != m_bLastVisible)
	{
		OnShowViews(bVisible);
		m_bLastVisible = bVisible;
	}
}
コード例 #2
0
ファイル: doccore.cpp プロジェクト: rickerliang/OpenNT
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();
}
コード例 #3
0
ファイル: docmangr.cpp プロジェクト: ABratovic/open-watcom-v2
CDocument *CDocManager::OpenDocumentFile( LPCTSTR lpszFileName )
/**************************************************************/
{
    POSITION                    position = m_templateList.GetHeadPosition();
    CDocTemplate                *pSelected = NULL;
    CDocTemplate::Confidence    nSelConfidence = CDocTemplate::noAttempt;
    while( position != NULL ) {
        CDocTemplate *pTemplate = (CDocTemplate *)m_templateList.GetNext( position );
        ASSERT( pTemplate != NULL );
        
        CDocument                   *pMatch = NULL;
        CDocTemplate::Confidence    nConfidence = pTemplate->MatchDocType( lpszFileName,
                                                                           pMatch );
        if( nConfidence > nSelConfidence ) {
            nSelConfidence = nConfidence;
            pSelected = pTemplate;
            if( nConfidence == CDocTemplate::yesAlreadyOpen ) {
                ASSERT( pMatch != NULL );
                POSITION viewPos = pMatch->GetFirstViewPosition();
                if( viewPos != NULL ) {
                    CView *pView = pMatch->GetNextView( viewPos );
                    CFrameWnd *pFrame = pView->GetParentFrame();
                    ASSERT( pFrame != NULL );
                    pFrame->ActivateFrame();
                }
                return( pMatch );
            }
        }
    }
    if( pSelected == NULL ) {
        return( NULL );
    }
    return( pSelected->OpenDocumentFile( lpszFileName ) );
}
コード例 #4
0
ファイル: CPluginApp.cpp プロジェクト: fre2003/l3220
// 在 Frame中发消息给View 
U32 CPluginApp_i::SendMessageToView(UINT ulMsg, WPARAM wParam, LPARAM lParam) 
{
  CWinApp* pWinApp = AfxGetApp();
  if(pWinApp)
  {
    POSITION DocTemplatePos = pWinApp->GetFirstDocTemplatePosition();
  
    //while(DocTemplatePos)
    {
	    CMultiDocTemplate* pDocTemp = (CMultiDocTemplate*)pWinApp->GetNextDocTemplate(DocTemplatePos);
    
      //  
 	    POSITION pos = pDocTemp->GetFirstDocPosition ();
  
      // Find the doc within the same doctemplate.
      while (pos)
      {
	      CDocument* pDoc     = pDocTemp->GetNextDoc (pos);
	      POSITION ViewPos    = pDoc->GetFirstViewPosition ();
	      CView* pView        = pDoc->GetNextView (ViewPos);
        if(pView)
        {
          CMDIChildWnd* pFrame = (CMDIChildWnd*)pView->GetParentFrame();
          if(pFrame == this)
          {
            //OutputDebugString("Find!\n");
            pView->SendMessage(ulMsg, wParam, lParam);
          } 
        }
      }
    }
  }
  
  return 0;
}
コード例 #5
0
void CFracticeDoc::Close()
{
	POSITION pos = GetFirstViewPosition();
	while (pos != NULL) {	// for each view of this document
		CView	*pView = GetNextView(pos);
		CFrameWnd	*pFrame = pView->GetParentFrame();	// find its parent frame
		if (pFrame != NULL)
			pFrame->PostMessage(WM_CLOSE);	// and close it
	}
}
コード例 #6
0
ファイル: document.cpp プロジェクト: ABratovic/open-watcom-v2
BOOL CDocument::CanCloseFrame( CFrameWnd *pFrame )
/************************************************/
{
    POSITION position = m_viewList.GetHeadPosition();
    while( position != NULL ) {
        CView *pView = (CView *)m_viewList.GetNext( position );
        if( pView->GetDocument() == this && pView->GetParentFrame() != pFrame ) {
            return( TRUE );
        }
    }
    return( SaveModified() );
}
コード例 #7
0
ファイル: DocIter.cpp プロジェクト: victimofleisure/WaveShop
CMDIChildWnd *CMDIChildIter::GetNextChild()
{
	CDocument	*pDoc = m_DocIter.GetNextDoc();
	if (pDoc != NULL) {
		POSITION	pos = pDoc->GetFirstViewPosition();
		if (pos != NULL) {
			CView	*pView = pDoc->GetNextView(pos);
			if (pView != NULL)
				return(DYNAMIC_DOWNCAST(CMDIChildWnd, pView->GetParentFrame()));
		}
	}
	return(NULL);
}
コード例 #8
0
CfSqlQueryFrame* CdSqlQuery::GetFrameWindow()
{
	POSITION pos = GetFirstViewPosition();
	CView* pView = GetNextView(pos);
	ASSERT (pView);
	if (pView)
	{
		CfSqlQueryFrame* pFrame = (CfSqlQueryFrame*)pView->GetParentFrame();
		ASSERT (pFrame);
		return pFrame;
	}
	return NULL;
}
コード例 #9
0
ファイル: aclikdoc.cpp プロジェクト: jetlive/skiaming
void CAutoClickDoc::ShowWindow()
{
	POSITION pos = GetFirstViewPosition();
	CView* pView = GetNextView(pos);
	if (pView != NULL)
	{
		CFrameWnd* pFrameWnd = pView->GetParentFrame();
		pFrameWnd->ActivateFrame(SW_SHOW);
		pFrameWnd = pFrameWnd->GetParentFrame();
		if (pFrameWnd != NULL)
			pFrameWnd->ActivateFrame(SW_SHOW);
	}
}
コード例 #10
0
ファイル: document.cpp プロジェクト: ABratovic/open-watcom-v2
void CDocument::UpdateFrameCounts()
/*********************************/
{
    POSITION position = GetFirstViewPosition();
    while( position != NULL ) {
        CView *pView = GetNextView( position );
        ASSERT_VALID( pView );
        CFrameWnd *pFrame = pView->GetParentFrame();
        if( pFrame != NULL ) {
            pFrame->m_nWindow = -1;
        }
    }

    int nCount = 0;
    position = GetFirstViewPosition();
    while( position != NULL ) {
        CView *pView = GetNextView( position );
        ASSERT_VALID( pView );
        CFrameWnd *pFrame = pView->GetParentFrame();
        if( pFrame != NULL && pFrame->m_nWindow < 0 ) {
            nCount++;
            pFrame->m_nWindow = nCount;
        }
    }

    position = GetFirstViewPosition();
    while( position != NULL ) {
        CView *pView = GetNextView( position );
        ASSERT_VALID( pView );
        CFrameWnd *pFrame = pView->GetParentFrame();
        if( pFrame != NULL ) {
            if( nCount == 1 ) {
                pFrame->m_nWindow = 0;
            }
            pFrame->OnUpdateFrameTitle( TRUE );
        }
    }
}
コード例 #11
0
ファイル: gui.cpp プロジェクト: kjseefried/pm3
void CGuiApp:: raisekids(CMultiDocTemplate *doc_temp)
{
  POSITION pos_doc_temp = doc_temp->GetFirstDocPosition();
  while (pos_doc_temp) {
    CDocument *doc = doc_temp->GetNextDoc(pos_doc_temp);
    POSITION p =  doc->GetFirstViewPosition();
    while (p)
      {
	CView *view = doc->GetNextView (p);
	//      view->GetParentFrame()->SetParent(crap);
	CFrameWnd *f = (CFrameWnd *)(view->GetParentFrame());
	f->ActivateFrame(SW_SHOWNORMAL);
      } 
  }
}
コード例 #12
0
ファイル: BonfireDoc.cpp プロジェクト: Qeeet/nz-software
void CBonfireDoc::UpdateDocumentTitle(LPCTSTR lpszPathName /*=NULL*/)
{
	CString title;

	// get the name from the file node
	if (lpszPathName != NULL)
		title = GetFileTitle(lpszPathName);
	else if (m_pXFile != NULL) 
		title = m_pXFile->m_strName;
	else
		return;

	SetTitle(title);

	POSITION pos = GetFirstViewPosition();
	CView* pView;
	if (pos && (pView = GetNextView(pos)) && pView->GetParentFrame())
	{
		CString strTitle = title;
		if (IsModified())strTitle += " *";
		if (m_xTextBuffer.GetReadOnly())strTitle += " (Read Only)";
		pView->GetParentFrame()->SetWindowText(strTitle);
	}
}
コード例 #13
0
ファイル: PlugIn.cpp プロジェクト: JackWangCUMT/Script.NET
/////////////////////////////////////////////////////////////////////////////
// 显示OWM(View形式)
/////////////////////////////////////////////////////////////////////////////
BOOL CPlugIn::ShowOwmView(BOOL bShow, BOOL bActive)
{
	if(m_pVciObj == NULL)
	{
		return FALSE;
	}

	IVciOwm* pIVciOwm = (IVciOwm*)m_pVciObj;
	CMultiDocTemplate* pDocTemplate = NULL;
	pIVciOwm->GetDocTemplate(&pDocTemplate);

	if(pDocTemplate == NULL)
	{
		return FALSE;
	}

	POSITION posdoc = pDocTemplate->GetFirstDocPosition();
	if(!bShow)
	{
		if(posdoc)
		{
			CloseOwmFrame();
		}
		return TRUE;
	}

	if(!posdoc)
	{
		NewOwmFrame();
	}
	if(bActive)
	{
		POSITION posdoc = pDocTemplate->GetFirstDocPosition();
		if(posdoc)
		{
			CDocument* pDoc = pDocTemplate->GetNextDoc(posdoc);
			POSITION posview = pDoc->GetFirstViewPosition();
			if(posview)	// 如果视存在
			{
				CView* pOwmView = pDoc->GetNextView(posview);	// 取到视指针
				pOwmView->GetParentFrame()->ActivateFrame(); // 激活框架
				return TRUE;
			}
		}
	}

	return FALSE;
}
コード例 #14
0
ファイル: NTU_OCCT_v2Doc.cpp プロジェクト: ZHKang/NTU_OCCT_v2
void CNTU_OCCT_v2Doc::ActivateFrame(CRuntimeClass* pViewClass,int nCmdShow)
{
	POSITION position = GetFirstViewPosition();
	while (position != (POSITION)NULL)
	{
		CView* pCurrentView = (CView*)GetNextView(position);
		if(pCurrentView->IsKindOf(pViewClass) )
		{
			ASSERT_VALID(pCurrentView);
			CFrameWnd* pParentFrm = pCurrentView->GetParentFrame();
			ASSERT(pParentFrm != (CFrameWnd *)NULL);
			// simply make the frame window visible
			pParentFrm->ActivateFrame(nCmdShow);
		}
	}
}
コード例 #15
0
PUBLIC BOOL UserProgress (HTRequest * request, HTAlertOpcode op,
                          int msgnum, const char * dfault, void * input,
                          HTAlertPar * reply)
{
    char * msg = HTDialog_progressMessage(request, op, msgnum, dfault, input);
    CRequest * req = (CRequest *) HTRequest_context(request);
    ASSERT(request != NULL);
    ASSERT(req != NULL);
    CProgressCtrl * progress = req->GetProgressBar();

    switch (op) {
    case HT_PROG_READ:
        {
            long cl = HTAnchor_length(HTRequest_anchor(request));
            if (cl > 0) {
                long b_read = HTRequest_bodyRead(request);
                double pro = (double) b_read/cl*100;
		progress->SetPos((int) pro);
            }
        }
        break;
        
    case HT_PROG_WRITE:
        {
            long cl = HTAnchor_length(HTRequest_entityAnchor(request));
            if (cl > 0) {
                long b_written = HTRequest_bodyWritten(request);
                double pro = (double) b_written/cl*100;
		progress->SetPos((int) pro);
            }
        }
        break;
    }

    // Update pane 0 of the status bar
    if (msg) {
	CWinComDoc * doc = req->m_pDoc;
	if (doc) {
	    POSITION pos = doc->GetFirstViewPosition();
	    CView * view = doc->GetNextView( pos );
	    CMainFrame * mainframe = (CMainFrame *) view->GetParentFrame();
	    mainframe->m_wndStatusBar.SetPaneText(ID_SEPARATOR, msg);
	}
	HT_FREE(msg);
    }
    return YES;
}
コード例 #16
0
void CFrameWnd::OnClose()
/***********************/
{
    if( m_lpfnCloseProc != NULL ) {
        m_lpfnCloseProc( this );
    } else {
        CWinApp *pApp = AfxGetApp();
        if( pApp != NULL && pApp->m_pMainWnd == this ) {
            if( !pApp->SaveAllModified() ) {
                return;
            }
            pApp->CloseAllDocuments( FALSE );
            if( pApp->m_pMainWnd == NULL ) {
                // If the main window has been destroyed by CloseAllDocuments()
                // (e.g. in an SDI application), just return since trying to execute the
                // rest of OnClose() will cause a crash due to an invalid this pointer.
                return;
            }
        }
        
        CDocument *pDoc = GetActiveDocument();
        if( pDoc != NULL ) {
            if( !pDoc->CanCloseFrame( this ) ) {
                return;
            }
            
            BOOL        bOnlyFrame = TRUE;
            POSITION    position = pDoc->GetFirstViewPosition();
            while( position != NULL ) {
                CView *pView = pDoc->GetNextView( position );
                ASSERT( pView != NULL );
                if( pView->GetParentFrame() != this ) {
                    bOnlyFrame = FALSE;
                    break;
                }
            }
            if( bOnlyFrame ) {
                // OnCloseDocument destroys the frame, so just return after calling it.
                pDoc->OnCloseDocument();
                return;
            }
            pDoc->PreCloseFrame( this );
        }
        DestroyWindow();
    }
}
コード例 #17
0
ファイル: dmdoc.cpp プロジェクト: jetlive/skiaming
//***********************************************************************
// Function: CDynaMenuDoc::OnColorOptions()
//
// Purpose:
//    OnColorOptions displays a dialog which allows the user to pick
//    the text colors which should be displayed on the Color submenu
//    when the document is active.
//
// Parameters:
//    none.
//
// Returns:
//    none.
//
// Comments:
//    none.
//
//***********************************************************************
void CDynaMenuDoc::OnColorOptions()
{
	CColorOptDlg dlg(this);
	if (dlg.DoModal())
	{
		// find the MDI frame window associated with this document
		POSITION pos = GetFirstViewPosition();
		CView* pview = GetNextView(pos);
		ENSURE(pview != NULL);

		CDynaMDIChildWnd* pwnd = (CDynaMDIChildWnd*)pview->GetParentFrame();
		ASSERT_KINDOF(CDynaMDIChildWnd, pwnd);

		// force an update of the Color submenu
		pwnd->RefreshColorMenu();
	}
}
コード例 #18
0
ファイル: gui.cpp プロジェクト: kjseefried/pm3
void CGuiApp::SyncRegs()
{
  POSITION pos = theApp.m_regTemplate->GetFirstDocPosition();
  
  while (pos)
    {
      CRegDoc *doc = (CRegDoc *)(theApp.m_regTemplate->GetNextDoc(pos));
      doc->Sync();
#if 0
      POSITION p = doc->GetFirstViewPosition();
      while (p)
	{
	  CView *v = doc->GetNextView(p);
	  v->GetParentFrame()->Invalidate();
	}
#endif
    }
}	
コード例 #19
0
ファイル: document.cpp プロジェクト: ABratovic/open-watcom-v2
void CDocument::OnCloseDocument()
/*******************************/
{
    POSITION position;
    BOOL bOldAutoDelete = m_bAutoDelete;
    m_bAutoDelete = FALSE;
    while( (position = GetFirstViewPosition()) != NULL ) {
        CView *pView = GetNextView( position );
        ASSERT( pView != NULL );
        CFrameWnd *pFrame = pView->GetParentFrame();
        ASSERT( pFrame != NULL );
        pFrame->DestroyWindow();
    }
    DeleteContents();
    if( bOldAutoDelete ) { 
        delete this;
    }
}
コード例 #20
0
CSbproAux* CSbproAux::FindSbproAux(CDocument* pDoc)
{
	POSITION pos = pDoc->GetFirstViewPosition();
	CView* pView = pDoc->GetNextView(pos);
	if (pView != NULL)
	{
		// assumes one view per document
		CFrameWnd* pFrame = pView->GetParentFrame();
		if (pFrame != NULL)
		{
			// assumes one CSbproAux instance per document
			CSbproAux* pSbproAux = FindSbproAux(pFrame);
			return pSbproAux; // might be NULL
		}
	}

	return 0;
}
コード例 #21
0
ファイル: oledoc1.cpp プロジェクト: jbeaurain/omaha_vs2010
CFrameWnd* COleDocument::GetFirstFrame()
{
	ASSERT_VALID(this);

	// get position of first view in the document
	POSITION pos = GetFirstViewPosition();

	// get view at that position
	CView* pView = GetNextView(pos);
	if (pView == NULL)
		return NULL;
	ASSERT_VALID(pView);

	// return the first frame window that is a parent of that view
	CFrameWnd* pFrameWnd = (CFrameWnd*)pView->GetParentFrame();
	ASSERT_VALID(pFrameWnd);
	ASSERT_KINDOF(CFrameWnd, pFrameWnd);
	return pFrameWnd;
}
コード例 #22
0
ファイル: splitter.cpp プロジェクト: eatonmi/Crawler
BOOL CSplitterFrame::SetNewView(int row, int col, CRuntimeClass* pViewClass) {
  ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CView)));
  
  CView* pView = STATIC_DOWNCAST(CView, m_wndSplitter.GetPane(row, col));
  CFrameWnd* pFrame = pView->GetParentFrame();
  ASSERT(pFrame);
  
  // set up create context to preserve doc/frame etc.
  CCreateContext cc;
  memset(&cc, 0, sizeof(cc));
  cc.m_pNewViewClass = pViewClass;
  cc.m_pCurrentDoc = pView->GetDocument();
  cc.m_pNewDocTemplate = cc.m_pCurrentDoc ?
    cc.m_pCurrentDoc->GetDocTemplate() : NULL;
  cc.m_pCurrentFrame = pFrame;
  
  m_wndSplitter.DeleteView(row, col);                // delete old view

  /* */
  /* recréer control tabs */
  this_app->NewTabs();
  /* */

  VERIFY(m_wndSplitter.CreateView(row, col,          // create new one
    pViewClass,
    CSize(0,0),                      // will fix in RecalcLayout
    &cc));
  
  m_wndSplitter.RecalcLayout();                      // recompute layout 
  
  // initialize the view
  CWnd* pWnd = m_wndSplitter.GetPane(row, col);
  if (pWnd)
    pWnd->SendMessage(WM_INITIALUPDATE);

  GetActiveDocument()->SetModifiedFlag(FALSE);      // Document vide
  GetActiveDocument()->SetTitle("New Project");
  //SetDefaultTitle(GetActiveDocument());
  return 1;
}
コード例 #23
0
ファイル: FormObj.cpp プロジェクト: JackWangCUMT/SuperCxHMI
void CFormObj::OnEdit()
{
	POSITION pos = m_pFormDoc->GetFirstViewPosition();
	if (pos != NULL)
	{
		CView* pView = m_pFormDoc->GetNextView(pos);
		if (pView != NULL)
		{
			CMDIChildWnd* pFrame = (CMDIChildWnd *)pView->GetParentFrame();
			CMDIChildWnd* pActiveFrame = ((CMainFrame *)AfxGetMainWnd())->MDIGetActive();
			if (pFrame != NULL && pFrame != pActiveFrame)
				((CMainFrame *)AfxGetMainWnd())->MDIActivate(pFrame);
			
			return;
		}
	}

	CMDIChildWnd* pNewFrame
			= (CMDIChildWnd*)(GetLayoutTemplate()->CreateNewFrame(m_pFormDoc, NULL));
	ASSERT(pNewFrame != NULL);
	ASSERT_KINDOF(CMDIChildWnd, pNewFrame);
	pNewFrame->InitialUpdateFrame(m_pFormDoc, TRUE);
}
コード例 #24
0
ファイル: DocTemplateEx.cpp プロジェクト: malpharo/AiPI
CDocument* CDocTemplateEx::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible)
{
	CAIPIApp* pApp = (CAIPIApp*)AfxGetApp();

	if (m_docList.GetCount() == 1)
	{
		CDocument* pDocument = (CDocument*)m_docList.GetHead();
		BOOL e = pDocument->GetPathName().IsEmpty();
		BOOL m = pDocument->IsModified();

		if (lpszPathName != NULL && pDocument->GetPathName().IsEmpty() && pDocument->IsModified())
		{
			
			pApp->AipiOpenDocumentFile(lpszPathName);
	
			CWaitCursor wait;
			if (!pDocument->OnOpenDocument(lpszPathName))
			{
				// user has be alerted to what failed in OnOpenDocument
				TRACE0("CDocument::OnOpenDocument returned FALSE.\n");
				return NULL;
			}
			
			pDocument->SetPathName(lpszPathName);
			POSITION pos = pDocument->GetFirstViewPosition();
			CView* pView = pDocument->GetNextView(pos);
			CFrameWnd* pFrame = pView->GetParentFrame();
			InitialUpdateFrame(pFrame, pDocument);
			return pDocument;
		}
	}

	pApp->AipiOpenDocumentFile(lpszPathName);
	

	return CMultiDocTemplate::OpenDocumentFile(lpszPathName, bMakeVisible);
}
コード例 #25
0
ファイル: doccore.cpp プロジェクト: rickerliang/OpenNT
void CDocument::UpdateFrameCounts()
	 // assumes 1 doc per frame
{
	// walk all frames of views (mark and sweep approach)
	POSITION pos = GetFirstViewPosition();
	while (pos != NULL)
	{
		CView* pView = GetNextView(pos);
		ASSERT_VALID(pView);
		ASSERT(::IsWindow(pView->m_hWnd));
		if (pView->IsWindowVisible())   // Do not count invisible windows.
		{
			CFrameWnd* pFrame = pView->GetParentFrame();
			if (pFrame != NULL)
				pFrame->m_nWindow = -1;     // unknown
		}
	}

	// now do it again counting the unique ones
	int nFrames = 0;
	pos = GetFirstViewPosition();
	while (pos != NULL)
	{
		CView* pView = GetNextView(pos);
		ASSERT_VALID(pView);
		ASSERT(::IsWindow(pView->m_hWnd));
		if (pView->IsWindowVisible())   // Do not count invisible windows.
		{
			CFrameWnd* pFrame = pView->GetParentFrame();
			if (pFrame != NULL && pFrame->m_nWindow == -1)
			{
				ASSERT_VALID(pFrame);
				// not yet counted (give it a 1 based number)
				pFrame->m_nWindow = ++nFrames;
			}
		}
	}

	// lastly walk the frames and update titles (assume same order)
	// go through frames updating the appropriate one
	int iFrame = 1;
	pos = GetFirstViewPosition();
	while (pos != NULL)
	{
		CView* pView = GetNextView(pos);
		ASSERT_VALID(pView);
		ASSERT(::IsWindow(pView->m_hWnd));
		if (pView->IsWindowVisible())   // Do not count invisible windows.
		{
			CFrameWnd* pFrame = pView->GetParentFrame();
			if (pFrame != NULL && pFrame->m_nWindow == iFrame)
			{
				ASSERT_VALID(pFrame);
				if (nFrames == 1)
					pFrame->m_nWindow = 0;      // the only one of its kind
				pFrame->OnUpdateFrameTitle(TRUE);
				iFrame++;
			}
		}
	}
	ASSERT(iFrame == nFrames + 1);
}
コード例 #26
0
ファイル: IntuitiveEditor.cpp プロジェクト: alexis-/iwe
BOOL CIntuitiveEditorApp::InitInstance()
{
	// InitCommonControlsEx() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// Set this to include all the common control classes you want to use
	// in your application.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinAppEx::InitInstance();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	EnableTaskbarInteraction();

	// AfxInitRichEdit2() is required to use RichEdit control	
	// AfxInitRichEdit2();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	// of your final executable, you should remove from the following
	// the specific initialization routines you do not need
	// Change the registry key under which our settings are stored
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization
	SetRegistryKey(_T("Intuitive Solutions"));
	LoadStdProfileSettings(8);  // Load standard INI file options (including MRU)


	InitContextMenuManager();

	InitKeyboardManager();

	InitTooltipManager();
	CMFCToolTipInfo ttParams;
	ttParams.m_bVislManagerTheme = TRUE;
	theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
		RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views

  //////////
	CMultiDocTemplate* pDocTemplate;

	pDocTemplate = new CMultiDocTemplate(IDR_IntuitiveEditorTYPE,
		RUNTIME_CLASS(CIntuitiveEditorDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CIntuitiveEditorView));

	if (!pDocTemplate)
		return FALSE;

	AddDocTemplate(pDocTemplate);
  m_pMainDoc = pDocTemplate;

  //////////


	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
	{
		delete pMainFrame;
		return FALSE;
	}

	m_pMainWnd = pMainFrame;

	// call DragAcceptFiles only if there's a suffix
	//  In an MDI app, this should occur immediately after setting m_pMainWnd

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	//m_pDocManager

	// Dispatch commands specified on the command line.  Will return FALSE if
	// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;
	// The main window has been initialized, so show and update it
  

 



	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();

  //////////

	pDocTemplate = new CMultiDocTemplate(IDR_IntuitiveEditorTYPE,
    RUNTIME_CLASS(CCLIDoc),
    RUNTIME_CLASS(CCLIChildFrame), // custom MDI child frame
    RUNTIME_CLASS(CCLIView));

	if (!pDocTemplate)
		return FALSE;

	AddDocTemplate(pDocTemplate);
  
  
  CUIManager::getInstance()->setCLIViewDoc(pDocTemplate);

  CGUIInterface::getInstance()->eventPostInit();
  
  POSITION docpos = m_pMainDoc->GetFirstDocPosition();
  CDocument* pMainDoc = m_pMainDoc->GetNextDoc(docpos);
  
  CView* pView;
  POSITION pos = pMainDoc->GetFirstViewPosition();
  if (pos != NULL)
  {
    pView = pMainDoc->GetNextView(pos);
    if (pView)
    {
      pView->GetParentFrame()->ActivateFrame();
    }
  }

	return TRUE;
}
コード例 #27
0
ファイル: PlugIn.cpp プロジェクト: JackWangCUMT/Script.NET
/////////////////////////////////////////////////////////////////////////////
// 打开文档,如果不能打开则返回FALSE
/////////////////////////////////////////////////////////////////////////////
CDocument* CPlugIn::OpenDocument(LPCTSTR lpszFileName)
{
	CString strFileName = lpszFileName;
	strFileName.MakeLower();
	int nPos = strFileName.ReverseFind('.');
	if(nPos == -1)
	{
		return NULL;
	}

	CString strFileExt = strFileName;
	strFileExt.Delete(0, nPos+1);

	for(int i=0; i<m_arDocExtend.GetSize(); i++)
	{
		for(int j=0; j<m_arDocExtend[i].m_arDocExt.GetSize(); j++)
		{
			if(strFileExt == m_arDocExtend[i].m_arDocExt[j])
			{
				// 如果是动态加载的OWM,并且未加载过,就先加载
				if((m_pDocTemplate == NULL) && (m_nType & OWM_DYNLOAD))
				{
					LoadOwmPlugIn();
				}

				// 如果文档模板为空,则此种文档模板不能使用,继续向下搜索
				if(m_pDocTemplate == NULL)
				{
					continue;
				}

				// 先判断是否已经打开了
				strFileName.Replace("/", "\\");

				CView* pView = NULL;
				POSITION posdoc = m_pDocTemplate->GetFirstDocPosition();
				while(posdoc != NULL)
				{
					CDocument* pDoc = m_pDocTemplate->GetNextDoc(posdoc);
					CString strFilePathExist = pDoc->GetPathName();
					strFilePathExist.MakeLower();
					strFilePathExist.Replace("/", "\\");
					if(strFilePathExist == strFileName)
					{
						// 如果已经打开则激活
						POSITION posview = pDoc->GetFirstViewPosition();
						if(posview)	// 如果视存在
						{
							CView* pView = pDoc->GetNextView(posview);	// 取到视指针
							pView->GetParentFrame()->ActivateFrame(); // 激活框架
						}
						return pDoc;
					}
				}

				return m_pDocTemplate->OpenDocumentFile(lpszFileName);
			}
		}
	}

	return NULL;
}
コード例 #28
0
BOOL HandleCommandLine( HWND hWindow, LPTSTR lpszCmdLine, LPINT lpPrint )
/***********************************************************************/
{
	FNAME    szFileName;
	LPTSTR   lp;
	BOOL     bPassedByClient;
	LPIMAGE  lpImageDoc;
	HWND     hWnd;
	WORD 	 wChar;

	*lpPrint = NO;
	if( !lpszCmdLine )
    	return( TRUE );

	// Check if we have "[/ | -]embedding" and a possible filename.
	// usage: PP ["[-/]embedding"] file1 file2 ...

	//dbg("full command line = '%ls'", lpszCmdLine );

	// See if the command line is being passed by a client
	bPassedByClient = NO;
	if(( lp = lstrfind( lpszCmdLine, _T("embedding") )) &&
   	   ( lp == lpszCmdLine || lp == ( MyCharNext( lpszCmdLine ))))
   	{ 	// Command line passed by a client
		//  dbg(_T("command line passed by client"));
    	bPassedByClient = YES;
    	lpszCmdLine = SkipSpaces( MyCharNextN( lp, 9 )); 	// skip over _T("embedding")
   	}

	while( *lpszCmdLine )		// Process any files and switches on the command line
   	{ 
    	// Skip white space and see if we're done...
    	lpszCmdLine = SkipSpaces( lpszCmdLine );
    	if( !( *lpszCmdLine ))	// If NULL get out
        	break; 

		//  dbg( _T("file='%ls' print=%d"), lpszCmdLine, *lpPrint );dbg(0);

    	// Check for any switches preceeding the file name: only /p for now
    	while( TRUE )	
    	{ 
			if( IsDBCSLeadByte(( BYTE )*lpszCmdLine ))
				wChar = *(( LPWORD )lpszCmdLine );
			else
				wChar = *lpszCmdLine;

			if( wChar != _T('/'))	// if not a switch...
				break;

        	lpszCmdLine = MyCharNext( lpszCmdLine );	// Skip over the slash

        	if( !*lpszCmdLine )		// If NULL get out
            	break; 

			if( IsDBCSLeadByte(( BYTE )*lpszCmdLine ))
				wChar = *(( LPWORD )lpszCmdLine );
			else
				wChar = *lpszCmdLine;

        	if( wChar == _T('p') || wChar == _T('P') )
            	*lpPrint = YES;

        	lpszCmdLine = SkipSpaces( MyCharNext( lpszCmdLine ));
		}

    	// Skip white space and see if we're done...
    	lpszCmdLine = SkipSpaces( lpszCmdLine );
    	if( !( *lpszCmdLine ))		// If NULL get out
        	break; 

    	// Try to zap the space after a single file name
    	if(( lp = lstrfind( lpszCmdLine, _T(" ") )))
        	*lp = _T('\0'); // If we found a space, zap it

    	// Copy the full path name into szFileName
    	if( lStrChr( lpszCmdLine, _T('\\') ))
        	lstrcpy( szFileName, lpszCmdLine );
    	else				// If not a full path name...
   		{ 
        	GetCurrentDir( szFileName, sizeof(FNAME) );
        	FixPath( szFileName );
        	lstrcat( szFileName, lpszCmdLine );
		}

    	// Now we're done with lpszCmdLine, so set it up for the next loop
		// If we had found a space, there might be more file names
    	if( lp )	
        	lpszCmdLine = MyCharNext( lp );
    	else    
			lpszCmdLine += lstrlen( lpszCmdLine ); // Point to nothing

    	// Process szFileName

    	// Special handling of documents passed by a client
    	if ( bPassedByClient )
    	{
			CServerDoc *pDoc = PictPubApp.GetDocument(szFileName);
			if (pDoc)
        	{
            	// It's already open....
            	POSITION ViewPos = pDoc->GetFirstViewPosition();
            	ASSERT(ViewPos!=NULL);
            	CView* pView = pDoc->GetNextView( ViewPos );
            	ASSERT(pView);
            	// NOTE send Message to View's Parent MDIFrame
            	SendMessage( PictPubApp.Get_hClientAstral(), WM_MDIACTIVATE, 
                	(WORD)pView->GetParentFrame()->GetSafeHwnd(), 0L );
            	lpImageDoc->fOwnedByClient = YES;
            	*szFileName = _T('\0'); // Zap it
        	}
    	}

    	// If we have a file name, open it...
    	if ( *szFileName )
			hWnd = AstralImageLoad(  0, szFileName, MAYBE, YES );
    	else    
			hWnd = NULL;

    	// If the printing option was passed, print it and close it
    	if ( hWnd && *lpPrint )
    	{
         	FORWARD_WM_COMMAND(PictPubApp.Get_hWndAstral(), IDM_PRINT, NULL, 0, SendMessage);
        	CloseImage( NO, NULL, NULL );
    	}
	}
	return( TRUE );
}
コード例 #29
0
ファイル: PlugIn.cpp プロジェクト: JackWangCUMT/Script.NET
/////////////////////////////////////////////////////////////////////////////
// 新建OWM对象窗口(for Xtreme)
/////////////////////////////////////////////////////////////////////////////
void CPlugIn::NewOwmFrame(LPCTSTR lpszPath)
{
	if(m_pVciObj == NULL)
	{
		return;
	}

	IVciOwm* pIVciOwm = (IVciOwm*)m_pVciObj;
	CMultiDocTemplate* pDocTemplate = NULL;
	pIVciOwm->GetDocTemplate(&pDocTemplate);

	if((m_nType & OWM_DOC) && pDocTemplate)
	{
		// 如果只允许一个实例,则做相应处理
		if((m_nType & OWM_ONEFRAME) &&
			(pDocTemplate->GetFirstDocPosition()))
			return;

		// 打开一个空OWM文档
		//if(!pDocTemplate->OpenDocumentFile(lpszPath))
		if(!pDocTemplate->OpenDocumentFile(NULL))
		{
			return;
		}

		// 创建OWM扩展菜单
		if(m_nType & OWM_MENU)
		{
			// 取到文档指针,用来将扩展菜单指针纪录在文档中,文档关闭时清除
			POSITION pos = pDocTemplate->GetFirstDocPosition();
			CDocument* pDoc = pDocTemplate->GetNextDoc(pos);
			POSITION posview = pDoc->GetFirstViewPosition();
			if(posview)	// 如果视存在
			{
				CView* pView = pDoc->GetNextView(posview);	// 取到视指针
				//pView->GetParentFrame()->ActivateFrame(); // 激活框架
				if(m_nType & OWM_MAXWINDOW)
				{
					// 将窗口最大化
					pView->GetParentFrame()->ShowWindow(SW_SHOWMAXIMIZED);
				}
			}
/*
			// 注册OWM菜单,添加到弹出菜单上
			// 注:在Xtreme中需要通过MenuBar的GetMenu函数来获取主
			// 菜单的资源,而CJLib中直接通过MainFrame的GetMenu就可以了
			//ol.RegisterClientMenu(m_pMainWnd->GetMenu(), m_aOWMMenus, IDM_OWMCMD, pDoc);
			CXTMenuBar* pMenuBar = ((CMainFrame*)AfxGetMainWnd())->GetMenuBar();
			pIVciOwm->RegisterClientMenu(pMenuBar->GetMenu(),
							m_aOWMMenus, IDM_OWMCMD, pDoc);

			// 刷新菜单条
			// 注:在CJLib中用DrawMenuBar就可以了,在Xtreme中必须用
			// DrawMenuBarX来刷新Xtreme中的MenuBar和Menu资源的关联
			((CMainFrame*)AfxGetMainWnd())->DrawMenuBarX();

			// 注:关于OWM针对Xtreme toolkit的改动
			// Xtreme和CJLibrary的区别比较大,Cool菜单改为统一管理,
			// 通过CXTCoolMenu类来管理,此类可以加载许多图标资源,然后
			// 安装到一个窗口上,安装以后,用户不用再针对菜单做特殊处理
			// 就可以使用Cool菜单了.而以前的CJLib使用CoolMenu的方法是
			// 每个菜单单独加载图标资源.
			// 因此,在OWM中要想实现扩展菜单使用自己的图标资源,必须做
			// 一些特殊处理,因为OWM和主程序必须使用同一个CXTCoolMenu,
			// 这样是很容易造成资源冲突问题的,并且也不能通过资源切换
			// 来解决,那么唯一的办法就是保证OWM中需要添加到主程序的菜
			// 单和主程序中的菜单的资源ID不重合,因此规定OWM中需要扩展
			// 的资源ID必须在10000到20000范围内,其中10000-11999为系统
			// OWM保留,用户自己写的必须从12000开始.
			// 为了保证OWM接口的兼容性,因此对接口定义不做任何改动,在
			// OWM的RegisterClientMenu函数中要想注册自己的图标资源,
			// 可以通过获取MainFrame指针,然后通过MainFrame找到CXTCoolMenu
			// 的指针来操作.
*/
		}
	}
}
コード例 #30
0
ファイル: StaticDoc.cpp プロジェクト: ZhaoboMeng/k-line-print
BOOL CStaticDoc::ShowStaticView( CRuntimeClass * pViewClass, BOOL bMaximized )
{
	if( NULL == pViewClass )
		return FALSE;

	CChildFrame * pChildFrame = NULL;

	POSITION pos = GetFirstViewPosition( );
	CView * pView = NULL;
	while( pView = GetNextView(pos) )
	{
		if( pView->IsKindOf( pViewClass ) )
		{
			pChildFrame = DYNAMIC_DOWNCAST( CChildFrame, pView->GetParentFrame() );
			ASSERT( pChildFrame );
			if( pChildFrame )
				break;
		}
	}

	if( NULL == pChildFrame )
	{
		// create frame
		pChildFrame = CChildFrame::CreateNewFrame( this );
		ASSERT( pChildFrame );

		if( pChildFrame )
		{
			// create view
			CCreateContext context;
			context.m_pCurrentDoc = this;
			context.m_pCurrentFrame = pChildFrame;
			context.m_pLastView = NULL;
			context.m_pNewDocTemplate = NULL;
			context.m_pNewViewClass = pViewClass;

			CView * pNewView = DYNAMIC_DOWNCAST(CView,pChildFrame->CreateView( &context, AFX_IDW_PANE_FIRST));
			if( pNewView )
			{
				pChildFrame->SetActiveView( pNewView );
				pNewView->OnInitialUpdate( );
			}

			// if no active child frame, maximize this frame
			CMainFrame * pMainFrame = AfxGetMainFrame();
			if( pMainFrame )
			{
				CFrameWnd * pActiveFrame = AfxGetMainFrame()->GetActiveFrame();
				if( !pActiveFrame || !pActiveFrame->IsKindOf(RUNTIME_CLASS(CChildFrame)) )
					pChildFrame->MDIMaximize();
			}
		}
	}
	
	if( pChildFrame )
	{
		// activate it
		pChildFrame->MDIActivate();
		if( bMaximized )
			pChildFrame->MDIMaximize();
		else
			pChildFrame->ShowWindow( SW_SHOW );
	}

	return TRUE;
}