// when user is idle, change the logo void CSkinManager::SetIdle(BOOL bIsIdle /* = TRUE */) { CString dir = CMyUtility::GetCurDir(); CString skinDir; skinDir.Format(_T("%s\\skins\\%s"), dir, GetCurrentSkin()); CString bmp; if (bIsIdle) bmp.Format(_T("%s\\logo-idle.bmp"), skinDir); else bmp.Format(_T("%s\\logo.bmp"), skinDir); SetBackgroundImage(&(m_pParent->m_staticLogo), bmp); }
void COFSNcDlg2::LoadSkinXML(IXMLDOMDocument **ppDoc, IXMLDOMNode **ppRoot) { ASSERT(ppDoc != NULL); ASSERT(ppRoot != NULL); HRESULT hr; CString strErrorMessage; VARIANT_BOOL b; LoadSkins skin; long nErrorCode = 0; IStreamPtr pStream = NULL; CString str = IBN_SCHEMA; str += (LPCTSTR)GetCurrentSkin(); str += (LPCTSTR)m_strSkinSettings; hr = CoCreateInstance(CLSID_DOMDocument40, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (void**)ppDoc); if(SUCCEEDED(hr) && (*ppDoc) != NULL) { hr = (*ppDoc)->put_async(VARIANT_FALSE); CComVariant varLoad = (LPCTSTR)str; hr = (*ppDoc)->load(varLoad, &b); #ifdef _DEBUG //(*ppDoc)->save(_variant_t(L"c:\\tmp.xml")); if(b == VARIANT_FALSE) { strErrorMessage = "Skin Error: Can't Load XML " + str; AfxMessageBox(strErrorMessage); } #endif if(b != VARIANT_FALSE) { hr = (*ppDoc)->selectSingleNode(_bstr_t("WindowSettings"), ppRoot); #ifdef _DEVELOVER_VERSION_L1 if((*ppRoot) == NULL) { strErrorMessage = "Skin XML Error: Can't Find WindowSettings ( " + str + " )"; AfxMessageBox(strErrorMessage); } #endif } } }
void CWebWindow::OnCmdGetVariable(LPCTSTR bstrVarName, BSTR* bstrVarValue) { if(_tcscmp(bstrVarName, _T("CurrentSkin"))==0) { bstr_t strReturn = (LPCTSTR)GetCurrentSkin(); (*bstrVarValue) = strReturn.copy(); } else if(lstrcmp(bstrVarName, _T("Hash")) == 0) { TCHAR buf[1024]; buf[0] = 0; GetEnvironmentVariable(_T("MpaKey"), buf, 1024); bstr_t strReturn = buf; (*bstrVarValue) = strReturn.copy(); } else if(_tcscmp(bstrVarName, _T("bandWidthID"))==0) { int bandwidthID = GetOptionInt(IDS_NETOPTIONS,IDS_BANDWIDTH,2); CString strTmp; strTmp.Format(_T("%d"), bandwidthID); bstr_t strReturn = (LPCTSTR)strTmp; (*bstrVarValue) = strReturn.copy(); } else if(_tcscmp(bstrVarName, _T("SID"))==0) { bstr_t strReturn = (LPCTSTR)(((CMainDlg*)GetMessageParent())->GetSID()); (*bstrVarValue) = strReturn.copy(); } else if(_tcscmp(bstrVarName, _T("HOST"))==0) { bstr_t strReturn = (LPCTSTR)(((CMainDlg*)GetMessageParent())->GetServerPath()); (*bstrVarValue) = strReturn.copy(); } else if(_tcscmp(bstrVarName, _T("AttachXML"))==0) { (*bstrVarValue) = m_AttachLoadXML.Copy(); m_bQueryAttachXML = TRUE; } else g_ViewVariablesList.GetVariable(bstrVarName,bstrVarValue); }
void COFSNcDlg2::LoadPicture(IXMLDOMNode *pPicture, CPictureObj **ppPictureObj) { ASSERT(pPicture != NULL); LoadSkins skin; long nErrorCode = 0; IStreamPtr pStream = NULL; CComBSTR bs, bsPath; WCHAR *szNULL = L"\0x00"; long x=0, y=0, cx=0, cy=0; CComPtr<IXMLDOMNodeList> pList = NULL; CComPtr<IXMLDOMNode> pFragment = NULL; // Load image bs.Empty(); SelectChildNode(pPicture, CComBSTR(L"Image"), NULL, &bs); bsPath = (BSTR)bstr_t(IBN_SCHEMA); bsPath += (LPCTSTR)GetCurrentSkin(); bsPath += bs; skin.Load(bsPath, &pStream, &nErrorCode); if(pStream) { // Load coords bs.Empty(); SelectChildNode(pPicture, CComBSTR(L"XPos"), NULL, &bs); if(bs.m_str != NULL) x = wcstol(bs.m_str, &szNULL, 10); bs.Empty(); SelectChildNode(pPicture, CComBSTR(L"YPos"), NULL, &bs); if(bs.m_str != NULL) y = wcstol(bs.m_str, &szNULL, 10); bs.Empty(); SelectChildNode(pPicture, CComBSTR(L"XLen"), NULL, &bs); if(bs.m_str != NULL) cx = wcstol(bs.m_str, &szNULL, 10); bs.Empty(); SelectChildNode(pPicture, CComBSTR(L"YLen"), NULL, &bs); if(bs.m_str != NULL) cy = wcstol(bs.m_str, &szNULL, 10); CSize szTL, szBR; LoadResizeSettings(pPicture, szTL, szBR); CPictureObj* pic = new CPictureObj; if(pic) { if(pic->Create(pStream, x, y, cx, cy)) { // Load picture fragments long nFragments = 0; pPicture->selectNodes(CComBSTR(L"Fragment"), &pList); if(pList) { pList->get_length(&nFragments); pList->nextNode(&pFragment); while(pFragment) { LoadPictureFragment(pFragment, pic); pFragment = NULL; pList->nextNode(&pFragment); } //pList->Release(); } if(nFragments <= 0) { pic->AddWholeImage(CResizableImage::STRETCH); } if(ppPictureObj) { *ppPictureObj = pic; } else { m_aPictures.Add(pic); AddAnchor(pic, szTL, szBR); } } else delete pic; } } }
BOOL COFSNcDlg2::LoadButton(IXMLDOMNode *pXmlRoot, LPCTSTR szButtonName, CMcButton *pBtn, BOOL bAutoPressed, BOOL bCanStayPressed, int Type) { // [7/23/2002] BOOL bIsBtnEnable = pBtn->GetEnabled(); if(bIsBtnEnable) pBtn->EnableWindow(FALSE); // [7/23/2002] BOOL bResult = FALSE; LoadSkins skin; long nErrorCode = 0; HRESULT hr = S_OK; CString strErrorMessage; CComPtr<IStream> pStream = NULL; CComPtr<IXMLDOMNode> pButton = NULL; CComBSTR bs; _bstr_t bsImagePath; long x=0, y=0; WCHAR *szNULL = L"\0x00"; bs.Empty(); bs = L"Button[@Name='"; bs += szButtonName; bs += L"']"; pXmlRoot->selectSingleNode(bs, &pButton); if(pButton) { bResult = TRUE; // Get button coordinates bs.Empty(); SelectChildNode(pButton, CComBSTR(L"XPos"), NULL, &bs); if(bs.m_str != NULL) x = wcstol(bs.m_str, &szNULL, 10); bs.Empty(); SelectChildNode(pButton, CComBSTR(L"YPos"), NULL, &bs); if(bs.m_str != NULL) y = wcstol(bs.m_str, &szNULL, 10); // Load button picture bs.Empty(); SelectChildNode(pButton, CComBSTR(L"Image"), NULL, &bs); if(bs.m_str != NULL) { bsImagePath = bstr_t(IBN_SCHEMA); bsImagePath += (LPCTSTR)GetCurrentSkin(); bsImagePath += bs.m_str; skin.Load(bsImagePath, &pStream, &nErrorCode); #ifdef _DEVELOVER_VERSION_L1 if(pStream == NULL || nErrorCode) { strErrorMessage = "Skin Error: Can't Load Image ( "; strErrorMessage += (char*)bsImagePath; strErrorMessage +=" )"; AfxMessageBox(strErrorMessage); } #endif if(pStream) { pBtn->LoadBitmapFromStream(pStream); UINT nFlags = SWP_NOZORDER|SWP_NOSIZE; // 1=Maximize, 2=Restore if(Type == 0) { nFlags |= SWP_SHOWWINDOW; } if(Type == 1) { m_pBtnMax = pBtn; nFlags |= SWP_SHOWWINDOW; } if(Type == 2) { m_pBtnRestore = pBtn; } pBtn->SetWindowPos(NULL, x, y, 0, 0, nFlags); pBtn->SetAutoPressed(bAutoPressed); pBtn->SetCanStayPressed(bCanStayPressed); } } // Load settings for resize //LoadResizeSettings(pButton, pBtn->m_hWnd); CComPtr<IXMLDOMNode> pResize = NULL; pButton->selectSingleNode(CComBSTR(L"Resize"), &pResize); if(pResize) { long tlcx, tlcy, brcx, brcy; GetNodeAttributeAsLong(pResize, _bstr_t("TLCX"), &tlcx, 10); GetNodeAttributeAsLong(pResize, _bstr_t("TLCY"), &tlcy, 10); GetNodeAttributeAsLong(pResize, _bstr_t("BRCX"), &brcx, 10); GetNodeAttributeAsLong(pResize, _bstr_t("BRCY"), &brcy, 10); if(tlcx || tlcy || brcx || brcy) AddAnchor((CWnd*)pBtn, CSize(tlcx, tlcy), CSize(brcx, brcy)); //pResize->Release(); } //pButton->Release(); } if(bIsBtnEnable) pBtn->EnableWindow(); return bResult; }
BOOL COFSNcDlg2::LoadProgress(IXMLDOMNode *pXmlRoot, LPCTSTR szName, CMcProgress *pMcProgress, BOOL bVisible) { BOOL bResult = FALSE; LoadSkins skin; long nErrorCode = 0; HRESULT hr = S_OK; CString strErrorMessage; IStreamPtr pStream1 = NULL, pStream2 = NULL; CComPtr<IXMLDOMNode> pProgress = NULL; CComBSTR bs; _bstr_t bsImagePath; long x=0, y=0, cx=0, cy=0; WCHAR *szNULL = L"\0x00"; pMcProgress->ShowWindow(SW_HIDE); bs.Empty(); bs = L"Progress[@Name='"; bs += szName; bs += L"']"; pXmlRoot->selectSingleNode(bs, &pProgress); if(pProgress) { bResult = TRUE; // Get button coordinates bs.Empty(); SelectChildNode(pProgress, CComBSTR(L"XPos"), NULL, &bs); if(bs.m_str != NULL) x = wcstol(bs.m_str, &szNULL, 10); bs.Empty(); SelectChildNode(pProgress, CComBSTR(L"YPos"), NULL, &bs); if(bs.m_str != NULL) y = wcstol(bs.m_str, &szNULL, 10); bs.Empty(); SelectChildNode(pProgress, CComBSTR(L"XLen"), NULL, &bs); if(bs.m_str != NULL) cx = wcstol(bs.m_str, &szNULL, 10); bs.Empty(); SelectChildNode(pProgress, CComBSTR(L"YLen"), NULL, &bs); if(bs.m_str != NULL) cy = wcstol(bs.m_str, &szNULL, 10); // Load button picture bs.Empty(); SelectChildNode(pProgress, CComBSTR(L"Image[@Name='Empty']"), NULL, &bs); if(bs.m_str != NULL) { bsImagePath = bstr_t(IBN_SCHEMA); bsImagePath += (LPCTSTR)GetCurrentSkin(); bsImagePath += bs.m_str; skin.Load(bsImagePath, &pStream1, &nErrorCode); #ifdef _DEVELOVER_VERSION_L1 if(pStream1 == NULL || nErrorCode) { strErrorMessage = "Skin Error: Can't Load Image ( "; strErrorMessage += (char*)bsImagePath; strErrorMessage +=" )"; AfxMessageBox(strErrorMessage); } #endif } bs.Empty(); SelectChildNode(pProgress, CComBSTR(L"Image[@Name='Full']"), NULL, &bs); if(bs.m_str != NULL) { bsImagePath = bstr_t(IBN_SCHEMA); bsImagePath += (LPCTSTR)GetCurrentSkin(); bsImagePath += bs.m_str; skin.Load(bsImagePath, &pStream2, &nErrorCode); #ifdef _DEVELOVER_VERSION_L1 if(pStream2 == NULL || nErrorCode) { strErrorMessage = "Skin Error: Can't Load Image ( "; strErrorMessage += (char*)bsImagePath; strErrorMessage +=" )"; AfxMessageBox(strErrorMessage); } #endif } CRect rFull; rFull.SetRectEmpty(); LoadRect(pProgress, _T("RectFull"), rFull); if(pStream1 != NULL && pStream2 != NULL && !rFull.IsRectEmpty()) pMcProgress->LoadBitmapsFromStream((LPUNKNOWN)pStream1, (LPUNKNOWN)pStream2, rFull.left, rFull.top, rFull.Width(), rFull.Height()); UINT nFlags = SWP_NOZORDER; if(bVisible) nFlags |= SWP_SHOWWINDOW; pMcProgress->SetWindowPos(NULL, x, y, cx, cy, nFlags); // Load settings for resize //LoadResizeSettings(pButton, pBtn->m_hWnd); CComPtr<IXMLDOMNode> pResize = NULL; pProgress->selectSingleNode(CComBSTR(L"Resize"), &pResize); if(pResize) { long tlcx, tlcy, brcx, brcy; GetNodeAttributeAsLong(pResize, _bstr_t("TLCX"), &tlcx, 10); GetNodeAttributeAsLong(pResize, _bstr_t("TLCY"), &tlcy, 10); GetNodeAttributeAsLong(pResize, _bstr_t("BRCX"), &brcx, 10); GetNodeAttributeAsLong(pResize, _bstr_t("BRCY"), &brcy, 10); if(tlcx || tlcy || brcx || brcy) AddAnchor((CWnd*)pMcProgress, CSize(tlcx, tlcy), CSize(brcx, brcy)); //pResize->Release(); } //pProgress->Release(); } return bResult; }