예제 #1
0
CGrannyViewerDoc * CMainFrame::GetDocument(void)
{
	CDocument* pDoc = GetActiveDocument();
	if (pDoc && pDoc->IsKindOf(RUNTIME_CLASS(CGrannyViewerDoc))) 
		return dynamic_cast<CGrannyViewerDoc*>(pDoc);
	return NULL;
}
예제 #2
0
void CMDITabsDialogBar::DrawItem(LPDRAWITEMSTRUCT pdis)
{
    CRect rc = pdis->rcItem;
    int nTabIndex = pdis->itemID;
    bool fSelected = (nTabIndex == GetCurSel());
    ODA_DRAWENTIRE;
	char label[64];
	TCITEM tci;
	tci.mask = TCIF_TEXT | TCIF_PARAM;
	tci.pszText = label;
	tci.cchTextMax = ARRAYSIZE(label);
	if (GetItem(nTabIndex, &tci))
    {
        CMDITabChildWnd *pActive = reinterpret_cast<CMDITabChildWnd*>(tci.lParam);

        CDC dc;
        dc.Attach(pdis->hDC);

        int iIndex = _GetBitmapIndex(pActive->GetTabType());
        CExtBitmap &bitmapToUse = fSelected ? _tabBitmap[iIndex] : _tabBitmapNS[iIndex];
        CRect rcSrc(CPoint(0, 0), bitmapToUse.GetSize());
        //CRect rcPadding(2, 2, 2, 2);
        CRect rcPadding(0, 0, 0, 0);
        bitmapToUse.AlphaBlendSkinParts(pdis->hDC, rc, rcSrc, rcPadding, /*__EXT_BMP_FLAG_PREMULTIPLIED_RGB_CHANNELS |*/ CExtBitmap::__EDM_STRETCH, true, true, 0xFF);

        // Use a different font decoration depending on if this is the most recent version of this item.
        bool fNotMostRecent = false;
        CDocument *pDocAny = pActive->GetActiveDocument();
        if (pDocAny && pDocAny->IsKindOf(RUNTIME_CLASS(CResourceDocument)))
        {
            CResourceDocument *pDoc = static_cast<CResourceDocument*>(pDocAny);
            fNotMostRecent = !theApp._resourceRecency.IsResourceMostRecent(pDoc);
        }
        if (fNotMostRecent)
        {
            // Draw a diagonal line across the thing.
            dc.MoveTo(rc.TopLeft());
            dc.LineTo(rc.BottomRight());
        }

        rc.OffsetRect(4, 1); // indent
        COLORREF crText = RGB(0, 0, 0); // g_PaintManager->PAINTPUSHBUTTONDATA::m_clrForceTextNormal; // green in release, black in debug!
        int nOldText = dc.SetTextColor(crText);
        int nOldBk = dc.SetBkMode(TRANSPARENT);
        dc.DrawText(tci.pszText, -1, &rc, DT_SINGLELINE);
        dc.SetBkMode(nOldBk);
        dc.SetTextColor(nOldText);

        dc.Detach();
    }
}
예제 #3
0
파일: Level.cpp 프로젝트: chrisluu/Plugin
void CLevelApp::OnImageLevel()
{
	CDocument* pDoc = PIGetActiveDocument();
	if (pDoc == NULL)
		return;
	if (!pDoc->IsKindOf(RUNTIME_CLASS(CPIDocument)))
		return;

	CLevelDlg dlg;
	dlg.DoModal();

//	CLevelDlg* pDlg = new CLevelDlg;
//	PIDockablePane(pDlg, _T("Test"));
}
예제 #4
0
파일: Process.cpp 프로젝트: chrisluu/Plugin
void CProcessApp::OnImageInverse()
{
	CDocument* pDoc = PIGetActiveDocument();
	if (pDoc == NULL)
		return;
	if (!pDoc->IsKindOf(RUNTIME_CLASS(CPIDocument)))
		return;

	CImage* pImage = ((CPIDocument*)pDoc)->GetImage();
	if (pImage == NULL)
		return;

	AfxBeginThread(InverseThread, pImage);
}
예제 #5
0
CDocument *CMDITabsDialogBar::_GetIfKindOf(int i, const CRuntimeClass* pClass, CMDITabChildWnd **pActive) const
{
    CDocument *pDoc = NULL;
    TCITEM tcitem = { 0 };
    tcitem.mask = TCIF_PARAM;
    if (GetItem(i, &tcitem))
    {
        *pActive = reinterpret_cast<CMDITabChildWnd*>(tcitem.lParam);
        CDocument *pDocQ = (*pActive)->GetActiveDocument();
        if (pDocQ->IsKindOf(pClass))
        {
            pDoc = pDocQ;
        }
    }  
    return pDoc;
}
예제 #6
0
// ********************************
//	CDocTemplate
// ********************************
CDocument* CHidemdiDoctmplDocstrAlone::OpenDocumentFile( LPCTSTR lpszPathName
								, BOOL bMakeVisible ) 
		//【オーバライド】
		//	lpszPathName と同じDocStr()を持つドキュメントが存在していたら、
		//	新たなドキュメントを開かずに、既存のドキュメントをアクティブに、
		//	して、そのオブジェクトポインタを返します
{
	CDocument*	pRv = NULL ;
	
	POSITION	LPosition = GetFirstDocPosition() ;
	while( LPosition != NULL && pRv == NULL ){
		CDocument*	pLDocument = GetNextDoc( LPosition ) ;
		ASSERT( pLDocument->IsKindOf( RUNTIME_CLASS( CHidemdiSubDoc ) ) ) ;
			//[Attention]
			//	このクラスが扱うドキュメントは、CHidemdiSubDocを継承して
			//	いなくてはなりません

		CHidemdiSubDoc*	pLSubDoc = (CHidemdiSubDoc*)pLDocument ;
		
		if ( lpszPathName == NULL ){
			lpszPathName = _T("" ) ;
		}
		if ( pLSubDoc->DocStr() == lpszPathName ){
			//	同じDocStr()の子フレームが見つかりました

			POSITION	LViewPosition = pLSubDoc->GetFirstViewPosition() ;
			while ( LViewPosition != NULL ){
				CView*	pLView = pLSubDoc->GetNextView( LViewPosition ) ;
				( (CMDIFrameWnd*)AfxGetMainWnd() )->MDIActivate( pLView->GetParent() ) ;
				break ;
			}
				//[Attention]
				//	同名のビュー(のMDI子フレーム)をアクティブにしています

			pRv = pLSubDoc ;
		}
	}	
		//pRv = 同名のビューがすでにあれば、そのビュー、なければNULLです
	
	if ( pRv == NULL ){
		pRv = super::OpenDocumentFile( lpszPathName , bMakeVisible ) ; 
	}
	return ( pRv ) ;	
};
예제 #7
0
STDMETHODIMP CFWDocuments::get_Count(long *pVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	if(!m_pApp)
		return E_FAIL;

	*pVal = 0;
	int nIndex = 0;
	POSITION pos = m_pApp->GetFirstDocTemplatePosition();
	while (pos)
	{
		CDocTemplate* pTemplate = (CDocTemplate*)m_pApp->GetNextDocTemplate(pos);
		POSITION pos2 = pTemplate->GetFirstDocPosition();
		while (pos2)
		{
			CDocument* pDoc = pTemplate->GetNextDoc(pos2);
			if(pDoc->IsKindOf(RUNTIME_CLASS(FW_Document)))
				(*pVal)++;
		}
	}

	return S_OK;
}
예제 #8
0
CCmdTarget* COleTemplateServer::OnCreateObject()
{
	ASSERT_VALID(this);
	ASSERT_VALID(m_pDocTemplate);

	// save application user control status
	BOOL bUserCtrl = AfxOleGetUserCtrl();

	// create invisible doc/view/frame set
	CDocument* pDoc = m_pDocTemplate->OpenDocumentFile(NULL, FALSE);

	// restore application's user control status
	AfxOleSetUserCtrl(bUserCtrl);

	if (pDoc != NULL)
	{
		ASSERT_VALID(pDoc);
		ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CDocument)));

		// all new documents created by OLE start out modified
		pDoc->SetModifiedFlag();
	}
	return pDoc;
}
예제 #9
0
CGumpEditorDoc* CMainFrame::GetGumpDocument()
{
	CDocument* pDoc = GetActiveDocument();
	if (pDoc && pDoc->IsKindOf(RUNTIME_CLASS(CGumpEditorDoc))) return (CGumpEditorDoc*)pDoc;
	return NULL;
}