BOOL CModuleWnd::GetSelectModuleData(LPSTGMEDIUM lpStgMedium) { TCHAR buffer[MAX_PATH]; CString strName; POSITION pos = GetListCtrl()->GetFirstSelectedItemPosition(); int nItem; CPtrArray arrSubDoc; while (pos) { nItem = GetListCtrl()->GetNextSelectedItem(pos); GetListCtrl()->GetItemText(nItem, 0, buffer, MAX_PATH); strName = buffer; CDevDoc::CSubDoc* pSubDoc = m_pCurrentDocument->GetSubDocument(strName); arrSubDoc.Add(pSubDoc); } CDevDoc::GetSubDocumentData((CDevDoc::CSubDoc **)arrSubDoc.GetData(), arrSubDoc.GetSize(), lpStgMedium); for (int i = 0; i < arrSubDoc.GetSize(); i++) delete (CDevDoc::CSubDoc *)arrSubDoc[i]; arrSubDoc.RemoveAll(); return TRUE; }
// Resizes all the gadgets in an array to match the new size. // Generally called from an OnSize routine (or the like) void ResizeGadgetsOnWindow(GADGETRESIZEHANDLE Handle, int cx, int cy) { CPtrArray* pArray = (CPtrArray*)Handle; if (pArray == NULL || cx == 0 || cy == 0) return; ASSERT(pArray->GetSize() > 0); // must be at least one element in the array // if auto-sizing, go thru and reposition all the controls. CSize sizeWndOrig = ((RECT_AND_HWND*)pArray->GetAt(0))->m_rect.Size(); for (int i = 1; i < pArray->GetSize(); i++) { RECT_AND_HWND* pRectWnd = (RECT_AND_HWND*)pArray->GetAt(i); CRect newRect = pRectWnd->m_rect; CSize sizeCtlOrig = newRect.Size(); newRect.top = newRect.top * cy / sizeWndOrig.cy; newRect.left = newRect.left * cx / sizeWndOrig.cx; newRect.right = newRect.right * cx / sizeWndOrig.cx; // if bottom is < 0, then kepp it fixed height - used for combo boxes // where we don't really want to resize most of them... if (newRect.bottom < 0) newRect.bottom = newRect.top - newRect.bottom; else newRect.bottom = newRect.bottom * cy / sizeWndOrig.cy; ::SetWindowPos(pRectWnd->m_hWnd, NULL, newRect.left, newRect.top, newRect.Width(), newRect.Height(), SWP_NOZORDER); } }
void PrintDepend2(){ CFileRecord *pRec; int i; if( m_includes.GetSize() != 0 ){ fprintf(pAltFile, "\n\n\n%s: \\\n",m_pathName ); i = 0; while( i < m_includes.GetSize() ){ pRec = (CFileRecord*) m_includes[i]; fprintf(pAltFile, "\t\t\t%s\t\\\n",pRec->m_pathName ); i++; } } }
void CWorld::UpdateSpawns() { int i; CSpawnObject* obj; CPtrArray<CObject> spawnObjects; for (i = 0; i < m_objects[OT_CTRL].GetSize(); i++) { obj = (CSpawnObject*)m_objects[OT_CTRL].GetAt(i); if (obj->m_world && obj->m_isReal && obj->m_isRespawn) spawnObjects.Append(obj); } for (i = 0; i < m_objects[OT_ITEM].GetSize(); i++) { obj = (CSpawnObject*)m_objects[OT_ITEM].GetAt(i); if (obj->m_world && obj->m_isReal && obj->m_isRespawn) spawnObjects.Append(obj); } for (i = 0; i < m_objects[OT_MOVER].GetSize(); i++) { obj = (CSpawnObject*)m_objects[OT_MOVER].GetAt(i); if (obj->m_world && obj->m_isReal && obj->m_isRespawn) spawnObjects.Append(obj); } for (i = 0; i < spawnObjects.GetSize(); i++) SpawnObject(spawnObjects[i], g_global3D.spawnAllMovers); }
void Entity_XMLWrite( entity_t *pEntity, xmlNodePtr entity ){ brush_t *pBrush; epair_t *pEpair; xmlNodePtr node; CPtrArray *brushes = (CPtrArray*)pEntity->pData; for ( pEpair = pEntity->epairs; pEpair != NULL; pEpair = pEpair->next ) { node = xmlNewChild( entity, NULL, (xmlChar *)"epair", NULL ); Epair_XMLWrite( pEpair, node ); } for ( int i = 0; i < brushes->GetSize(); i++ ) { pBrush = (brush_t*)brushes->GetAt( i ); if ( pBrush->patchBrush ) { node = xmlNewChild( entity, NULL, (xmlChar *)"patch", NULL ); Patch_XMLWrite( pBrush->pPatch, node ); } else { node = xmlNewChild( entity, NULL, (xmlChar *)"brush", NULL ); Brush_XMLWrite( pBrush, node ); } } }
void CedExporter::RecordLocations(const CePoint& p, CMapPtrToPtr& locIndex) { //CString s; //s.Format("Process point %s", p.FormatKey()); //Log(s); //FILE* log = 0; //if (p.FormatKey() == "2632804") // log = LogFile; CPtrArray locs; const CeLocation* loc = p.GetpVertex(); GetAllCoincidentLocations(loc, locs, LogFile); //if (locs.GetSize() != 1) //{ // CString s; // s.Format("%d locs", locs.GetSize()); // Log(s); //} for (int i=0; i<locs.GetSize(); i++) { void* pLoc = locs.GetAt(i); locIndex.SetAt(pLoc, 0); } }
void CSearchCommentsDialog::OnDisplayresults() { UpdateData(TRUE); CQuery typeQuery; CQuery bodyQuery; if (!typeQuery.SetQueryText(m_szTypeString)) { return; } if (!bodyQuery.SetQueryText(m_szCommentText)) { return; } CPtrArray resultArray; m_Folder->QuerySurveyComments(&resultArray,&typeQuery,&bodyQuery); if (resultArray.GetSize()==0) { AfxMessageBox(IDS_NOMATCHONSEARCH); } else { CSearchResultDialog SRD(m_pView,&resultArray); SRD.DoModal(); } }
bool DispatchOnLButtonUp( guint32 nFlags, int x, int y ){ for ( int i = 0; i < l_WindowListeners.GetSize(); i++ ) if ( static_cast<IWindowListener*>( l_WindowListeners.GetAt( i ) )->OnLButtonUp( nFlags, x, y ) ) { return true; } return false; }
vector <CCoolDialogBar *> CCoolDialogBar::AllVisibleNeighbours(int *OwnIndex) { vector <CCoolDialogBar *> ret; CDockBar *pDockBar = (CDockBar*)GetParent(); ASSERT_KINDOF(CDockBar , pDockBar); bool row = false; CPtrArray *bars = &pDockBar->m_arrBars; for (int i = 0; i < bars->GetSize(); i++) { //CControlBar *pBar = pDockBar->GetDockedControlBar(i); CControlBar* pBar = (CControlBar*)pDockBar->m_arrBars[i]; if (HIWORD(pBar) == 0) pBar = NULL; if (!pBar) { if (row) break; ret.clear(); continue; } if (!pBar->IsVisible()) continue; if (this == pBar) { row = true; if (OwnIndex) *OwnIndex = ret.size(); } ret.push_back((CCoolDialogBar*)pBar); } return ret; }
void CSfxModel::SetFrame(float currentFrame) { if (currentFrame == m_currentFrame || currentFrame < 0.0f) return; if (currentFrame < m_currentFrame) { CPtrArray<Particle>* particles; int j; for (int i = 0; i < m_particles.GetSize(); i++) { particles = m_particles[i]; if (particles) { for (j = 0; j < particles->GetSize(); j++) Delete(particles->GetAt(j)); particles->RemoveAll(); } } m_currentFrame = -0.5f; } while (currentFrame > m_currentFrame) { if (!_nextFrame()) break; } if (m_currentFrame < 0.0f) m_currentFrame = 0.0f; }
void PrintIncludes(){ int i = 0; while( i < m_includes.GetSize() ){ CFileRecord *pRec = (CFileRecord*) m_includes[i]; // Don't write out files that don't exist or are not in the namespace // of the programs using it (netscape_AppletMozillaContext.h doesn't // mix well with 16 bits). // Also don't write out files that are in the noDependMap void* lookupJunk; if( !pRec->m_bVisited && pRec->m_pathName.GetLength() != 0 && !noDependMap.Lookup(pRec->m_pathName, lookupJunk)) { // not supposed to have a file in the list that doesn't exist ASSERT(FileExists(pRec->m_pathName)); CString csOutput; csOutput = pRec->m_pathName; FATName(csOutput); fprintf(pAltFile, "\\\n %s ", (const char *) csOutput ); // mark this one as done so we don't do it more than once pRec->m_bVisited = TRUE; pRec->PrintIncludes(); } i++; } }
CG2Neighbour* CNeighboursWithG2::GetRandomHub(CG2Neighbour* pExcept, GGUID* pGUID) { CPtrArray pRandom; for ( POSITION pos = GetIterator() ; pos ; ) { CG2Neighbour* pNeighbour = (CG2Neighbour*)GetNext( pos ); if ( pNeighbour->m_nState == nrsConnected && pNeighbour->m_nProtocol == PROTOCOL_G2 && pNeighbour->m_nNodeType != ntLeaf && pNeighbour != pExcept ) { if ( pNeighbour->m_pGUIDCache->Lookup( pGUID ) == NULL ) { pRandom.Add( pNeighbour ); } } } int nSize = pRandom.GetSize(); if ( ! nSize ) return NULL; nSize = rand() % nSize; return (CG2Neighbour*)pRandom.GetAt( nSize ); }
void EditSerializer::WritePersistentArray(DataField field, const CPtrArray& a) { WriteBegin(field, 0); WriteUInt32(DataField_Length, a.GetSize()); char itemName[16]; for (int i=0; i<a.GetSize(); i++) { sprintf(itemName, "[%d]", i); const Persistent_c* const p = (const Persistent_c* const)a.GetAt(i); WritePersistent(itemName, *p); } WriteEnd(); }
LRESULT CRegNewUserDlg::OnCompanyInfoRslt(WPARAM wParam, LPARAM lParam) { m_cbCompany.DeleteAllItem(); CPtrArray* pArray = (CPtrArray*)lParam; for(int i = 0; i < pArray->GetSize(); i++) { CString strName; CString strCode; SCOMBO_INFO *pData = static_cast<SCOMBO_INFO*>(pArray->GetAt(i)); strName = pData->m_strCodeName; strCode += pData->m_strCode; strCode += IDMSCOMBOBOX_DELIM; m_cbCompany.AddItem(strName, strCode); } m_cbCompany.SetCurSel(0); m_cbCompany.SetCode(m_strCompany); // Clear for(int j = 0; j < pArray->GetSize(); j++) { SCOMBO_INFO *pData = static_cast<SCOMBO_INFO*>(pArray->GetAt(j)); if(pData != NULL) { delete pData; } } delete pArray; UpdateData(FALSE); // 소속 -> TEAM. (CODE_NAME, CODE) TRACEX("RAWSQL_TEAM 요청!\n"); CString strQuery = GetQueryTeam(m_cbCompany.GetCode()); if(CChatSession::Instance().RequestRawSQL(RAWSQL_TEAM, (LPCSTR)strQuery, strlen((LPCSTR)strQuery) ) != TRUE) { return FALSE; } return TRUE; }
void FifthCKF::FifthCKFDelete(CPtrArray &X) { #pragma omp parallel for for (int i = 0; i < X.GetSize(); ++i) { delete (StoreData *)X.GetAt(i); } X.RemoveAll(); }
/* ============ Select_Ray If the origin is inside a brush, that brush will be ignored. ============ */ void Select_Ray( vec3_t origin, vec3_t dir, int flags ) { trace_t t; t = Test_Ray( origin, dir, flags ); if ( !t.brush ) return; if ( flags == SF_SINGLEFACE ) { int nCount = g_SelectedFaces.GetSize(); bool bOk = true; for ( int i = 0; i < nCount; i++ ) { if ( t.face == reinterpret_cast<face_s*>( g_SelectedFaces.GetAt( i ) ) ) { bOk = false; // need to move remove i'th entry g_SelectedFaces.RemoveAt( i, 1 ); g_SelectedFaceBrushes.RemoveAt( i, 1 ); } } if ( bOk ) { g_SelectedFaces.Add( t.face ); g_SelectedFaceBrushes.Add( t.brush ); } //selected_face = t.face; //selected_face_brush = t.brush; Sys_UpdateWindows( W_ALL ); clearSelection(); // Texture_SetTexture requires a brushprimit_texdef fitted to the default width=2 height=2 texture brushprimit_texdef_s brushprimit_texdef; ConvertTexMatWithQTexture( &t.face->brushprimit_texdef, t.face->d_texture, &brushprimit_texdef, NULL ); Texture_SetTexture( &t.face->texdef, &brushprimit_texdef, false, false ); UpdateSurfaceDialog(); return; } // move the brush to the other list clearSelection(); if ( t.selected ) { Brush_RemoveFromList( t.brush ); Brush_AddToList( t.brush, &active_brushes ); UpdatePatchInspector(); } else { Select_Brush( t.brush, !( GetKeyState( VK_MENU ) & 0x8000 ) ); } Sys_UpdateWindows( W_ALL ); }
char *ShaderNameLookup( patchMesh_t * patch ){ int i; int count = PatchShaders.GetSize(); for ( i = 0; i < count; i++ ) { if ( static_cast < patchEntry_t * >( PatchShaders.GetAt( i ) )->p == patch ) { return static_cast < patchEntry_t * >( PatchShaders.GetAt( i ) )->name; } } Sys_FPrintf( SYS_ERR, "ERROR: failed to lookup name in ShaderNameLookup??\n" ); return const_cast<char*>(SHADER_NOT_FOUND); }
char *ShaderNameLookup(patchMesh_t *patch) { int i; int count = PatchShaders.GetSize(); for(i=0; i<count; i++) { if (static_cast<patchEntry_t*>(PatchShaders.GetAt(i))->p == patch) return static_cast<patchEntry_t*>(PatchShaders.GetAt(i))->name; } Sys_Printf("ERROR: failed to lookup name in ShaderNameLookup??\n"); return "radiant/notex"; }
BOOL CGuiDocBarExtenEx::_IsMenuBar(int nPos, CPtrArray& arrBars) { if (nPos < arrBars.GetSize()) { CControlBar* pBar = (CControlBar*)arrBars[nPos]; if (pBar && pBar->GetDlgCtrlID() == AFX_IDW_MENUBAR) return TRUE; else return FALSE; } else return FALSE; }
//직급 LRESULT CRegNewUserDlg::OnClassInfoRslt(WPARAM wParam, LPARAM lParam) { m_cbGrade.DeleteAllItem(); CPtrArray* pArray = (CPtrArray*)lParam; for(int i = 0; i < pArray->GetSize(); i++) { CString strName; CString strCode; SCOMBO_INFO *pData = static_cast<SCOMBO_INFO*>(pArray->GetAt(i)); strName = pData->m_strCodeName; strCode += pData->m_strCode; strCode += IDMSCOMBOBOX_DELIM; m_cbGrade.AddItem(strName, strCode); } m_cbGrade.SetCurSel(0); m_cbGrade.SetCode(m_strGrade); // Clear for(int j = 0; j < pArray->GetSize(); j++) { SCOMBO_INFO *pData = static_cast<SCOMBO_INFO*>(pArray->GetAt(j)); if(pData != NULL) { delete pData; } } delete pArray; UpdateData(FALSE); return TRUE; }
void EndOfSMTP () { // 等待所有线程执行完毕 for ( int i=0; i<g_PtrAry_Threads.GetSize(); i++ ) { HANDLE hThread = (HANDLE)g_PtrAry_Threads.GetAt(i); if ( HANDLE_IS_VALID(hThread) ) { WaitForThreadEnd ( &hThread, 30*1000 ); } } g_PtrAry_Threads.RemoveAll (); }
void WINAPI QERApp_UnHookWindow( IWindowListener* pListen ){ for ( int i = 0; i < l_WindowListeners.GetSize(); i++ ) { if ( l_WindowListeners.GetAt( i ) == pListen ) { l_WindowListeners.RemoveAt( i ); pListen->DecRef(); return; } } #ifdef _DEBUG Sys_FPrintf( SYS_WRN, "WARNING: IWindowListener not found in QERApp_UnHookWindow\n" ); #endif }
CMapInfo* FindInMap(const TCHAR* psz) { ENSURE(psz != NULL); ENSURE(*psz != 0); int nMax = (int)aMap.GetSize(); for (int i = 0; i < nMax; i++) { CMapInfo* pInfo = (CMapInfo*)aMap.GetAt(i); size_t nLen = _tcslen(pInfo->pszPrefixFrom); if (_tcsncmp(pInfo->pszPrefixFrom, psz, nLen) == 0) return pInfo; } return NULL; }
CSfxModel::~CSfxModel() { CPtrArray<Particle>* particles; int j; for (int i = 0; i < m_particles.GetSize(); i++) { particles = m_particles[i]; if (particles) { for (j = 0; j < particles->GetSize(); j++) Delete(particles->GetAt(j)); Delete(particles); } } }
void WINAPI QERApp_UnHookGLWindow(IGLWindow* pGLW) { for( int i = 0; i < l_GLWindows.GetSize(); i++ ) { if (l_GLWindows.GetAt(i) == pGLW) { l_GLWindows.RemoveAt(i); pGLW->DecRef(); return; } } #ifdef _DEBUG Sys_Printf("ERROR: IGLWindow* not found in QERApp_UnHookGLWindow\n"); #endif }
void CPropMapCtrl::OnDeleteProperty() { // Fire the Delete Property Event // FireDeleteProperty(m_pPropMap, NULL); // go through the list of properties and delete each selected one int iSelected = m_listCtrl.GetSelectedCount(); if (iSelected == 0) return; CPtrArray cpaSelections; cpaSelections.SetSize(iSelected); int iItem = m_listCtrl.GetNextItem(-1, LVNI_SELECTED); int i = 0; int iLastItem; while (iItem != -1) { iLastItem = iItem; cpaSelections.SetAt(i++, (CPropListData *) m_listCtrl.GetItemData(iItem)); iItem = m_listCtrl.GetNextItem(iItem, LVNI_SELECTED); } HRESULT hr = S_OK; BSTR bstrName = NULL; for (i = cpaSelections.GetSize() - 1; i > -1; i--) { CPropListData *pld = (CPropListData *) cpaSelections.GetAt(i); if (!pld) break; // iItem is the selected item BOOL bFailed = FALSE; bstrName = pld->m_strName.AllocSysString(); hr = m_pPropMap->Remove(bstrName); if (FAILED(hr)) goto failexit; iLastItem--; } m_listCtrl.SelectItem(iLastItem + 1); failexit: // clean up SAFEFREESTRING(bstrName); }
void Map_Read( IDataStream *in, CPtrArray *map ){ entity_t *pEntity; char *buf; unsigned long len = in->GetLength(); buf = new char[len + 1]; in->Read( buf, len ); buf[len] = '\0'; StartTokenParsing( buf ); abortcode = MAP_NOERROR; while ( abortcode == MAP_NOERROR ) { if ( !GetToken( true ) ) { // { or NULL break; } pEntity = Entity_Alloc(); pEntity->pData = new CPtrArray; Entity_Parse( pEntity ); map->Add( pEntity ); } delete [] buf; if ( abortcode != MAP_NOERROR ) { int num_ents, num_brushes,i,j; entity_t *e; CPtrArray *brushes; num_ents = map->GetSize(); for ( i = 0; i < num_ents; i++ ) { e = (entity_t*)map->GetAt( i ); brushes = (CPtrArray*)e->pData; num_brushes = brushes->GetSize(); for ( j = 0; j < num_brushes; j++ ) { Brush_Free( (brush_t *)brushes->GetAt( j ), true ); } brushes->RemoveAll(); delete brushes; Entity_Free( e ); } map->RemoveAll(); } }
void Select_Reselect() { brush_s* b; CPtrArray holdArray; for ( b = selected_brushes.next ; b && b != &selected_brushes ; b = b->next ) { holdArray.Add( reinterpret_cast<void*>( b ) ); } int n = holdArray.GetSize(); while ( n-- > 0 ) { b = reinterpret_cast<brush_s*>( holdArray.GetAt( n ) ); Select_Brush( b ); } Sys_UpdateWindows( W_ALL ); }
void Map_FreeEntities( CPtrArray *ents ){ int i, j, num_ents, num_brushes; entity_t* e; CPtrArray* brushes; num_ents = ents->GetSize(); for ( i = 0; i < num_ents; i++ ) { e = (entity_t*)ents->GetAt( i ); brushes = (CPtrArray*)e->pData; num_brushes = brushes->GetSize(); for ( j = 0; j < num_brushes; j++ ) Brush_Free( (brush_t*)brushes->GetAt( j ) ); brushes->RemoveAll(); delete (CPtrArray*)e->pData; e->pData = NULL; Entity_Free( e ); } ents->RemoveAll(); }
TEST_F(EngineTestParser, findCodesFiles_noCodesFiles) { CPtrArray arr; CCodeDirectories* pDirs = new CCodeDirectories; pDirs->m_strOriginalDir = m_strRootPath.c_str(); arr.Add(pDirs); int nRes = m_parser.findSubDirs(arr); EXPECT_NE(0, nRes); bool bRes = m_parser.findCodesFiles(arr); nRes = arr.GetSize(); if (nRes != 0) { for (int i = 0; i < nRes; i++) { CCodeDirectories* pDirs = (CCodeDirectories*)arr.GetAt(i); delete pDirs; } arr.RemoveAll(); } SetCurrentDirectory(g_strCurrentDir.c_str()); ASSERT_FALSE(bRes); }