PyObject *CProtectedWinApp::MakePyDocTemplateList() { PyObject *retList = PyList_New(0); if (retList==NULL) return NULL; POSITION posTempl = m_pDocManager ? m_pDocManager->GetFirstDocTemplatePosition() : NULL; while (posTempl) { CDocTemplate* pTemplate = m_pDocManager->GetNextDocTemplate(posTempl); ASSERT(pTemplate->IsKindOf(RUNTIME_CLASS(CDocTemplate))); PyObject *newListItem = ui_assoc_object::make(PyCDocTemplate::type, pTemplate)->GetGoodRet(); if (newListItem==NULL) { Py_DECREF(retList); return NULL; } PyList_Append(retList, newListItem); Py_DECREF(newListItem); } return retList; }
// FindOpenDocument - if the C++ framework has a document with this name open, // then return a pointer to it, else NULL. CDocument *CProtectedWinApp::FindOpenDocument(const TCHAR *lpszFileName) { POSITION posTempl = m_pDocManager->GetFirstDocTemplatePosition(); CDocument* pOpenDocument = NULL; TCHAR szPath[_MAX_PATH]; if (!AfxFullPath(szPath, lpszFileName)) _tcscpy(szPath, lpszFileName); while (posTempl) { CDocTemplate* pTemplate = m_pDocManager->GetNextDocTemplate(posTempl); ASSERT(pTemplate->IsKindOf(RUNTIME_CLASS(CDocTemplate))); // go through all documents POSITION posDoc = pTemplate->GetFirstDocPosition(); while (posDoc) { CDocument* pDoc = pTemplate->GetNextDoc(posDoc); if (lstrcmpi(pDoc->GetPathName(), szPath) == 0) return pDoc; } } return NULL; }
BOOL DlgFFT::OnInitDialog() { CDialog::OnInitDialog(); m_ok.SetIcon(IDI_G,BS_LEFT); m_canc.SetIcon(IDI_R,BS_LEFT); m_cforcefft.SetCheck(1); //m_cmagnitude.SetCheck(1); m_real.AddString("(None)"); m_real.SetItemData(m_real.GetCount()-1, 0); m_imag.AddString("(None)"); m_imag.SetItemData(m_imag.GetCount()-1, 0); POSITION pos = AfxGetApp()->GetFirstDocTemplatePosition(); while (pos != NULL) { CDocTemplate* pTemplate = AfxGetApp()->GetNextDocTemplate(pos); ASSERT(pTemplate->IsKindOf(RUNTIME_CLASS(CDocTemplate))); POSITION pos2 = pTemplate->GetFirstDocPosition(); while (pos2 != NULL) { CDemoDoc* pDoc = (CDemoDoc*) pTemplate->GetNextDoc(pos2); ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CDemoDoc))); CString title = pDoc->GetTitle(); m_real.AddString(title); m_real.SetItemData(m_real.GetCount()-1, (DWORD)pDoc); m_imag.AddString(title); m_imag.SetItemData(m_imag.GetCount()-1, (DWORD)pDoc); } } m_real.SetCurSel(0); m_imag.SetCurSel(0); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL DlgMix::OnInitDialog() { CDialog::OnInitDialog(); m_bitmap=0; m_ratio=1.0f; m_xoffset=m_yoffset=0; pDocSrc = pDocDst = 0; OpType=0; m_mixalpha = 0; m_ok.SetIcon(IDI_G,BS_LEFT); m_canc.SetIcon(IDI_R,BS_LEFT); POSITION pos = AfxGetApp()->GetFirstDocTemplatePosition(); while (pos != NULL) { CDocTemplate* pTemplate = AfxGetApp()->GetNextDocTemplate(pos); ASSERT(pTemplate->IsKindOf(RUNTIME_CLASS(CDocTemplate))); POSITION pos2 = pTemplate->GetFirstDocPosition(); while (pos2 != NULL) { CDemoDoc* pDoc = (CDemoDoc*) pTemplate->GetNextDoc(pos2); ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CDemoDoc))); CString title = pDoc->GetTitle(); m_cbSrc.AddString(title); m_cbSrc.SetItemData(m_cbSrc.GetCount()-1, (DWORD)pDoc); m_cbDst.AddString(title); m_cbDst.SetItemData(m_cbDst.GetCount()-1, (DWORD)pDoc); } } m_cbSrc.SetCurSel(0); if (m_cbDst.GetCount()>1){ m_cbDst.SetCurSel(1); } else { m_cbDst.SetCurSel(0); } m_cbOpType.AddString(_T("OpAvg")); m_cbOpType.SetItemData(m_cbOpType.GetCount()-1, (DWORD)CxImage::OpAvg); m_cbOpType.AddString(_T("OpAdd")); m_cbOpType.SetItemData(m_cbOpType.GetCount()-1, (DWORD)CxImage::OpAdd); m_cbOpType.AddString(_T("OpAnd")); m_cbOpType.SetItemData(m_cbOpType.GetCount()-1, (DWORD)CxImage::OpAnd); m_cbOpType.AddString(_T("OpXor")); m_cbOpType.SetItemData(m_cbOpType.GetCount()-1, (DWORD)CxImage::OpXor); m_cbOpType.AddString(_T("OpOr")); m_cbOpType.SetItemData(m_cbOpType.GetCount()-1, (DWORD)CxImage::OpOr); m_cbOpType.AddString(_T("OpScreen")); m_cbOpType.SetItemData(m_cbOpType.GetCount()-1, (DWORD)CxImage::OpScreen); m_cbOpType.AddString(_T("OpMask")); m_cbOpType.SetItemData(m_cbOpType.GetCount()-1, (DWORD)CxImage::OpMask); m_cbOpType.AddString(_T("OpSrcCopy")); m_cbOpType.SetItemData(m_cbOpType.GetCount()-1, (DWORD)CxImage::OpSrcCopy); m_cbOpType.AddString(_T("OpDstCopy")); m_cbOpType.SetItemData(m_cbOpType.GetCount()-1, (DWORD)CxImage::OpDstCopy); m_cbOpType.AddString(_T("OpSub")); m_cbOpType.SetItemData(m_cbOpType.GetCount()-1, (DWORD)CxImage::OpSub); m_cbOpType.AddString(_T("OpSrcBlend")); m_cbOpType.SetItemData(m_cbOpType.GetCount()-1, (DWORD)CxImage::OpSrcBlend); m_cbOpType.SetCurSel(0); SetMix(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }