void WTHRRecord::WTHRSNAM::IsDefault(bool value) { if(value) type = eDefault; else if(IsDefault()) type = ePrecip; }
const entry_ref* DecorInfo::Ref() const { if (InitCheck() != B_OK || IsDefault()) return NULL; return &fRef; }
void wxNativeFontInfo::SetXFontComponent(wxXLFDField field, const wxString& value) { wxCHECK_RET( field < wxXLFD_MAX, _T("invalid XLFD field") ); // this class should be initialized with a valid font spec first and only // then the fields may be modified! wxASSERT_MSG( !IsDefault(), _T("can't modify an uninitialized XLFD") ); if ( !HasElements() ) { // const_cast if ( !((wxNativeFontInfo *)this)->FromXFontName(xFontName) ) { wxFAIL_MSG( _T("can't set font element for invalid XLFD") ); return; } } fontElements[field] = value; // invalidate the XFLD, it doesn't correspond to the font elements any more xFontName.clear(); }
BSize BButton::_ValidatePreferredSize() { if (fPreferredSize.width < 0) { BControlLook::background_type backgroundType = fBehavior == B_POP_UP_BEHAVIOR ? BControlLook::B_BUTTON_WITH_POP_UP_BACKGROUND : BControlLook::B_BUTTON_BACKGROUND; float left, top, right, bottom; be_control_look->GetInsets(BControlLook::B_BUTTON_FRAME, backgroundType, IsDefault() ? BControlLook::B_DEFAULT_BUTTON : 0, left, top, right, bottom); // width float width = left + right + 2 * kLabelMargin - 1; const char* label = Label(); if (label != NULL) { width = std::max(width, 20.0f); width += (float)ceil(StringWidth(label)); } const BBitmap* icon = IconBitmap(B_INACTIVE_ICON_BITMAP); if (icon != NULL) width += icon->Bounds().Width() + 1; if (label != NULL && icon != NULL) width += be_control_look->DefaultLabelSpacing(); // height float minHorizontalMargins = top + bottom + 2 * kLabelMargin; float height = -1; if (label != NULL) { font_height fontHeight; GetFontHeight(&fontHeight); float textHeight = fontHeight.ascent + fontHeight.descent; height = ceilf(textHeight * 1.8); float margins = height - ceilf(textHeight); if (margins < minHorizontalMargins) height += minHorizontalMargins - margins; } if (icon != NULL) { height = std::max(height, icon->Bounds().Height() + minHorizontalMargins); } // force some minimum width/height values width = std::max(width, label != NULL ? 75.0f : 5.0f); height = std::max(height, 5.0f); fPreferredSize.Set(width, height); ResetLayoutInvalidation(); } return fPreferredSize; }
//------------------------------------------------------------------------ // set the value of an attribute bool CPlayerProfile::SetAttribute(const char* name, const TFlowInputData& value) { if (IsDefault()) return false; ScopedSwitchToGlobalHeap globalHeap; m_attributeMap[name] = value; return true; }
const T Get(const std::string &name) const { if (IsDefault(name)) { std::shared_ptr<TContainer> c; if (ParentDefault(c, name)) if (c && c->GetParent()) return c->GetParent()->Prop->Get<T>(name); } return TValueMap::Get<T>(name); }
void CPPageAdvanced::OnUpdateDefaultButton(CCmdUI* pCmdUI) { int iItem = m_list.GetSelectionMark(); bool bEnable = false; if (iItem >= 0) { auto eSetting = static_cast<ADVANCED_SETTINGS>(m_list.GetItemData(iItem)); bEnable = !IsDefault(eSetting); } pCmdUI->Enable(bEnable); }
void BButton::AttachedToWindow() { BControl::AttachedToWindow(); // low color will now be the parents view color if (IsDefault()) Window()->SetDefaultButton(this); SetViewColor(B_TRANSPARENT_COLOR); }
status_t BButton::Archive(BMessage* archive, bool deep) const { status_t err = BControl::Archive(archive, deep); if (err != B_OK) return err; if (IsDefault()) err = archive->AddBool("_default", true); return err; }
/* ======================== idSoundSample_XAudio2::GetAmplitude ======================== */ float idSoundSample_XAudio2::GetAmplitude( int timeMS ) const { if ( timeMS < 0 || timeMS > LengthInMsec() ) { return 0.0f; } if ( IsDefault() ) { return 1.0f; } int index = timeMS * 60 / 1000; if ( index < 0 || index >= amplitude.Num() ) { return 0.0f; } return (float)amplitude[index] / 255.0f; }
//------------------------------------------------------------------------ // re-set attribute to default value (basically removes it from this profile) bool CPlayerProfile::ResetAttribute(const char* name) { if (IsDefault()) return false; const TAttributeMap& defaultMap = GetDefaultAttributeMap(); // resetting means deleting from this profile and using the default value // but: if no entry in default map, keep it if (defaultMap.find(CONST_TEMP_STRING(name)) != defaultMap.end()) { TAttributeMap::size_type count = m_attributeMap.erase(name); return count > 0; } return false; }
void T3DControl_Button::MouseArrowClickImpl(TMouseClickInfo info) { if (info.clicktype==TMouseClickInfo::LeftDown) { double cpx=info.posit.G3_x(); double cpy=info.posit.G3_y(); if ((cpx>=G_controlposx())&&(cpx<=G_controlposx()+G_controlsizex())&& (cpy>=G_controlposy())&&(cpy<=G_controlposy()+G_controlsizey())) { Set_wasmodified(); } } if ((IsDefault())&&(info.clicktype==TMouseClickInfo::LeftDouble)) Set_wasmodified(); }
BRect BButton::_PopUpRect() const { if (fBehavior != B_POP_UP_BEHAVIOR) return BRect(); float left, top, right, bottom; be_control_look->GetInsets(BControlLook::B_BUTTON_FRAME, BControlLook::B_BUTTON_WITH_POP_UP_BACKGROUND, IsDefault() ? BControlLook::B_DEFAULT_BUTTON : 0, left, top, right, bottom); BRect rect(Bounds()); rect.left = rect.right - right + 1; return rect; }
CAdvancedSettingsPage::EditItem::EditItem(const CSettings::Item* pItem) : m_pItem( const_cast<CSettings::Item*>( pItem ) ), m_nValue( pItem->m_pDword ? *pItem->m_pDword : 0 ), m_bValue( pItem->m_pBool ? *pItem->m_pBool : false ), m_sValue( pItem->m_pString ? *pItem->m_pString : CString() ), m_nOriginalValue( pItem->m_pDword ? *pItem->m_pDword : 0 ), m_bOriginalValue( pItem->m_pBool ? *pItem->m_pBool : false ), m_sOriginalValue( pItem->m_pString ? *pItem->m_pString : CString() ), m_sName( ( ! *pItem->m_szSection || // Settings.Name -> General.Name ! lstrcmpi( pItem->m_szSection, L"Settings" ) ) // .Name -> General.Name ? L"General" : pItem->m_szSection ) { m_sName += L"."; m_sName += pItem->m_szName; if ( ! IsDefault() ) m_sName += L"*"; }
void JLSOutputStream::AddScan(const void* pbyteComp, const JlsParamaters* pparams) { if (pparams->jfif.Ver) { _segments.push_back(CreateJFIF(&pparams->jfif)); } if (!IsDefault(&pparams->custom)) { _segments.push_back(CreateLSE(&pparams->custom)); } _icompLast += 1; _segments.push_back(EncodeStartOfScan(pparams,pparams->ilv == ILV_NONE ? _icompLast : -1)); Size size = Size(pparams->width, pparams->height); int ccomp = pparams->ilv == ILV_NONE ? 1 : pparams->components; _segments.push_back(new JpegImageDataSegment(pbyteComp, *pparams, _icompLast, ccomp)); }
//------------------------------------------------------------------------ // get the value of an attribute. if not specified optionally lookup in default profile bool CPlayerProfile::GetAttribute(const char* name, TFlowInputData& val, bool bUseDefaultFallback) const { TAttributeMap::const_iterator iter = m_attributeMap.find(CONST_TEMP_STRING(name)); if (iter != m_attributeMap.end()) { val = iter->second; return true; } if (bUseDefaultFallback && !IsDefault()) { const TAttributeMap& defaultMap = GetDefaultAttributeMap(); TAttributeMap::const_iterator iter2 = defaultMap.find(CONST_TEMP_STRING(name)); if (iter2 != defaultMap.end()) { val = iter2->second; return true; } } return false; }
void CPPageAdvanced::OnNMCustomdraw(NMHDR* pNMHDR, LRESULT* pResult) { LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR); switch (pNMCD->dwDrawStage) { case CDDS_PREPAINT: *pResult = CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTPAINT; break; case CDDS_ITEMPREPAINT: { auto eSetting = static_cast<ADVANCED_SETTINGS>(m_list.GetItemData((int)pNMCD->dwItemSpec)); if (!IsDefault(eSetting)) { ::SelectObject(pNMCD->hdc, m_fontBold.GetSafeHandle()); *pResult |= CDRF_NEWFONT; } else { *pResult = CDRF_DODEFAULT; } } break; default: *pResult = CDRF_DODEFAULT; } }
int wxWindow::GetStateFlags() const { int flags = 0; if ( !IsEnabled() ) flags |= wxCONTROL_DISABLED; // the following states are only possible if our application is active - if // it is not, even our default/focused controls shouldn't appear as such if ( wxTheApp->IsActive() ) { if ( IsCurrent() ) flags |= wxCONTROL_CURRENT; if ( IsFocused() ) flags |= wxCONTROL_FOCUSED; if ( IsPressed() ) flags |= wxCONTROL_PRESSED; if ( IsDefault() ) flags |= wxCONTROL_ISDEFAULT; } return flags; }
void JLSOutputStream::AddScan(const void* compareData, const JlsParameters* pparams) { if (pparams->jfif.Ver) { _segments.push_back(CreateJFIF(&pparams->jfif)); } if (!IsDefault(&pparams->custom)) { _segments.push_back(CreateLSE(&pparams->custom)); } else if (pparams->bitspersample > 12) { JlsCustomParameters preset = ComputeDefault((1 << pparams->bitspersample) - 1, pparams->allowedlossyerror); _segments.push_back(CreateLSE(&preset)); } _icompLast += 1; _segments.push_back(EncodeStartOfScan(pparams,pparams->ilv == ILV_NONE ? _icompLast : -1)); Size size = Size(pparams->width, pparams->height); int ccomp = pparams->ilv == ILV_NONE ? 1 : pparams->components; _segments.push_back(new JpegImageDataSegment(compareData, *pparams, _icompLast, ccomp)); }
//------------------------------------------------------------------------ bool CPlayerProfile::Reset() { if (IsDefault()) return false; // for now, try to get the action map from the IActionMapManager IActionMapManager* pAM = CCryAction::GetCryAction()->GetIActionMapManager(); pAM->Reset(); // well, not very efficient at the moment... TAttributeMap::iterator iter = m_attributeMap.begin(); while (iter != m_attributeMap.end()) { TAttributeMap::iterator next = iter; ++next; ResetAttribute(iter->first); iter = next; } LoadGamerProfileDefaults(); gEnv->pSystem->AutoDetectSpec(false); return true; }
//-- bool DataProperty::Satisfy(OpenBabel::OBAtom* pAtom, const std::string& refTo, std::vector<Class*>& vecSatisfiedClasses, std::string& refValue) { //bool bSatisfied = false; int iPosition = -1; // [rad] if we are default, we automatically satisfy if(!IsDefault()) { if(!SatisfyCommon(vecSatisfiedClasses, iPosition)) { // [rad] this property does not apply refValue = ""; return(false); } } // [rad] go through possible data types.. if(!refTo.compare("ATOM_ATOMIC_NUMBER")) { ConvertInt(pAtom->GetAtomicNum(), refValue); } else if(!refTo.compare("ATOM_FORMAL_CHARGE")) { ConvertInt(pAtom->GetFormalCharge(), refValue); } else if(!refTo.compare("ATOM_ISOTOPE")) { ConvertInt(pAtom->GetIsotope(), refValue); } else if(!refTo.compare("ATOM_SPIN_MULTIPLICITY")) { ConvertInt(pAtom->GetSpinMultiplicity(), refValue); } else if(!refTo.compare("ATOM_ATOMIC_MASS")) { ConvertDouble(pAtom->GetAtomicMass(), refValue); } else if(!refTo.compare("ATOM_EXACT_MASS")) { ConvertDouble(pAtom->GetExactMass(), refValue); } else if(!refTo.compare("ATOM_INTERNAL_INDEX")) { ConvertInt(pAtom->GetIdx(), refValue); } else if(!refTo.compare("ATOM_VALENCE")) { ConvertInt(pAtom->GetValence(), refValue); } else if(!refTo.compare("ATOM_HYBRIDIZATION")) { ConvertInt(pAtom->GetHyb(), refValue); } else if(!refTo.compare("ATOM_IMPLICIT_VALENCE")) { ConvertInt(pAtom->GetImplicitValence(), refValue); } else if(!refTo.compare("ATOM_HEAVY_VALENCE")) { ConvertInt(pAtom->GetHvyValence(), refValue); } else if(!refTo.compare("ATOM_HETERO_VALENCE")) { ConvertInt(pAtom->GetHeteroValence(), refValue); } else if(!refTo.compare("ATOM_COORDINATE_X")) { ConvertDouble(pAtom->GetX(), refValue); } else if(!refTo.compare("ATOM_COORDINATE_Y")) { ConvertDouble(pAtom->GetY(), refValue); } else if(!refTo.compare("ATOM_COORDINATE_Z")) { ConvertDouble(pAtom->GetZ(), refValue); } else if(!refTo.compare("ATOM_PARTIAL_CHARGE")) { ConvertDouble(pAtom->GetPartialCharge(), refValue); } else if(!refTo.compare("ATOM_FREE_OXYGEN_COUNT")) { ConvertInt(pAtom->CountFreeOxygens(), refValue); } else if(!refTo.compare("ATOM_IMPLICIT_HYDROGEN_COUNT")) { ConvertInt(pAtom->ImplicitHydrogenCount(), refValue); } else if(!refTo.compare("ATOM_PARTICIPANT_RING_COUNT")) { ConvertInt(pAtom->MemberOfRingCount(), refValue); } else if(!refTo.compare("ATOM_AVERAGE_BOND_ANGLE")) { ConvertDouble(pAtom->AverageBondAngle(), refValue); } else if(!refTo.compare("ATOM_SMALLEST_BOND_ANGLE")) { ConvertDouble(pAtom->SmallestBondAngle(), refValue); } else if(!refTo.compare("ATOM_IS_IN_RING")) { ConvertBool(pAtom->IsInRing(), refValue); } else if(!refTo.compare("ATOM_IS_HETERO_ATOM")) { ConvertBool(pAtom->IsHeteroatom(), refValue); } else if(!refTo.compare("ATOM_IS_AROMATIC")) { ConvertBool(pAtom->IsAromatic(), refValue); } else if(!refTo.compare("ATOM_IS_CHIRAL")) { ConvertBool(pAtom->IsChiral(), refValue); } else if(!refTo.compare("ATOM_HAS_SINGLE_BOND")) { ConvertBool(pAtom->HasSingleBond(), refValue); } else if(!refTo.compare("ATOM_HAS_DOUBLE_BOND")) { ConvertBool(pAtom->HasDoubleBond(), refValue); } else if(!refTo.compare("ATOM_HAS_TRIPLE_BOND")) { ConvertBool(pAtom->HasBondOfOrder(3), refValue); } else if(!refTo.compare("ATOM_HAS_AROMATIC_BOND")) { ConvertBool(pAtom->HasAromaticBond(), refValue); } else if(!refTo.compare("ATOM_SINGLE_BOND_COUNT")) { ConvertInt(pAtom->CountBondsOfOrder(1), refValue); } else if(!refTo.compare("ATOM_DOUBLE_BOND_COUNT")) { ConvertInt(pAtom->CountBondsOfOrder(2), refValue); } else if(!refTo.compare("ATOM_TRIPLE_BOND_COUNT")) { ConvertInt(pAtom->CountBondsOfOrder(3), refValue); } else if(!refTo.compare("ATOM_AROMATIC_BOND_COUNT")) { ConvertInt(pAtom->CountBondsOfOrder(5), refValue); } else if(!refTo.compare("ATOM_BOND_COUNT")) { //return(ConvertInt(pAtom->CountBondsOfOrder(5))); OpenBabel::OBBond* pBond; std::vector<OpenBabel::OBEdgeBase*>::iterator iter_bond; int iCount = 0; for(pBond = pAtom->BeginBond(iter_bond); pBond; pBond = pAtom->NextBond(iter_bond)) { iCount++; } ConvertInt(iCount, refValue); } else { // [rad] unknown datatype? refValue = ""; return(false); } return(true); }
//============================================================================= void CXButtonXP::DrawItem(LPDRAWITEMSTRUCT lpDIS) //============================================================================= { CDC *pDC = CDC::FromHandle(lpDIS->hDC); CRect rectItem = lpDIS->rcItem; // set up for double buffering CDC memDC; memDC.CreateCompatibleDC(pDC); CBitmap bmp; bmp.CreateCompatibleBitmap(pDC, rectItem.Width(), rectItem.Height()); CBitmap *pOldBitmap = memDC.SelectObject(&bmp); // initialize dc from existing dc memDC.BitBlt(0, 0, rectItem.Width(), rectItem.Height(), pDC, 0, 0, SRCCOPY); memDC.SetBkMode(TRANSPARENT); if (m_bFirstTime) { // open theme for Button m_bFirstTime = FALSE; if (ThemeHelper.IsThemeLibAvailable()) { if (m_hTheme) ThemeHelper.CloseThemeData(m_hTheme); m_hTheme = NULL; if (m_bDrawToolbar) { m_hTheme = ThemeHelper.OpenThemeData(m_hWnd, _T("Toolbar")); } else { m_hTheme = ThemeHelper.OpenThemeData(m_hWnd, _T("Button")); } } SaveParentBackground(); } CFont *pFont = GetParent()->GetFont(); if (pFont) memDC.SelectObject(pFont); // button state // get the button's title CString strTitle = _T(""); GetWindowText(strTitle); BOOL bHasText = !strTitle.IsEmpty(); BOOL bIsFocused = lpDIS->itemState & ODS_FOCUS; BOOL bIsDisabled = lpDIS->itemState & ODS_DISABLED; BOOL bDrawFocusRect = !(lpDIS->itemState & ODS_NOFOCUSRECT); BOOL bIsPressed = lpDIS->itemState & ODS_SELECTED; BOOL bIsDefault = IsDefault(); BOOL bIsThemed = IsThemed(); BOOL bCustomColors = (m_crBackground != XBUTTONXP_NO_COLOR) || (m_crText != XBUTTONXP_NO_COLOR); if (bCustomColors) { bIsThemed = FALSE; } if (m_bIsToggle) { if (m_bLButtonDown && !m_bMouseOverButton) { // left mouse button is down outside button bIsPressed = !m_bToggled; } else { bIsPressed = m_bToggled; } } if (m_bDrawToolbar) { // restore parent window bits memDC.BitBlt(0, 0, m_rectButton.Width(), m_rectButton.Height(), &m_dcParent, 0, 0, SRCCOPY); bIsFocused = FALSE; bIsDefault = FALSE; } if (bIsThemed) { DWORD state = bIsPressed ? PBS_PRESSED : PBS_NORMAL; if (bIsDisabled) { state = PBS_DISABLED; } else if (state == PBS_NORMAL) { if (bIsFocused || bIsDefault) { state = PBS_DEFAULTED; } if (m_bMouseOverButton) state = PBS_HOT; } ThemeHelper.DrawThemeParentBackground(m_hWnd, memDC.m_hDC, &rectItem); ThemeHelper.DrawThemeBackground(m_hTheme, memDC.m_hDC, BP_PUSHBUTTON, state, &rectItem, NULL); } else // not themed { CBrush brBackground; if (m_crBackground == XBUTTONXP_NO_COLOR) brBackground.CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); else brBackground.CreateSolidBrush(m_crBackground); if (!m_bDrawToolbar || bCustomColors) { // fill in background, if custom color or not toolbar CRect rectClient(rectItem); InflateRect(&rectClient, -1, -1); memDC.FillRect(&rectClient, &brBackground); } if (bIsFocused || bIsDefault) { if (!m_bIsToggle || !bIsPressed) { CBrush brush(RGB(0,0,0)); memDC.FrameRect(&rectItem, &brush); } InflateRect(&rectItem, -1, -1); } // draw the traditional pushbutton edge if (bIsPressed) { memDC.DrawEdge(&rectItem, EDGE_SUNKEN, BF_RECT); } else if (!m_bDrawToolbar) { memDC.DrawEdge(&rectItem, EDGE_RAISED, BF_RECT); } } CRect rectDraw = lpDIS->rcItem; // draw the icon DrawIcon(&memDC, bHasText, rectItem, rectDraw, bIsPressed, bIsThemed, bIsDisabled); // draw the button title (if any) if (bHasText) { DrawText(&memDC, strTitle, rectDraw, bIsPressed, bIsThemed, bIsDisabled); } // draw the focus rect if (bIsFocused && bDrawFocusRect) { CRect rectFocus = rectItem; if (m_pDropDownMenu) rectFocus.right = rectFocus.right - MENUBTN_WIDTH + 1; if (!bIsThemed && bIsPressed) rectFocus.OffsetRect(1, 1); rectFocus.InflateRect(-3, -3); memDC.DrawFocusRect(&rectFocus); } if (m_pDropDownMenu) { DrawSplit(&memDC, rectItem, bIsPressed, bIsThemed, bIsDisabled); DrawArrow(&memDC, rectItem, bIsPressed, bIsThemed, bIsDisabled); } // end double buffering pDC->BitBlt(0, 0, rectItem.Width(), rectItem.Height(), &memDC, 0, 0, SRCCOPY); // swap back the original bitmap if (pOldBitmap) memDC.SelectObject(pOldBitmap); if (bmp.GetSafeHandle()) bmp.DeleteObject(); memDC.DeleteDC(); }
//------------------------------------------------------------------------ bool CPlayerProfile::SaveAttributes(const XmlNodeRef& root) { if (m_attributesVersion > 0) root->setAttr(VERSION_TAG, m_attributesVersion); const TAttributeMap& defaultMap = GetDefaultAttributeMap(); TAttributeMap::iterator iter = m_attributeMap.begin(); while (iter != m_attributeMap.end()) { string val; iter->second.GetValueWithConversion(val); bool bSaveIt = true; TAttributeMap::const_iterator defaultIter = defaultMap.find(iter->first); if (defaultIter != defaultMap.end()) { string defaultVal; defaultIter->second.GetValueWithConversion(defaultVal); // check if value is different from default bSaveIt = val != defaultVal; } if(m_pManager->IsOnlineOnlyAttribute(iter->first)) { bSaveIt = false; } if (bSaveIt) { // TODO: config. variant saving XmlNodeRef child = root->newChild("Attr"); child->setAttr("name", iter->first); child->setAttr("value", val); } ++iter; } if(m_pManager->HasEnabledOnlineAttributes() && m_pManager->CanProcessOnlineAttributes() && !IsDefault()) { m_pManager->SaveOnlineAttributes(this); } return true; }
//-- bool DataProperty::Satisfy(OpenBabel::OBRing* pRing, const std::string& refTo, std::vector<Class*>& vecSatisfiedClasses, std::string& refValue) { //bool bSatisfied = false; int iPosition = -1; // [rad] if we are default, we automatically satisfy if(!IsDefault()) { if(!SatisfyCommon(vecSatisfiedClasses, iPosition)) { // [rad] this property does not apply refValue = ""; return(false); } } // [rad] go through possible data types.. if(!refTo.compare("RING_SIZE")) { ConvertInt(pRing->Size(), refValue); } else if(!refTo.compare("RING_IS_AROMATIC")) { ConvertBool(pRing->IsAromatic(), refValue); } else if(!refTo.compare("RING_IS_HOMOCYCLIC")) { OpenBabel::OBMol* pMolecule = pRing->GetParent(); OpenBabel::OBAtom* pAtom; bool bHomoCyclic = true; std::vector<int>::iterator iter_path = pRing->_path.begin(); while(iter_path != pRing->_path.end()) { pAtom = pMolecule->GetAtom((*iter_path)); if(pAtom) { if(6 != pAtom->GetAtomicNum()) { bHomoCyclic = false; break; } } iter_path++; } ConvertBool(bHomoCyclic, refValue); } else if(!refTo.compare("RING_IS_HETEROCYCLIC")) { OpenBabel::OBMol* pMolecule = pRing->GetParent(); OpenBabel::OBAtom* pAtom; bool bHeteroCyclic = false; std::vector<int>::iterator iter_path = pRing->_path.begin(); while(iter_path != pRing->_path.end()) { pAtom = pMolecule->GetAtom((*iter_path)); if(pAtom) { if(6 != pAtom->GetAtomicNum()) { bHeteroCyclic = true; break; } } iter_path++; } ConvertBool(bHeteroCyclic, refValue); } else { // [rad] unknown datatype? refValue = ""; return(false); } return(true); }
void ClsFlatButton::PaintControl( ClsDC *pDC ) { // Get the client rectangle. ClsRect rc = GetClientRect(); // Any room to render in? if ( ! rc.IsEmpty()) { // Create an off-screen buffer. ClsBufferDC dc( *pDC, rc ); // Snapshot the DC. int sDC = dc.SaveDC(); // Render the frame. if ( ! m_bXPStyle ) RenderFrame( &dc, rc ); else { // Only when were hot or down. COLORREF crFg, crBg; if (( IsHot() || IsDown()) && IsWindowEnabled()) { crFg = XPColors.GetXPColor( ClsXPColors::XPC_OUTER_SELECTION ); crBg = XPColors.GetXPColor( IsDown() ? ClsXPColors::XPC_INNER_CHECKED_SELECTED : ClsXPColors::XPC_INNER_SELECTION ); } else { // Default colors... crFg = ( IsDefault() && IsWindowEnabled() && ! m_bXPDefault ) ? XPColors.GetXPColor( ClsXPColors::XPC_OUTER_SELECTION ) : XPColors.GetXPColor( ClsXPColors::XPC_IMAGE_DISABLED ); crBg = ::GetSysColor( COLOR_BTNFACE ); } // Render rectangle. dc.OutlinedRectangle( rc, crFg, crBg ); } // Determine rendering flags. DWORD dwFlags = 0; if ( ! IsWindowEnabled()) dwFlags |= ClsDrawTools::CDSF_DISABLED; if ( IsDown() && ! ThemingAPI.IsThemingEnabled()) dwFlags |= ClsDrawTools::CDSF_DOWNPRESSED; if ( GetUIState() & UISF_HIDEACCEL ) dwFlags |= ClsDrawTools::CDSF_HIDEACCEL; if ( IsHot()) dwFlags |= ClsDrawTools::CDSF_HOT; // Do we have any images? if ( m_hImages ) { // Copy the client rectangle. ClsRect rcimg( rc ); // We need to know the size of the images // in the image list. int cx, cy; ::ImageList_GetIconSize( m_hImages, &cx, &cy ); // Determine the place at which we render the images. rcimg.Offset( ::GetSystemMetrics( SM_CXFRAME ), 0 ); rcimg.Right() = rcimg.Left() + cx; // Adjust label rectangle. rc.Left() += cx + 4; // Render the image. if ( ! m_bXPStyle ) ClsDrawTools::RenderBitmap( dc, m_hImages, ( IsHot() || IsDown()) ? m_aImageIndex[ FIIF_HOT ] : m_aImageIndex[ FIIF_NORMAL ], rcimg, dwFlags ); else ClsDrawTools::RenderXPBitmap( dc, m_hImages, ( IsHot() || IsDown()) ? m_aImageIndex[ FIIF_HOT ] : m_aImageIndex[ FIIF_NORMAL ], rcimg, dwFlags ); } // Render the caption. ClsString str( m_hWnd ); // Anything to render? if ( str.GetStringLength()) { // Deflate the label rectangle. rc.Deflate( 3, 3 ); // Do we have the focus? if ( HasFocus() && ! ( GetUIState() & UISF_HIDEFOCUS ) && ! m_bPanelHeader ) dc.DrawFocusRect( rc ); // Setup the font to use. ClsFont font; GetFont( font ); ClsSelector sel( &dc, font ); // Render transparently. dc.SetBkMode( TRANSPARENT ); // We must not use the disabled flag if we are // rendering XP style... if ( m_bXPStyle ) dwFlags &= ~( ClsDrawTools::CDSF_DISABLED | ClsDrawTools::CDSF_DOWNPRESSED ); // Set text color. COLORREF cr = GetSysColor( IsWindowEnabled() ? COLOR_BTNTEXT : COLOR_GRAYTEXT ); if ( IsDown() && m_bXPStyle ) cr = XPColors.GetXPColor( ClsXPColors::XPC_TEXT_BACKGROUND ); if ( IsHot() || IsDown()) cr = m_crHotLabelColor == CLR_NONE ? cr : m_crHotLabelColor; else cr = m_crLabelColor == CLR_NONE ? cr : m_crLabelColor; dc.SetTextColor( cr ); // Render the caption. ClsDrawTools::RenderText( dc, str, rc, dwFlags ); } // Restore device context. dc.RestoreDC( sDC ); } }
//-- bool DataProperty::Satisfy(OpenBabel::OBMol* pMolecule, const std::string& refTo, std::vector<Class*>& vecSatisfiedClasses, std::string& refValue) { //bool bSatisfied = false; int iPosition = -1; // [rad] if we are default, we automatically satisfy if(!IsDefault()) { if(!SatisfyCommon(vecSatisfiedClasses, iPosition)) { // [rad] this property does not apply refValue = ""; return(false); } } // [rad] go through possible data types.. if(!refTo.compare("MOLECULE_ATOM_COUNT")) { ConvertInt(pMolecule->NumAtoms(), refValue); } else if(!refTo.compare("MOLECULE_BOND_COUNT")) { ConvertInt(pMolecule->NumBonds(), refValue); } else if(!refTo.compare("MOLECULE_RING_COUNT")) { std::vector<OpenBabel::OBRing*>& refSSSR = pMolecule->GetSSSR(); ConvertInt(refSSSR.size(), refValue); } else if(!refTo.compare("MOLECULE_HEAVY_HYDROGEN_COUNT")) { ConvertInt(pMolecule->NumHvyAtoms(), refValue); } else if(!refTo.compare("MOLECULE_RESIDUE_COUNT")) { ConvertInt(pMolecule->NumResidues(), refValue); } else if(!refTo.compare("MOLECULE_ROTOR_COUNT")) { ConvertInt(pMolecule->NumRotors(), refValue); } else if(!refTo.compare("MOLECULE_FORMULA")) { refValue = pMolecule->GetFormula(); } else if(!refTo.compare("MOLECULE_FORMATION_HEAT")) { ConvertDouble(pMolecule->GetEnergy(), refValue); } else if(!refTo.compare("MOLECULE_STANDARD_MOLAR_MASS")) { ConvertDouble(pMolecule->GetMolWt(), refValue); } else if(!refTo.compare("MOLECULE_EXACT_MASS")) { ConvertDouble(pMolecule->GetExactMass(), refValue); } else if(!refTo.compare("MOLECULE_TOTAL_CHARGE")) { ConvertInt(pMolecule->GetTotalCharge(), refValue); } else if(!refTo.compare("MOLECULE_SPIN_MULTIPLICITY")) { ConvertInt(pMolecule->GetTotalSpinMultiplicity(), refValue); } else if(!refTo.compare("MOLECULE_IS_CHIRAL")) { ConvertBool(pMolecule->IsChiral(), refValue); } else if(!refTo.compare("MOLECULE_HAS_AROMATIC_RING")) { std::vector<OpenBabel::OBRing*>& refSSSR = pMolecule->GetSSSR(); bool bAromatic = false; std::vector<OpenBabel::OBRing*>::iterator iter_rings = refSSSR.begin(); while(iter_rings != refSSSR.end()) { if((*iter_rings)->IsAromatic()) { bAromatic = true; break; } iter_rings++; } ConvertBool(bAromatic, refValue); } else if(!refTo.compare("MOLECULE_HAS_HOMOCYCLIC_RING")) { std::vector<OpenBabel::OBRing*>& refSSSR = pMolecule->GetSSSR(); std::vector<OpenBabel::OBRing*>::iterator iter_rings = refSSSR.begin(); OpenBabel::OBAtom* pAtom; bool bHomoCyclic = true; while(iter_rings != refSSSR.end()) { std::vector<int>::iterator iter_path = (*iter_rings)->_path.begin(); while(iter_path != (*iter_rings)->_path.end()) { pAtom = pMolecule->GetAtom((*iter_path)); if(pAtom) { if(6 != pAtom->GetAtomicNum()) { bHomoCyclic = false; break; } } iter_path++; } if(!bHomoCyclic) break; iter_rings++; } ConvertBool(bHomoCyclic, refValue); } else if(!refTo.compare("MOLECULE_HAS_HETEROCYCLIC_RING")) { std::vector<OpenBabel::OBRing*>& refSSSR = pMolecule->GetSSSR(); std::vector<OpenBabel::OBRing*>::iterator iter_rings = refSSSR.begin(); OpenBabel::OBAtom* pAtom; bool bHeteroCyclic = false; while(iter_rings != refSSSR.end()) { std::vector<int>::iterator iter_path = (*iter_rings)->_path.begin(); while(iter_path != (*iter_rings)->_path.end()) { pAtom = pMolecule->GetAtom((*iter_path)); if(pAtom) { if(6 != pAtom->GetAtomicNum()) { bHeteroCyclic = true; break; } } iter_path++; } if(bHeteroCyclic) break; iter_rings++; } ConvertBool(bHeteroCyclic, refValue); } else { // [rad] maybe it's a descriptor? if(SatisfyDescriptor(pMolecule, refTo, refValue)) { return(true); } // [rad] unknown datatype? refValue = ""; return(false); } return(true); }
void BButton::Draw(BRect updateRect) { if (be_control_look != NULL) { BRect rect(Bounds()); rgb_color background = LowColor(); rgb_color base = background; uint32 flags = be_control_look->Flags(this); if (IsDefault()) flags |= BControlLook::B_DEFAULT_BUTTON; be_control_look->DrawButtonFrame(this, rect, updateRect, base, background, flags); be_control_look->DrawButtonBackground(this, rect, updateRect, base, flags); // always leave some room around the label rect.InsetBy(3.0, 3.0); be_control_look->DrawLabel(this, Label(), rect, updateRect, base, flags, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE)); return; } font_height fh; GetFontHeight(&fh); const BRect bounds = Bounds(); BRect rect = bounds; const bool enabled = IsEnabled(); const bool pushed = Value() == B_CONTROL_ON; // Default indicator if (IsDefault()) rect = _DrawDefault(rect, enabled); BRect fillArea = rect; fillArea.InsetBy(3.0, 3.0); BString text = Label(); #if 1 // Label truncation BFont font; GetFont(&font); font.TruncateString(&text, B_TRUNCATE_END, fillArea.Width() - 4); #endif // Label position const float stringWidth = StringWidth(text.String()); const float x = (rect.right - stringWidth) / 2.0; const float labelY = bounds.top + ((bounds.Height() - fh.ascent - fh.descent) / 2.0) + fh.ascent + 1.0; const float focusLineY = labelY + fh.descent; /* speed trick: if the focus changes but the button is not pressed then we can redraw only the focus line, if the focus changes and the button is pressed invert the internal rect this block takes care of all the focus changes */ if (IsFocusChanging()) { if (pushed) { rect.InsetBy(2.0, 2.0); InvertRect(rect); } else { _DrawFocusLine(x, focusLineY, stringWidth, IsFocus() && Window()->IsActive()); } return; } // colors rgb_color panelBgColor = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color buttonBgColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); rgb_color lightColor; rgb_color maxLightColor; rgb_color dark1BorderColor; rgb_color dark2BorderColor; rgb_color bevelColor1; rgb_color bevelColor2; rgb_color bevelColorRBCorner; rgb_color borderBevelShadow; rgb_color borderBevelLight; if (enabled) { lightColor = tint_color(panelBgColor, B_LIGHTEN_2_TINT); maxLightColor = tint_color(panelBgColor, B_LIGHTEN_MAX_TINT); dark1BorderColor = tint_color(panelBgColor, B_DARKEN_3_TINT); dark2BorderColor = tint_color(panelBgColor, B_DARKEN_4_TINT); bevelColor1 = tint_color(panelBgColor, B_DARKEN_2_TINT); bevelColor2 = panelBgColor; if (IsDefault()) { borderBevelShadow = tint_color(dark1BorderColor, (B_NO_TINT + B_DARKEN_1_TINT) / 2); borderBevelLight = tint_color(dark1BorderColor, B_LIGHTEN_1_TINT); borderBevelLight.red = (borderBevelLight.red + panelBgColor.red) / 2; borderBevelLight.green = (borderBevelLight.green + panelBgColor.green) / 2; borderBevelLight.blue = (borderBevelLight.blue + panelBgColor.blue) / 2; dark1BorderColor = tint_color(dark1BorderColor, B_DARKEN_3_TINT); dark2BorderColor = tint_color(dark1BorderColor, B_DARKEN_4_TINT); bevelColorRBCorner = borderBevelShadow; } else { borderBevelShadow = tint_color(panelBgColor, (B_NO_TINT + B_DARKEN_1_TINT) / 2); borderBevelLight = buttonBgColor; bevelColorRBCorner = dark1BorderColor; } } else { lightColor = tint_color(panelBgColor, B_LIGHTEN_2_TINT); maxLightColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); dark1BorderColor = tint_color(panelBgColor, B_DARKEN_1_TINT); dark2BorderColor = tint_color(panelBgColor, B_DARKEN_2_TINT); bevelColor1 = panelBgColor; bevelColor2 = buttonBgColor; if (IsDefault()) { borderBevelShadow = dark1BorderColor; borderBevelLight = panelBgColor; dark1BorderColor = tint_color(dark1BorderColor, B_DARKEN_1_TINT); dark2BorderColor = tint_color(dark1BorderColor, 1.16); } else { borderBevelShadow = panelBgColor; borderBevelLight = panelBgColor; } bevelColorRBCorner = tint_color(panelBgColor, 1.08);; } // fill the button area SetHighColor(buttonBgColor); FillRect(fillArea); BeginLineArray(22); // bevel around external border AddLine(BPoint(rect.left, rect.bottom), BPoint(rect.left, rect.top), borderBevelShadow); AddLine(BPoint(rect.left + 1, rect.top), BPoint(rect.right, rect.top), borderBevelShadow); AddLine(BPoint(rect.right, rect.top + 1), BPoint(rect.right, rect.bottom), borderBevelLight); AddLine(BPoint(rect.left + 1, rect.bottom), BPoint(rect.right - 1, rect.bottom), borderBevelLight); rect.InsetBy(1.0, 1.0); // external border AddLine(BPoint(rect.left, rect.bottom), BPoint(rect.left, rect.top), dark1BorderColor); AddLine(BPoint(rect.left + 1, rect.top), BPoint(rect.right, rect.top), dark1BorderColor); AddLine(BPoint(rect.right, rect.top + 1), BPoint(rect.right, rect.bottom), dark2BorderColor); AddLine(BPoint(rect.right - 1, rect.bottom), BPoint(rect.left + 1, rect.bottom), dark2BorderColor); rect.InsetBy(1.0, 1.0); // Light AddLine(BPoint(rect.left, rect.top), BPoint(rect.left, rect.top), buttonBgColor); AddLine(BPoint(rect.left, rect.top + 1), BPoint(rect.left, rect.bottom - 1), lightColor); AddLine(BPoint(rect.left, rect.bottom), BPoint(rect.left, rect.bottom), bevelColor2); AddLine(BPoint(rect.left + 1, rect.top), BPoint(rect.right - 1, rect.top), lightColor); AddLine(BPoint(rect.right, rect.top), BPoint(rect.right, rect.top), bevelColor2); // Shadow AddLine(BPoint(rect.left + 1, rect.bottom), BPoint(rect.right - 1, rect.bottom), bevelColor1); AddLine(BPoint(rect.right, rect.bottom), BPoint(rect.right, rect.bottom), bevelColorRBCorner); AddLine(BPoint(rect.right, rect.bottom - 1), BPoint(rect.right, rect.top + 1), bevelColor1); rect.InsetBy(1.0, 1.0); // Light AddLine(BPoint(rect.left, rect.top), BPoint(rect.left, rect.bottom - 1), maxLightColor); AddLine(BPoint(rect.left, rect.bottom), BPoint(rect.left, rect.bottom), buttonBgColor); AddLine(BPoint(rect.left + 1, rect.top), BPoint(rect.right - 1, rect.top), maxLightColor); AddLine(BPoint(rect.right, rect.top), BPoint(rect.right, rect.top), buttonBgColor); // Shadow AddLine(BPoint(rect.left + 1, rect.bottom), BPoint(rect.right, rect.bottom), bevelColor2); AddLine(BPoint(rect.right, rect.bottom - 1), BPoint(rect.right, rect.top + 1), bevelColor2); rect.InsetBy(1.0,1.0); EndLineArray(); // Invert if clicked if (enabled && pushed) { rect.InsetBy(-2.0, -2.0); InvertRect(rect); } // Label color if (enabled) { if (pushed) { SetHighColor(maxLightColor); SetLowColor(255 - buttonBgColor.red, 255 - buttonBgColor.green, 255 - buttonBgColor.blue); } else { SetHighColor(ui_color(B_CONTROL_TEXT_COLOR)); SetLowColor(buttonBgColor); } } else { SetHighColor(tint_color(panelBgColor, B_DISABLED_LABEL_TINT)); SetLowColor(buttonBgColor); } // Draw the label DrawString(text.String(), BPoint(x, labelY)); // Focus line if (enabled && IsFocus() && Window()->IsActive() && !pushed) _DrawFocusLine(x, focusLineY, stringWidth, true); }
//-- bool DataProperty::Satisfy(OpenBabel::OBBond* pBond, const std::string& refTo, std::vector<Class*>& vecSatisfiedClasses, std::string& refValue) { //bool bSatisfied = false; int iPosition = -1; // [rad] if we are default, we automatically satisfy if(!IsDefault()) { if(!SatisfyCommon(vecSatisfiedClasses, iPosition)) { // [rad] this property does not apply refValue = ""; return(false); } } // [rad] go through possible data types.. if(!refTo.compare("BOND_ORDER")) { ConvertInt(pBond->GetBondOrder(), refValue); } else if(!refTo.compare("BOND_EQUILIBRIUM_LENGTH")) { ConvertDouble(pBond->GetEquibLength(), refValue); } else if(!refTo.compare("BOND_LENGTH")) { ConvertDouble(pBond->GetLength(), refValue); } else if(!refTo.compare("BOND_IS_AROMATIC")) { ConvertBool(pBond->IsAromatic(), refValue); } else if(!refTo.compare("BOND_IS_IN_RING")) { ConvertBool(pBond->IsInRing(), refValue); } else if(!refTo.compare("BOND_IS_ROTOR")) { ConvertBool(pBond->IsRotor(), refValue); } else if(!refTo.compare("BOND_IS_AMIDE")) { ConvertBool(pBond->IsAmide(), refValue); } else if(!refTo.compare("BOND_IS_PRIMARY_AMIDE")) { ConvertBool(pBond->IsPrimaryAmide(), refValue); } else if(!refTo.compare("BOND_IS_SECONDARY_AMIDE")) { ConvertBool(pBond->IsSecondaryAmide(), refValue); } else if(!refTo.compare("BOND_IS_ESTER")) { ConvertBool(pBond->IsEster(), refValue); } else if(!refTo.compare("BOND_IS_CARBONYL")) { ConvertBool(pBond->IsCarbonyl(), refValue); } else if(!refTo.compare("BOND_IS_SINGLE_BOND")) { ConvertBool(pBond->IsSingle(), refValue); } else if(!refTo.compare("BOND_IS_DOUBLE_BOND")) { ConvertBool(pBond->IsDouble(), refValue); } else if(!refTo.compare("BOND_IS_TRIPLE_BOND")) { ConvertBool(pBond->IsTriple(), refValue); } else if(!refTo.compare("BOND_IS_CLOSURE_BOND")) { ConvertBool(pBond->IsClosure(), refValue); } else if(!refTo.compare("BOND_IS_UP")) { ConvertBool(pBond->IsUp(), refValue); } else if(!refTo.compare("BOND_IS_DOWN")) { ConvertBool(pBond->IsDown(), refValue); } else if(!refTo.compare("BOND_IS_HASH")) { ConvertBool(pBond->IsHash(), refValue); } else if(!refTo.compare("BOND_IS_WEDGE")) { ConvertBool(pBond->IsWedge(), refValue); } else { // [rad] unknown datatype? refValue = ""; return(false); } return(true); }
//-- bool DataProperty::SatisfyDirectDescriptor(OpenBabel::OBMol* pMolecule, const std::string& refTo, std::vector<Class*>& vecSatisfiedClasses, std::string& refValue) { int iPosition = -1; // [rad] if we are default, we automatically satisfy if(!IsDefault()) { if(!SatisfyCommon(vecSatisfiedClasses, iPosition)) { // [rad] this property does not apply refValue = ""; return(false); } } std::vector<OpenBabel::OBGenericData*>::iterator iter_data; std::string sQualityName, sQualityValue; OpenBabel::OBPairData* pAuxData; for(iter_data = pMolecule->BeginData(); iter_data != pMolecule->EndData(); iter_data++) { // [rad] Take care of PairData only for now if(1 == (*iter_data)->GetDataType()) { pAuxData = (OpenBabel::OBPairData*)(*iter_data); sQualityName = pAuxData->GetAttribute(); sQualityValue = pAuxData->GetValue(); if(!sQualityName.compare("PUBCHEM_COMPOUND_CID") && !refTo.compare("PUBCHEM_COMPOUND_CID")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_CACTVS_HBOND_ACCEPTOR") && !refTo.compare("PUBCHEM_CACTVS_HBOND_ACCEPTOR")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_CACTVS_HBOND_DONOR") && !refTo.compare("PUBCHEM_CACTVS_HBOND_DONOR")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_CACTVS_ROTATABLE_BOND") && !refTo.compare("PUBCHEM_CACTVS_ROTATABLE_BOND")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_CACTVS_SUBSKEYS") && !refTo.compare("PUBCHEM_CACTVS_SUBSKEYS")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_IUPAC_OPENEYE_NAME") && !refTo.compare("PUBCHEM_IUPAC_OPENEYE_NAME")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_IUPAC_CAS_NAME") && !refTo.compare("PUBCHEM_IUPAC_CAS_NAME")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_IUPAC_NAME") && !refTo.compare("PUBCHEM_IUPAC_NAME")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_IUPAC_SYSTEMATIC_NAME") && !refTo.compare("PUBCHEM_IUPAC_SYSTEMATIC_NAME")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_IUPAC_TRADITIONAL_NAME") && !refTo.compare("PUBCHEM_IUPAC_TRADITIONAL_NAME")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_NIST_INCHI") && !refTo.compare("PUBCHEM_NIST_INCHI")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_CACTVS_XLOGP") && !refTo.compare("PUBCHEM_CACTVS_XLOGP")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_CACTVS_EXACT_MASS") && !refTo.compare("PUBCHEM_CACTVS_EXACT_MASS")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_OPENEYE_MF") && !refTo.compare("PUBCHEM_OPENEYE_MF")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_OPENEYE_MW") && !refTo.compare("PUBCHEM_OPENEYE_MW")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_OPENEYE_CAN_SMILES") && !refTo.compare("PUBCHEM_OPENEYE_CAN_SMILES")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_OPENEYE_ISO_SMILES") && !refTo.compare("PUBCHEM_OPENEYE_ISO_SMILES")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_CACTVS_TPSA") && !refTo.compare("PUBCHEM_CACTVS_TPSA")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_OPENEYE_MONOISOTOPICWT") && !refTo.compare("PUBCHEM_OPENEYE_MONOISOTOPICWT")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_TOTAL_CHARGE") && !refTo.compare("PUBCHEM_TOTAL_CHARGE")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_HEAVY_ATOM_COUNT") && !refTo.compare("PUBCHEM_HEAVY_ATOM_COUNT")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_ATOM_DEF_STEREO_COUNT") && !refTo.compare("PUBCHEM_ATOM_DEF_STEREO_COUNT")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_ATOM_UDEF_STEREO_COUNT") && !refTo.compare("PUBCHEM_ATOM_UDEF_STEREO_COUNT")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_BOND_DEF_STEREO_COUNT") && !refTo.compare("PUBCHEM_BOND_DEF_STEREO_COUNT")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_BOND_UDEF_STEREO_COUNT") && !refTo.compare("PUBCHEM_BOND_UDEF_STEREO_COUNT")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_ISOTOPIC_ATOM_COUNT") && !refTo.compare("PUBCHEM_ISOTOPIC_ATOM_COUNT")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_COMPONENT_COUNT") && !refTo.compare("PUBCHEM_COMPONENT_COUNT")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_CACTVS_TAUTO_COUNT") && !refTo.compare("PUBCHEM_CACTVS_TAUTO_COUNT")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_BONDANNOTATIONS") && !refTo.compare("PUBCHEM_BONDANNOTATIONS")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_COMPOUND_CANONICALIZED") && !refTo.compare("PUBCHEM_COMPOUND_CANONICALIZED")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_CACTVS_COMPLEXITY") && !refTo.compare("PUBCHEM_CACTVS_COMPLEXITY")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_MOLECULAR_FORMULA") && !refTo.compare("PUBCHEM_MOLECULAR_FORMULA")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_MOLECULAR_WEIGHT") && !refTo.compare("PUBCHEM_MOLECULAR_WEIGHT")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_EXACT_MASS") && !refTo.compare("PUBCHEM_EXACT_MASS")) { refValue = sQualityValue; return(true); } else if(!sQualityName.compare("PUBCHEM_MONOISOTOPIC_WEIGHT") && !refTo.compare("PUBCHEM_MONOISOTOPIC_WEIGHT")) { refValue = sQualityValue; return(true); } } } return(false); }
//------------------------------------------------------------------------ bool CPlayerProfile::LoadAttributes(const XmlNodeRef& root, int requiredVersion) { int version = 0; const bool bHaveVersion = root->getAttr(VERSION_TAG, version); if (requiredVersion > 0) { if (bHaveVersion && version < requiredVersion) { GameWarning("CPlayerProfile::LoadAttributes: Attributes of profile '%s' have different version (%d != %d). Updated.", GetName(), version, requiredVersion); return false; } else if (!bHaveVersion) { GameWarning("CPlayerProfile::LoadAttributes: Attributes of legacy profile '%s' has no version (req=%d). Loading anyway.", GetName(), requiredVersion); } m_attributesVersion = requiredVersion; } else // for default profile we set the version we found in the rootNode m_attributesVersion = version; int nChilds = root->getChildCount(); for (int i=0; i<nChilds; ++i) { XmlNodeRef child = root->getChild(i); if (child && strcmp(child->getTag(), "Attr") == 0) { const char* name = child->getAttr("name"); const char* value = child->getAttr("value"); const char* platform = child->getAttr("platform"); bool platformValid = true; if(platform != NULL && platform[0]) { #if defined(DURANGO) platformValid = (strstr(platform, "xbox")!=0); #elif defined(ORBIS) platformValid = (strstr(platform, "ps4")!=0); #else platformValid = (strstr(platform, "pc")!=0); #endif } if (name && value && platformValid) { m_attributeMap[name] = TFlowInputData(string(value)); } } } if(m_pManager->HasEnabledOnlineAttributes() && m_pManager->CanProcessOnlineAttributes() && !IsDefault()) { m_pManager->LoadOnlineAttributes(this); } return true; }