void CVisProp::SetSharing(bool f) { assert(IsValid()); if (f != IsShared()) { if (!IsShared()) { if ((FPointerToObject()) || (IsArray())) { // Just need to change the flag. m_fShared = f; } else { if (IsObjReference()) { // Make a temporary copy of the pointer to the object SetObjReferenceFromPv(PvObj(), true); } else { __int64 llDataT = m_llData; SetObjFromPv((void *) &llDataT, true); } } } else { // LATER: Have a special case for a shared object with only // one reference. (In that case, we only need to change m_fShared.) CVisProp propT = *this; if (propT.IsArray()) { if (propT.IsObjReference()) { SetObjReferenceFromPv(propT.PRefCntArray()->PvObjFirst(), false, propT.Dim()); } else { SetObjFromPv(propT.PRefCntArray()->PvObjFirst(), false, propT.Dim()); } } else { if (propT.IsObjReference()) { SetObjReferenceFromPv(propT.PvObj(), false); } else { SetObjFromPv(propT.PvObj(), false); } } } } }
ShaderParameter *ShaderParamTextureCubeMap::Clone() { ShaderParamTextureCubeMap *newParam; // Shared params are shared at the pointer level, exactly the same. Non shared are new instances if (IsShared()) newParam = this; else { newParam = new ShaderParamTextureCubeMap(GetName()); newParam->mTextureAddressMode[0] = mTextureAddressMode[0]; newParam->mTextureAddressMode[1] = mTextureAddressMode[1]; newParam->mTextureAddressMode[2] = mTextureAddressMode[2]; newParam->mTextureAddressMode[3] = mTextureAddressMode[3]; newParam->SetTextureSourceType(GetTextureSourceType()); newParam->SetTexture(GetTexture()); newParam->SetTextureUnit(GetTextureUnit()); newParam->SetImageSourceDirty(false); newParam->SetDirty(false); // no need to copy over the image. It will get loaded when you attach to render state. } return newParam; }
bool CVisProp::FSharedDefault(void) const { if (IsValid()) return IsShared(); return !(PropTypeInfo().CanCopyObjectBytes()); }
void CVisProp::SetObjFromPv(const void *pvObj, bool fShared) { assert(pvObj != 0); assert(!IsValid() || !FPointerToObject() || PvRefCntObj() != 0); const CVisPropTypeInfoBase *pproptypeinfo = &PropTypeInfo(); if (IsValid() && (IsObjReference() || IsArray())) ReleaseObj(); SetFObjReference(false); if ((IsValid()) && (IsShared() == fShared)) { pproptypeinfo->AssignObjToObj(pvObj, PvObj()); } else { if (IsValid()) ReleaseObj(); SetFShared(fShared); SetFPointerToObject(fShared || !pproptypeinfo->CanCopyObjectBytes()); if (!FPointerToObject()) { SetFInitialized(true); pproptypeinfo->AssignObjToObj(pvObj, PvObj()); } else { SetPvRefCntObj(pproptypeinfo->PvRefCntObjMakePvObj(pvObj)); SetFInitialized(true); } } }
void CVisProp::SetObjReferenceFromPv(void *pvObj, bool fShared) { if (IsValid() && IsArray()) ReleaseObj(); assert(!IsValid() || !FPointerToObject() || PvRefCntObj() != 0); if ((IsValid()) && (IsShared() == fShared) && (IsObjReference())) { ((CVisRefCntObj<void *> *) PvRefCntObj())->Obj() = pvObj; } else { ReleaseObj(); SetFShared(fShared); SetFPointerToObject(fShared); if (fShared) { SetPvRefCntObj(new CVisRefCntObj<void *>(pvObj)); } else { *((void * *) (void *) &m_llData) = pvObj; } SetFObjReference(true); SetFInitialized(true); } }
void CDirectoryTreeCtrl::AddShare(CString strDir) { if (strDir.Right(1) != _T('\\')) strDir += _T('\\'); if (IsShared(strDir) || !strDir.CompareNoCase(thePrefs.GetMuleDirectory(EMULE_CONFIGDIR))) return; m_lstShared.AddTail(strDir); }
void CDirectoryTreeCtrl::AddShare(CString strDir) { if (strDir.Right(1) != _T('\\')) strDir += _T('\\'); if (IsShared(strDir) || !strDir.CompareNoCase(CString(thePrefs.GetConfigDir()) )) return; m_lstShared.AddTail(strDir); }
void CDirectoryTreeCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point) { CPoint ptMenu(-1, -1); if (point.x != -1 && point.y != -1) { ptMenu = point; ScreenToClient(&point); } else { HTREEITEM hSel = GetNextItem(TVI_ROOT, TVGN_CARET); if (hSel) { CRect rcItem; if (GetItemRect(hSel, &rcItem, TRUE)) { ptMenu.x = rcItem.left; ptMenu.y = rcItem.top; ClientToScreen(&ptMenu); } } else ClientToScreen(&(ptMenu = (0, 0))); } HTREEITEM hItem = HitTest(point); // create the menu CTitleMenu SharedMenu; SharedMenu.CreatePopupMenu(); if (m_lstShared.GetCount() == 0) SharedMenu.AddMenuTitle(GetResString(IDS_NOSHAREDFOLDERS)); else SharedMenu.AddMenuTitle(GetResString(IDS_SHAREDFOLDERS)); // add right clicked folder, if any if (hItem) { m_strLastRightClicked = GetFullPath(hItem); if (!IsShared(m_strLastRightClicked)) SharedMenu.AppendMenu(MF_STRING, MP_SHAREDFOLDERS_FIRST-1, (LPCTSTR)(GetResString(IDS_VIEW1) + m_strLastRightClicked +GetResString(IDS_VIEW2))); } // add all shared directories int iCnt = 0; for (POSITION pos = m_lstShared.GetHeadPosition(); pos != NULL; iCnt++) SharedMenu.AppendMenu(MF_STRING,MP_SHAREDFOLDERS_FIRST+iCnt, (LPCTSTR)m_lstShared.GetNext(pos)); // display menu SharedMenu.TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON, ptMenu.x, ptMenu.y, this); VERIFY( SharedMenu.DestroyMenu() ); }
void ShaderParamTextureCubeMap::AttachToRenderState(osg::StateSet &stateSet) { dtCore::RefPtr<osg::TextureCubeMap> texCube; if (GetTexture().empty() && GetTextureSourceType() != ShaderParamTexture::TextureSourceType::AUTO) { throw dtUtil::Exception(ShaderParameterException::INVALID_ATTRIBUTE,"Cannot attach to render state. Texture " "for parameter " + GetName() + " has not been specified.", __FILE__, __LINE__); } osg::Uniform *uniform = NULL; if (IsShared()) uniform = GetUniformParam(); // Create a new one if unshared or if shared but not set yet if (uniform == NULL) { uniform = new osg::Uniform(osg::Uniform::SAMPLER_CUBE,GetName()); uniform->set((int)GetTextureUnit()); SetUniformParam(*uniform); } stateSet.addUniform(uniform); // Load (if necessary) and Set the Tex cube map on the StateSet if(GetTextureSourceType() == ShaderParamTexture::TextureSourceType::CUBEMAP_IMAGE_POSITIVE_X || GetTextureSourceType() == ShaderParamTexture::TextureSourceType::CUBEMAP_IMAGE_NEGATIVE_X || GetTextureSourceType() == ShaderParamTexture::TextureSourceType::CUBEMAP_IMAGE_POSITIVE_Y || GetTextureSourceType() == ShaderParamTexture::TextureSourceType::CUBEMAP_IMAGE_NEGATIVE_Y || GetTextureSourceType() == ShaderParamTexture::TextureSourceType::CUBEMAP_IMAGE_POSITIVE_Z || GetTextureSourceType() == ShaderParamTexture::TextureSourceType::CUBEMAP_IMAGE_NEGATIVE_Z ) { texCube = static_cast<osg::TextureCubeMap*>(GetTextureObject()); // load or reload the image - allows caching from the template // Note - ImageSourceDirty may not be relevant anymore cause it now loads the image when you call SetTexture(). // note - If shared, load only happens the first time it is assigned. // check only if face 0 exists. Is this sufficient? if (texCube->getImage(osg::TextureCubeMap::POSITIVE_X) == NULL || IsImageSourceDirty()) { LoadImage(); ApplyTextureCubeMapValues(); } //Assign the completed texture attribute to the render state. stateSet.setTextureAttributeAndModes(GetTextureUnit(), texCube.get(), osg::StateAttribute::ON); } SetDirty(false); }
HTREEITEM CDirectoryTreeCtrl::AddChildItem(HTREEITEM hRoot, CString strText) { CString strDir = GetFullPath(hRoot); strDir += strText; if (hRoot == NULL) strDir += _T('\\'); TV_INSERTSTRUCT itInsert; SHFILEINFO shFinfo; memzero(&itInsert, sizeof(itInsert)); if ( SHGetFileInfo( strDir, FILE_ATTRIBUTE_DIRECTORY, &shFinfo, sizeof(shFinfo), SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES ) != NULL ) { itInsert.item.mask |= TVIF_IMAGE; itInsert.item.iImage = shFinfo.iIcon; } if ( SHGetFileInfo( strDir, FILE_ATTRIBUTE_DIRECTORY, &shFinfo, sizeof(shFinfo), SHGFI_SYSICONINDEX | SHGFI_OPENICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES ) != NULL ) { itInsert.item.mask |= TVIF_SELECTEDIMAGE; itInsert.item.iSelectedImage = shFinfo.iIcon; } if (hRoot != NULL) strDir += _T('\\'); if (HasSharedSubdirectory(strDir)) itInsert.item.state = TVIS_BOLD; if (HasSubdirectories(strDir)) itInsert.item.cChildren = 1; // used to display the + symbol next to each item itInsert.item.mask |= TVIF_CHILDREN | TVIF_HANDLE | TVIF_TEXT | TVIF_STATE; itInsert.item.stateMask = TVIS_BOLD; itInsert.item.pszText = const_cast<LPTSTR>(strText.GetString()); itInsert.hInsertAfter = (hRoot == NULL) ? TVI_LAST : TVI_SORT; // root items are already sorted itInsert.hParent = hRoot; HTREEITEM hItem = InsertItem(&itInsert); if (IsShared(strDir)) SetCheck(hItem); return hItem; }
void CDirectoryTreeCtrl::OnNMRclickSharedList(NMHDR *pNMHDR, LRESULT *pResult) { NOPRM(pNMHDR); // Get item under cursor POINT point; ::GetCursorPos(&point); CPoint p = point; ScreenToClient(&p); HTREEITEM hItem = HitTest(p); CTitleMenu menuShared; // Create the menu menuShared.CreatePopupMenu(); menuShared.AddMenuTitle(GetResString((m_lstShared.GetCount() == 0) ? IDS_NOSHAREDFOLDERS : IDS_SHAREDFOLDERS)); bool bFolder = false; // Add right clicked folder, if any if (hItem) { m_strLastRightClicked = GetFullPath(hItem); if (!IsShared(m_strLastRightClicked)) { CString strTmp; strTmp.Format(GetResString(IDS_VIEW_NOTSHARED), m_strLastRightClicked); menuShared.AppendMenu(MF_STRING, MP_SHAREDFOLDERS_FIRST - 1, strTmp); bFolder = true; } } // Add all shared directories int iCnt = 0; for (POSITION pos = m_lstShared.GetHeadPosition(); pos != NULL; iCnt++) menuShared.AppendMenu(MF_STRING,MP_SHAREDFOLDERS_FIRST+iCnt, (LPCTSTR)m_lstShared.GetNext(pos)); // Display menu (do not display empty menu) if ((m_lstShared.GetHeadPosition() != NULL) || bFolder) { menuShared.TrackPopupMenuEx(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this, NULL); } *pResult = 0; // Menu objects are destroyed in their destructor }
Share<ITexture> FrameBuffer::DetachTexture( GraphicsAttachment attachment ) { auto texture=mTextures.GetOptional(attachment,nullptr); if (texture==nullptr) { MEDUSA_ASSERT_FAILED("Cannot find attachment"); return nullptr; } bool isShared=texture->IsShared(); mTextures.RemoveKey(attachment); Bind(true); Render::Instance().AttachTextureToFrameBuffer(attachment,GraphicsTextureTarget::Texture2D,0,0); //GraphicsTextureTarget::Texture2D is ignored inside Bind(false); UpdateClearMask(attachment,false); return isShared?texture:nullptr; }
void XPCWrappedNativeProto::JSProtoObjectFinalized(JSContext *cx, JSObject *obj) { NS_ASSERTION(obj == mJSProtoObject, "huh?"); // Map locking is not necessary since we are running gc. if(IsShared()) { // Only remove this proto from the map if it is the one in the map. ClassInfo2WrappedNativeProtoMap* map = GetScope()->GetWrappedNativeProtoMap(ClassIsMainThreadOnly()); if(map->Find(mClassInfo) == this) map->Remove(mClassInfo); } GetRuntime()->GetDetachedWrappedNativeProtoMap()->Remove(this); GetRuntime()->GetDyingWrappedNativeProtoMap()->Add(this); mJSProtoObject = nsnull; }
void String0::LCat(int c) { if(IsSmall()) { qword *x = (qword *)MAlloc_S(); x[0] = q[0]; x[1] = q[1]; LLen() = SLen(); SLen() = 15; chr[KIND] = MEDIUM; qptr = x; } int l = LLen(); if(IsRef() ? !IsShared() && l < (int)Ref()->alloc : l < 31) { ptr[l] = c; ptr[LLen() = l + 1] = 0; } else { char *s = Insert(l, 1, NULL); s[0] = c; s[1] = 0; } }
void ShaderParamTextureCubeMap::DetachFromRenderState(osg::StateSet &stateSet) { osg::TextureCubeMap *texCube = static_cast<osg::TextureCubeMap*>(GetTextureObject()); if (texCube != NULL) { if (!IsShared()) { osg::Image *image = new osg::Image(); texCube->setImage(osg::TextureCubeMap::POSITIVE_X, image); texCube->setImage(osg::TextureCubeMap::NEGATIVE_X, image); texCube->setImage(osg::TextureCubeMap::POSITIVE_Y, image); texCube->setImage(osg::TextureCubeMap::NEGATIVE_Y, image); texCube->setImage(osg::TextureCubeMap::POSITIVE_Z, image); texCube->setImage(osg::TextureCubeMap::NEGATIVE_Z, image); } stateSet.setTextureAttributeAndModes(GetTextureUnit(),texCube,osg::StateAttribute::OFF); } // do normal parameter cleanup ShaderParameter::DetachFromRenderState(stateSet); }
void CVisProp::WriteValue(CVisSDOStream& refsdostream, bool fOnlyValue, const void *pvReferenceOffset) const { assert(IsValid()); if (IsPrinted()) { #ifndef VIS_NO_SD_STREAM if ((!fOnlyValue) && (IsShared())) refsdostream.WriteSharedPrefix(); if (IsArray()) { void *pvObjFirst = PRefCntArray()->PvObjFirst(); if ((pvReferenceOffset != 0) && (IsObjReference())) { pvObjFirst = (void *) (((BYTE *) pvObjFirst) + ((int) pvReferenceOffset)); } m_pproptypeinfo->WriteObjArray(refsdostream, Dim(), pvObjFirst, Name(), fOnlyValue); } else { void *pvObj = PvObj(); if ((pvReferenceOffset != 0) && (IsObjReference())) { pvObj = (void *) (((BYTE *) pvObj) + ((int) pvReferenceOffset)); } m_pproptypeinfo->WriteObj(refsdostream, pvObj, Name(), fOnlyValue); } #endif // VIS_NO_SD_STREAM } }
void FolderTree::DisplayDrives(HTREEITEM hParent, bool bUseSetRedraw) { //CWaitCursor c; //Speed up the job by turning off redraw if (bUseSetRedraw) SetRedraw(false); //Enumerate the drive letters and add them to the tree control DWORD dwDrives = GetLogicalDrives(); DWORD dwMask = 1; for (int i=0; i<32; i++) { if (dwDrives & dwMask) { tstring sDrive; sDrive = (wchar_t)('A' + i); sDrive += _T(":\\"); //check if this drive is one of the types to hide if (CanDisplayDrive(sDrive)) { FolderTreeItemInfo* pItem = new FolderTreeItemInfo; pItem->m_sFQPath = sDrive; pItem->m_sRelativePath = sDrive; //Insert the item into the view InsertFileItem(hParent, pItem, m_bShowSharedUsingDifferentIcon && IsShared(sDrive), GetIconIndex(sDrive), GetSelIconIndex(sDrive), true); } } dwMask <<= 1; } if (bUseSetRedraw) SetRedraw(true); }
void LayerBase::Unlock() { if (IsShared()) { forward_mutex_->unlock(); } }
void CDirectoryTreeCtrl::AddShare(CString strDir) { if (!IsShared(strDir) && strDir.CompareNoCase(g_App.m_pPrefs->GetConfigDir())) m_lstShared.AddTail(strDir); }
HTREEITEM CDirectoryTreeCtrl::AddChildItem(HTREEITEM hRoot, CString strText) { CString strPath = GetFullPath(hRoot); if (hRoot != NULL && strPath.Right(1) != _T("\\")) strPath += _T("\\"); CString strDir = strPath + strText; TV_INSERTSTRUCT itInsert; //==>optimizer added [shadow2004] #ifdef OPTIM memzero(&itInsert, sizeof(itInsert)); #else //OPTIM memset(&itInsert, 0, sizeof(itInsert)); #endif //OPTIM //<==optimizer added [shadow2004] // START: changed by FoRcHa ///// WORD wWinVer = thePrefs.GetWindowsVersion(); if(wWinVer == _WINVER_2K_ || wWinVer == _WINVER_XP_ || wWinVer == _WINVER_ME_) { itInsert.item.mask = TVIF_CHILDREN | TVIF_HANDLE | TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; itInsert.item.stateMask = TVIS_BOLD | TVIS_STATEIMAGEMASK; } else { itInsert.item.mask = TVIF_CHILDREN | TVIF_HANDLE | TVIF_TEXT | TVIF_STATE; itInsert.item.stateMask = TVIS_BOLD; } // END: changed by FoRcHa /////// if (HasSharedSubdirectory(strDir)) itInsert.item.state = TVIS_BOLD; else itInsert.item.state = 0; if (HasSubdirectories(strDir)) itInsert.item.cChildren = I_CHILDRENCALLBACK; // used to display the + symbol next to each item else itInsert.item.cChildren = 0; itInsert.item.pszText = strText.GetBuffer(); itInsert.item.cchTextMax = strText.GetLength(); itInsert.hInsertAfter = hRoot ? TVI_SORT : TVI_LAST; itInsert.hParent = hRoot; // START: added by FoRcHa //////////////// if(wWinVer == _WINVER_2K_ || wWinVer == _WINVER_XP_ || wWinVer == _WINVER_ME_) { CString strTemp = strDir; if(strTemp.Right(1) != _T("\\")) strTemp += _T("\\"); UINT nType = GetDriveType(strTemp); if(DRIVE_REMOVABLE <= nType && nType <= DRIVE_RAMDISK) itInsert.item.iImage = nType; SHFILEINFO shFinfo; shFinfo.szDisplayName[0] = _T('\0'); if(!SHGetFileInfo(strTemp, 0, &shFinfo, sizeof(shFinfo), SHGFI_ICON | SHGFI_SMALLICON | SHGFI_DISPLAYNAME)) { TRACE(_T("Error Gettting SystemFileInfo!")); itInsert.itemex.iImage = 0; // :( } else { itInsert.itemex.iImage = shFinfo.iIcon; DestroyIcon(shFinfo.hIcon); if (hRoot == NULL && shFinfo.szDisplayName[0] != _T('\0')) { STreeItem* pti = new STreeItem; pti->strPath = strText; strText = shFinfo.szDisplayName; itInsert.item.pszText = strText.GetBuffer(); itInsert.item.cchTextMax = strText.GetLength(); itInsert.item.mask |= TVIF_PARAM; itInsert.item.lParam = (LPARAM)pti; } } if(!SHGetFileInfo(strTemp, 0, &shFinfo, sizeof(shFinfo), SHGFI_ICON | SHGFI_OPENICON | SHGFI_SMALLICON)) { TRACE(_T("Error Gettting SystemFileInfo!")); itInsert.itemex.iImage = 0; } else { itInsert.itemex.iSelectedImage = shFinfo.iIcon; DestroyIcon(shFinfo.hIcon); } } // END: added by FoRcHa ////////////// HTREEITEM hItem = InsertItem(&itInsert); if (IsShared(strDir)) SetCheck(hItem); strText.ReleaseBuffer(); return hItem; }
void RString::PrepForMod(void) { if(IsShared()) CloneString(); }
void StackElement::Release() { if (pool && !IsShared()) addToPool(); CInterface::Release(); }
void FolderTree::DisplayPath(const tstring &sPath, HTREEITEM hParent, bool bUseSetRedraw /* = true */) { //CWaitCursor c; //Speed up the job by turning off redraw if (bUseSetRedraw) SetRedraw(false); //Remove all the items currently under hParent HTREEITEM hChild = GetChildItem(hParent); while (hChild) { DeleteItem(hChild); hChild = GetChildItem(hParent); } //Should we display the root folder if (m_bShowRootedFolder && (hParent == TVI_ROOT)) { FolderTreeItemInfo* pItem = new FolderTreeItemInfo; pItem->m_sFQPath = m_sRootFolder; pItem->m_sRelativePath = m_sRootFolder; m_hRootedFolder = InsertFileItem(TVI_ROOT, pItem, false, GetIconIndex(m_sRootFolder), GetSelIconIndex(m_sRootFolder), true); Expand(m_hRootedFolder, TVE_EXPAND); return; } //find all the directories underneath sPath int nDirectories = 0; tstring sFile; if (sPath[sPath.size()-1] != _T('\\')) sFile = sPath + _T("\\"); else sFile = sPath; WIN32_FIND_DATA fData; HANDLE hFind; hFind = FindFirstFile((sFile + _T("*")).c_str(), &fData); if(hFind != INVALID_HANDLE_VALUE) { do { tstring filename = fData.cFileName; if((fData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (filename != _T(".")) && (filename != _T(".."))) { ++nDirectories; tstring path = sFile + filename; TCHAR szPath[_MAX_PATH]; TCHAR szFname[_MAX_FNAME]; TCHAR szExt[_MAX_EXT]; _tsplitpath(path.c_str(), NULL, NULL, szFname, szExt); _tmakepath(szPath, NULL, NULL, szFname, szExt); FolderTreeItemInfo* pItem = new FolderTreeItemInfo; pItem->m_sFQPath = path; pItem->m_sRelativePath = szPath; InsertFileItem(hParent, pItem, m_bShowSharedUsingDifferentIcon && IsShared(path), GetIconIndex(path), GetSelIconIndex(path), true); } } while (FindNextFile(hFind, &fData)); } FindClose(hFind); //Now sort the items we just added TVSORTCB tvsortcb; tvsortcb.hParent = hParent; tvsortcb.lpfnCompare = CompareByFilenameNoCase; tvsortcb.lParam = 0; SortChildrenCB(&tvsortcb); //We want to add them before sorting checkRemovedDirs(sFile, hParent); //If no items were added then remove the "+" indicator from hParent if(nDirectories == 0) SetHasPlusButton(hParent, FALSE); //Turn back on the redraw flag if(bUseSetRedraw) SetRedraw(true); }
void CVisProp::Assign( const CVisProp& refprop) { bool fSameTypes = (m_pproptypeinfo == refprop.m_pproptypeinfo); m_pproptypeinfo = refprop.m_pproptypeinfo; m_propkeydata = refprop.m_propkeydata; m_fPrint = refprop.m_fPrint; if (!refprop.IsValid()) { ReleaseObj(); } else if ((IsValid()) && (IsArray()) && (!IsShared()) && (refprop.IsArray()) && (!refprop.IsShared()) && (Dim() == refprop.Dim()) && (fSameTypes)) { // Special case: Just copy the array values (without reallocating). CopyArrayElements(refprop.PRefCntArray()->PvObjFirst()); } else { assert(m_pproptypeinfo != 0); if ((IsValid()) && (IsArray())) ReleaseObj(); if (refprop.IsArray()) { ReleaseObj(); SetFObjReference(refprop.IsObjReference()); if (refprop.IsShared()) { SetPvRefCntArray(refprop.PRefCntArray()); // Need to set m_fInitialized to true here so that we can // assert(IsValid()) in the call to PRefCntArray(). SetFInitialized(true); PropTypeInfo().AddRefPvRefCntArray(PRefCntArray()); } else { SetObjFromPv(refprop.PRefCntArray()->PvObjFirst(), false, refprop.Dim()); } } else if (refprop.IsObjReference()) { ReleaseObj(); SetFObjReference(true); if (refprop.IsShared()) { SetPvRefCntObj(refprop.PvRefCntObj()); // Need to set m_fInitialized to true here so that we can // assert(IsValid()) in the call to PvRefCntObj(). SetFInitialized(true); ((CVisRefCntObj<void *> *) PvRefCntObj())->AddRef(); } else { SetFPointerToObject(false); *((void * *) (void *) &m_llData) = refprop.PvObj(); } } else { m_fObjReference = false; if (!refprop.FPointerToObject()) { ReleaseObj(); SetFPointerToObject(false); // m_pproptypeinfo->AssignObjToObj(refprop.PvObj(), PvObj()); m_pproptypeinfo->AssignObjToObj(refprop.PvObj(), (void *) &m_llData); } else if (!refprop.IsShared()) { if (!IsValid()) { SetPvRefCntObj(m_pproptypeinfo->ClonePvRefCntObj(refprop.PvRefCntObj())); } else { assert(FPointerToObject()); m_pproptypeinfo->AssignObjToObj(refprop.PvObj(), PvObj()); } } else { SetPvRefCntObj(refprop.PvRefCntObj()); // Need to set m_fInitialized to true here so that we can // assert(IsValid()) in the call to PvRefCntObj(). SetFInitialized(true); m_pproptypeinfo->AddRefPvRefCntObj(PvRefCntObj()); } } SetFShared(refprop.IsShared()); SetFInitialized(true); } }
void CDirectoryTreeCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point) { CPoint ptMenu(-1, -1); if (point.x != -1 && point.y != -1) { ptMenu = point; ScreenToClient(&point); } else { HTREEITEM hSel = GetNextItem(TVI_ROOT, TVGN_CARET); if (hSel) { CRect rcItem; if (GetItemRect(hSel, &rcItem, TRUE)) { ptMenu.x = rcItem.left; ptMenu.y = rcItem.top; ClientToScreen(&ptMenu); } } else ClientToScreen(&(ptMenu = (0, 0))); } HTREEITEM hItem = HitTest(point); // create the menu CTitleMenu SharedMenu; SharedMenu.CreatePopupMenu(); SharedMenu.AddMenuTitle(GetResString(IDS_SHAREDFOLDERS)); bool bMenuIsEmpty = true; // add all shared directories int iCnt = 0; for (POSITION pos = m_lstShared.GetHeadPosition(); pos != NULL; iCnt++) { CString strDisplayPath(m_lstShared.GetNext(pos)); PathRemoveBackslash(strDisplayPath.GetBuffer(strDisplayPath.GetLength())); strDisplayPath.ReleaseBuffer(); SharedMenu.AppendMenu(MF_STRING,MP_SHAREDFOLDERS_FIRST+iCnt, GetResString(IDS_VIEW1) + strDisplayPath); bMenuIsEmpty = false; } // add right clicked folder, if any if (hItem) { m_strLastRightClicked = GetFullPath(hItem); if (!IsShared(m_strLastRightClicked)) { CString strDisplayPath(m_strLastRightClicked); PathRemoveBackslash(strDisplayPath.GetBuffer(strDisplayPath.GetLength())); strDisplayPath.ReleaseBuffer(); if (!bMenuIsEmpty) SharedMenu.AppendMenu(MF_SEPARATOR); SharedMenu.AppendMenu(MF_STRING, MP_SHAREDFOLDERS_FIRST-1, GetResString(IDS_VIEW1) + strDisplayPath + GetResString(IDS_VIEW2)); bMenuIsEmpty = false; } } // display menu if (!bMenuIsEmpty) SharedMenu.TrackPopupMenu(TPM_LEFTALIGN |TPM_RIGHTBUTTON, ptMenu.x, ptMenu.y, this); VERIFY( SharedMenu.DestroyMenu() ); }
void Layer<Dtype>::Unlock() { if (IsShared()) { forward_mutex_->unlock(); } }