void CDlgWingspanAdjacancyConstraints::OnLvnItemchangedList(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR); UpdateToolBarState(); int nSelItem = GetSelectedListItem(); if (nSelItem < 0) return; CWingspanAdjacencyConstraints *pConstraint = (CWingspanAdjacencyConstraints *)m_wndListCtrl.GetItemData(nSelItem); if (pConstraint == NULL) return; { CStringList lstFirstNode; GetNodeListByTaxiway(pConstraint->m_firstaxiway.m_pTaxiway,lstFirstNode); LVCOLDROPLIST* pDroplistFrom = m_wndListCtrl.GetColumnStyle(1); LVCOLDROPLIST* pDroplistTo = m_wndListCtrl.GetColumnStyle(2); if(pDroplistFrom && pDroplistTo) { pDroplistFrom->List.RemoveAll(); pDroplistTo->List.RemoveAll(); POSITION pos; for( pos = lstFirstNode.GetHeadPosition(); pos;) { pDroplistFrom->List.AddTail(lstFirstNode.GetAt(pos)); pDroplistTo->List.AddTail(lstFirstNode.GetAt(pos)); lstFirstNode.GetNext( pos ); } } } { CStringList lstSecondNode; GetNodeListByTaxiway(pConstraint->m_secondTaxiway.m_pTaxiway,lstSecondNode); LVCOLDROPLIST* pDroplistFrom = m_wndListCtrl.GetColumnStyle(7); LVCOLDROPLIST* pDroplistTo = m_wndListCtrl.GetColumnStyle(8); if(pDroplistFrom && pDroplistTo) { pDroplistFrom->List.RemoveAll(); pDroplistTo->List.RemoveAll(); POSITION pos; for( pos = lstSecondNode.GetHeadPosition(); pos;) { pDroplistFrom->List.AddTail(lstSecondNode.GetAt(pos)); pDroplistTo->List.AddTail(lstSecondNode.GetAt(pos)); lstSecondNode.GetNext( pos ); } } } }
// v7.2 - update 03 - added for mods to StartDropList - adjust // droplist to width of text - Allen Shiels int CUGDropListType::GetMaxStringWidth(const CStringList& list) const { int maxWidth = 0; CDC* pDC = m_listBox->GetDC(); CFont* pFont = m_listBox->GetFont(); CFont* pOldFont = pDC->SelectObject(pFont); // Loop through each item in the list calculating // the text extent for each string in the list box font int len = (int)list.GetCount(); POSITION position = list.GetHeadPosition(); int pos = 0; while(pos < len) { CSize sz = pDC->GetTextExtent(list.GetAt(position)); if (sz.cx > maxWidth) maxWidth = sz.cx; pos++; if(pos < len) list.GetNext(position); } pDC->SelectObject(pOldFont); m_listBox->ReleaseDC(pDC); return maxWidth + 10; // + a bit to stop clipping }
BOOL RegistryKey::WriteFile() { if (mFileName == "") return FALSE; POSITION pos; CString key; CString val; CString data; AutoBuf buf(1000); CStringList slist; for( pos = mKeyValPairs->GetStartPosition(); pos != NULL; ) { mKeyValPairs->GetNextAssoc(pos, key, val); String::insertSort(slist, key); } for (pos = slist.GetHeadPosition(); pos != NULL; ) { CString key = slist.GetAt(pos); if (mKeyValPairs->Lookup(key, val)) { if (key.GetLength() && val.GetLength()) { sprintf(buf.p, "%s: %s\r\n", key, val); data += buf.p; } } slist.GetNext(pos); } // for( pos = mKeyValPairs->GetStartPosition(); pos != NULL; ) { // mKeyValPairs->GetNextAssoc(pos, key, val); // if (key.GetLength() && val.GetLength()) { // sprintf(buf.p, "%s: %s\r\n", key, val); // data += buf.p; // } // } if (data == "") return FALSE; CFile cfile; CFileException e; if (cfile.Open(mFileName, CFile::modeCreate // |CFile::modeNoTruncate |CFile::modeWrite // |CFile::typeText |CFile::shareDenyNone, &e) == FALSE) { return FALSE; } cfile.Write(data, data.GetLength()); cfile.Flush(); cfile.Close(); return TRUE; }
BOOL CConfigDisplay::findGoodSkin() { CStringList list; CString skin ; readSkins(list); POSITION pos ; if (String::CStringListContains(list,"MBClassic")) { skin = "MBClassic"; } else { pos = list.GetHeadPosition(); if (!pos) return FALSE; skin = list.GetAt(pos); } return OnSkinChoose(skin); }
void vmsFilesToDelete::Process() { CStringList sl; _App.FilesToDelete (sl); for (int i = sl.GetCount () - 1; i >= 0; i--) { LPCTSTR psz = sl.GetAt (sl.FindIndex (i)); BOOL bOK = TRUE; if (GetFileAttributes (psz) != DWORD (-1)) bOK = DeleteFile (psz); if (bOK) sl.RemoveAt (sl.FindIndex (i)); } _App.FilesToDelete_save (sl); }
void __cdecl ScriptSetPopulator(TestSet *pTestSet) { // TODO read from registry CString szTestDir(_T("Scripts")); CStringList cStringList; CFileFind cFinder; CString szPattern; szPattern.Format(_T("%s\\*.vbs"), szTestDir); BOOL bWorking = cFinder.FindFile(szPattern); while (bWorking) { bWorking = cFinder.FindNextFile(); cStringList.AddTail(cFinder.GetFileName()); } szPattern.Format(_T("%s\\*.js"), szTestDir); bWorking = cFinder.FindFile(szPattern); while (bWorking) { bWorking = cFinder.FindNextFile(); cStringList.AddTail(cFinder.GetFileName()); } // Create a set of tests from the scripts found Test *pTests = (Test *) malloc(sizeof(Test) * cStringList.GetCount()); for (int i = 0; i < cStringList.GetCount(); i++) { CString szScript = cStringList.GetAt(cStringList.FindIndex(i)); _tcscpy(pTests[i].szName, szScript); _tcscpy(pTests[i].szDesc, _T("Run the specified script")); pTests[i].pfn = tstScriptTest; } pTestSet->nTests = cStringList.GetCount(); pTestSet->aTests = pTests; }
void CWordFilter::Init() { HANDLE hFile; DWORD dwRead; int nLen; BOOL bResult; CStringList list; //m_count = 0; // 如果文件目录不对,程序移动一下,到config目录下 added by kernel1983 2006.07.31 if (PathFileExists(thePrefs.GetMuleDirectory(EMULE_EXECUTEABLEDIR) + FLITER_FILE)) MoveFile(thePrefs.GetMuleDirectory(EMULE_EXECUTEABLEDIR) + FLITER_FILE, thePrefs.GetMuleDirectory(EMULE_CONFIGDIR) + FLITER_FILE); if (!PathFileExists(thePrefs.GetMuleDirectory(EMULE_CONFIGDIR) + FLITER_FILE)) { // 不存在,所有的都过滤 added by kernel1983 2006.08.08 m_filterall = true; return; } // Open file for read hFile = CreateFile(thePrefs.GetMuleDirectory(EMULE_CONFIGDIR) + FLITER_FILE, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); //AddLogLine(false,_T(":%s\n"),thePrefs.GetMuleDirectory(EMULE_CONFIGDIR) + FLITER_FILE); if(hFile == NULL || hFile == INVALID_HANDLE_VALUE) { // 读取错误,所有的都过滤 added by kernel1983 2006.08.08 m_filterall = true; return; } DWORD dwSize = GetFileSize(hFile, NULL); TCHAR * pszData = new TCHAR[(dwSize / sizeof(TCHAR)) + 1]; // 申请空间 bResult = ReadFile(hFile, pszData, dwSize, &dwRead, NULL); // 读入文件1 CloseHandle(hFile); pszData[(dwSize / sizeof(TCHAR))] = 0; if(bResult) { TCHAR * pszTemp = wcstok(pszData + 1, _T("\r\n")); while(pszTemp != NULL) { nLen = wcslen(pszTemp); while(pszTemp[nLen - 1] == '\t' || pszTemp[nLen - 1] == ' ') { nLen --; pszTemp[nLen] = 0; } while(*pszTemp == '\t' || *pszTemp == ' ') { pszTemp ++; nLen --; } //AddLogLine(false,_T("pszTemp:%s"),pszTemp); //AddLogLine(false,_T("nLen:%d"),nLen); if(nLen > 0)list.AddTail(pszTemp); //if(nLen == 8)AddLogLine(false,_T(":%d %d %d %d "),((char*)pszTemp)[0],((char*)pszTemp)[1],((char*)pszTemp)[2],((char*)pszTemp)[3]); pszTemp = wcstok(NULL, _T("\r\n")); } } delete[] pszData; m_count = list.GetCount(); //AddLogLine(false,_T("m_count:%d"),m_count); if(bResult && m_count > 0) { m_filterwords = new TCHAR*[m_count+1]; m_kmpvalue = new int*[m_count+1]; ZeroMemory(m_filterwords, sizeof(TCHAR *) * m_count); ZeroMemory(m_kmpvalue, sizeof(int *) * m_count); } for(int i = 0; bResult && (i < m_count); i ++) { CString s = list.GetAt(list.FindIndex(i)); s.MakeLower(); nLen = s.GetLength(); //AddLogLine(false,_T("nLen:%d"),nLen); m_filterwords[i] = new TCHAR[nLen + 1]; m_filterwords[i][nLen] = 0; // 最后一个字节设为0 m_kmpvalue[i] = new int[nLen]; //AddLogLine(false,_T("nLen:%d"),nLen); _tcscpy(m_filterwords[i],s); //AddLogLine(false,_T("m_filterwords[i]:%s"),m_filterwords[i]); KMP_GetNext(m_filterwords[i], m_kmpvalue[i]); // 得到一个与内容有关的数值m_kmpvalue[i] } if(m_count == 0 || !bResult) { Free(); //m_filterall = true; } }
//*************************************************************************************** BOOL CBCGPToolBoxPage::InitPage (UINT uiBmpResID, int nImageWidth, const CStringList& lstLabels, CRuntimeClass* pButtonClass) { ASSERT_VALID (this); m_pButtonClass = pButtonClass; m_uiBmpResID = uiBmpResID; if (!m_Images.Load (uiBmpResID)) { ASSERT (FALSE); return FALSE; } // Enable tooltips: CBCGPTooltipManager::CreateToolTip (m_pToolTip, this, BCGP_TOOLTIP_TYPE_TOOLBOX); HBITMAP hBitmap = m_Images.GetImageWell (); BITMAP bmp; ::GetObject (hBitmap, sizeof (BITMAP), (LPVOID) &bmp); m_sizeImage.cx = nImageWidth; m_sizeImage.cy = bmp.bmHeight; m_Images.SetImageSize (m_sizeImage, TRUE); if (globalData.GetRibbonImageScale () != 1.) { double dblImageScale = globalData.GetRibbonImageScale (); m_sizeImage = CSize ((int)(.5 + m_sizeImage.cx * dblImageScale), (int)(.5 + m_sizeImage.cy * dblImageScale)); } for (int i = 0; i < m_Images.GetCount (); i++) { CBCGPToolBoxButton* pButton = DYNAMIC_DOWNCAST (CBCGPToolBoxButton, pButtonClass->CreateObject ()); if (pButton == NULL) { ASSERT (FALSE); return FALSE; } ASSERT_VALID (pButton); pButton->SetParentPage (this); pButton->SetImageList (&m_Images); pButton->SetImageIndex (i); pButton->SetID (i + 1); POSITION posLabel = lstLabels.FindIndex (i); if (posLabel != NULL) { pButton->SetLabel (lstLabels.GetAt (posLabel)); } if (i == 0 && m_bCheckFirstButton) { m_nCheckedButton = 0; pButton->SetCheck (TRUE); RedrawButton (m_nCheckedButton); } m_arButtons.Add (pButton); if (m_pToolTip->GetSafeHwnd () != NULL) { CRect rectDummy; rectDummy.SetRectEmpty (); m_pToolTip->AddTool ( this, LPSTR_TEXTCALLBACK, &rectDummy, pButton->GetID ()); } } return TRUE; }
//////////////////////////////////////////// // OnExecute // Demonstrate: // IDirectorySearch::ExecuteSearch // IDirectorySearch::GetNextRow // IDirectorySearch::GetColumn // IDirectorySearch::SetSearchPreference // ///////////////////////////////////////////// void CDlgIDirectorySearch::OnExecute() { ASSERT( m_pSearch ); CWaitCursor wait; UpdateData(TRUE); // Get data from the Dialog Box HRESULT hr; ADS_SEARCH_HANDLE hSearch; ADS_SEARCH_COLUMN col; CString s; int idx=0; int nCount; LPWSTR *pszAttr=NULL; POSITION pos; USES_CONVERSION; ///////////////////////////////// // Reset the Total Number ////////////////////////////////// SetDlgItemText( IDC_TOTAL, _T("")); ///////////////////////////////////////////// // Get the attribute list, and preparing.. /////////////////////////////////////////// CStringList sAttrList; m_cListView.DeleteAllItems(); // Reset the UI while( m_cListView.DeleteColumn(0)) { ; } ////////////////////////////////////////////////// // Preparing for attribute list // and columns to display CString sTemp; m_cAttrList.GetWindowText(s); // we need to add adspath, so that we can refer to this object later when user dblclk the item if ( !s.IsEmpty() ) { sTemp = s; sTemp.MakeLower(); if ( s.Find(_T("adspath"),0) == -1 ) { s += _T(",ADsPath"); } } // convert to string list for easy manipulation StringToStringList( s, sAttrList ); nCount = sAttrList.GetCount(); idx=0; if ( nCount ) { pszAttr = (LPWSTR*) AllocADsMem( nCount * sizeof(LPWSTR)); pos = sAttrList.GetHeadPosition(); while ( pos != NULL ) { s = sAttrList.GetAt(pos); pszAttr[idx] = T2OLE(s); sAttrList.GetNext(pos ); idx++; } } else { nCount = -1; } ///////////////////////////////////////// // BEGIN Set the preferences /////////////////////////////////////// DWORD dwCountPref = 0; ADS_SEARCHPREF_INFO prefInfo[ MAX_SEARCH_PREF ]; ADS_SORTKEY *pSortKey = NULL; if ( m_bEnableFilter == FALSE ) { // Reset the preference m_pSearch->SetSearchPreference( prefInfo, dwCountPref ); } else // Preferences are specified { //////////////////////// // Timeout Pref //////////////////////////// if ( m_nTimeOut != 0 ) { prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_TIMEOUT; prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER; prefInfo[dwCountPref].vValue.Integer = m_nTimeOut; dwCountPref++; } ////////////////////////////// // Search Scope ///////////////////////////// idx = m_CADsSearchScope.GetCurSel(); if ( idx != CB_ERR ) { prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE; prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER; prefInfo[dwCountPref].vValue.Integer = idx; dwCountPref++; } /////////////////////////////////////////////////// // Cache Result. The default is to cache the result ///////////////////////////////////////////////// if ( !m_bCacheResult ) { prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE; prefInfo[dwCountPref].vValue.dwType = ADSTYPE_BOOLEAN; prefInfo[dwCountPref].vValue.Boolean = FALSE; dwCountPref++; } ////////////////////////////////////////////////// // Page Size /////////////////////////////////////////////////// if ( m_nPageSize > 0 ) { prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_PAGESIZE; prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER;; prefInfo[dwCountPref].vValue.Integer = m_nPageSize; dwCountPref++; } //////////////////////////////////////////////// // Chase Referrals /////////////////////////////////////////////// idx = m_cChaseReferrals.GetCurSel(); if ( idx != CB_ERR ) { prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_CHASE_REFERRALS; prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER; switch( idx ) { case 0: prefInfo[dwCountPref].vValue.Integer = ADS_CHASE_REFERRALS_NEVER; break; case 1: prefInfo[dwCountPref].vValue.Integer = ADS_CHASE_REFERRALS_SUBORDINATE; break; case 2: prefInfo[dwCountPref].vValue.Integer = ADS_CHASE_REFERRALS_EXTERNAL; break; default: prefInfo[dwCountPref].vValue.Integer = ADS_CHASE_REFERRALS_EXTERNAL; } dwCountPref++; } /////////////////////////////////////////////// // Sort On //////////////////////////////////////////////// if ( !m_sSortOn.IsEmpty() ) { CStringList sList; UINT nCount; prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_SORT_ON; prefInfo[dwCountPref].vValue.dwType = ADSTYPE_PROV_SPECIFIC; StringToStringList( m_sSortOn, sList ); nCount = sList.GetCount(); if ( nCount > 0 ) { POSITION pos; pos= sList.GetHeadPosition(); pSortKey = (ADS_SORTKEY *) LocalAlloc( LMEM_FIXED | LMEM_ZEROINIT, sizeof(ADS_SORTKEY) * nCount ); idx = 0; while( pos != NULL ) { pSortKey[idx].pszAttrType = T2OLE(sList.GetAt(pos)); pSortKey[idx].pszReserved = NULL; pSortKey[idx].fReverseorder =0; // Next idx++; sList.GetNext( pos ); } prefInfo[dwCountPref].vValue.ProviderSpecific.dwLength = sizeof(ADS_SORTKEY) * nCount; prefInfo[dwCountPref].vValue.ProviderSpecific.lpValue = (LPBYTE) pSortKey; dwCountPref++; } } ////////////////////////////////////////////// // Size Limit ////////////////////////////////////////////// if ( m_nSizeLimit > 0 ) { prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_SIZE_LIMIT; prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER; prefInfo[dwCountPref].vValue.Integer = m_nSizeLimit; dwCountPref++; } ////////////////////////////////////////////////// // A Synchronous /////////////////////////////////////////////////// if ( m_bAsynch ) { prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_ASYNCHRONOUS; prefInfo[dwCountPref].vValue.dwType = ADSTYPE_BOOLEAN; prefInfo[dwCountPref].vValue.Integer = TRUE; dwCountPref++; } ///////////////////////////////////////////////////// // Attribute Type Only ////////////////////////////////////////////////////// if ( m_bAttrib ) { prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_ATTRIBTYPES_ONLY; prefInfo[dwCountPref].vValue.dwType = ADSTYPE_BOOLEAN; prefInfo[dwCountPref].vValue.Integer = TRUE; dwCountPref++; } ///////////////////////////////////////////////////// // Derefence Alias ////////////////////////////////////////////////////// if ( m_nDeref != CB_ERR ) { prefInfo[dwCountPref].dwSearchPref = ADS_SEARCHPREF_DEREF_ALIASES; prefInfo[dwCountPref].vValue.dwType = ADSTYPE_INTEGER; prefInfo[dwCountPref].vValue.Integer = m_nDeref; dwCountPref++; } /////////////////////////////////////////////// // Now Set the selected preferences ////////////////////////////////////////////// hr = m_pSearch->SetSearchPreference( prefInfo, dwCountPref ); } ///////////////////////////////////////// // END Set the preferences /////////////////////////////////////// //////////////////////////////////////// // Execute the Search ////////////////////////////////////// DWORD dwCount=0; hr = m_pSearch->ExecuteSearch(T2OLE(m_sFilter), pszAttr, nCount, &hSearch ); //////////////////////////////// //// cleanup //////////////////////////////// if ( pszAttr ) { FreeADsMem( pszAttr ); } if ( pSortKey ) { LocalFree( pSortKey ); } if ( !SUCCEEDED(hr) ) { AfxMessageBox(GetErrorMessage(hr)); return; } //////////////////////////////////////////////////////// // Enumerate the rows //////////////////////////////////////////////////////// sAttrList.RemoveAll(); ///////////////////////////////////////////////////////// // Retrieve the column names returned from the server /////////////////////////////////////////////////////////// LPWSTR pszColumn; hr = m_pSearch->GetFirstRow( hSearch ); if ( !SUCCEEDED(hr) ) { return; } idx=0; while( (hr=m_pSearch->GetNextColumnName( hSearch, &pszColumn )) != S_ADS_NOMORE_COLUMNS ) { s = OLE2T( pszColumn ); m_cListView.InsertColumn(idx, s, LVCFMT_LEFT, 150 ); // adding columns to the UI sAttrList.AddTail(s); FreeADsMem( pszColumn ); idx++; } ///////////////////////////////////////////// // Start iterating the result set //////////////////////////////////////////// int nCol; CStringList sValueList; do { nCol=0; pos = sAttrList.GetHeadPosition(); while( pos != NULL ) { s = sAttrList.GetAt(pos); //column name // Get the Name and display it in the list hr = m_pSearch->GetColumn( hSearch, T2OLE(s), &col ); if ( SUCCEEDED(hr) ) { s =_T(""); if ( col.dwADsType != ADSTYPE_INVALID ) // if we request for attrib only, no value will be returned { ADsToStringList(col.pADsValues, col.dwNumValues, sValueList ); StringListToString( sValueList, s ); } if ( nCol ) { m_cListView.SetItemText(0,nCol, s); } else { m_cListView.InsertItem(0, s); } m_pSearch->FreeColumn( &col ); } nCol++; sAttrList.GetNext(pos); } dwCount++; ///////////////////////////// //Display the total so far //////////////////////////////// s.Format("%ld object(s)", dwCount ); SetDlgItemText( IDC_TOTAL, s ); } while( (hr=m_pSearch->GetNextRow( hSearch)) != S_ADS_NOMORE_ROWS ); m_pSearch->CloseSearchHandle( hSearch ); }
BOOL CConfigDisplay::verifySkin(CString skin, BOOL stopOnError) { #ifdef _DEBUGBC return TRUE; #endif //AutoLog alog("CCD::verifySkin"); CStringList bmps; bmps.AddTail(MB_SKIN_DEF); bmps.AddTail(MB_SKIN_ALBUMART); bmps.AddTail(MB_SKIN_BACKGROUNDMAIN); bmps.AddTail(MB_SKIN_BACKGROUNDALBUMART); bmps.AddTail(MB_SKIN_BACKGROUNDLIBRARY); bmps.AddTail(MB_SKIN_BACKGROUNDMAIN); bmps.AddTail(MB_SKIN_BACKGROUNDPLAYLIST); bmps.AddTail(MB_SKIN_BUTTONLOGOOUT); bmps.AddTail(MB_SKIN_BUTTONLOGOHOVER); bmps.AddTail(MB_SKIN_BUTTONLOGOIN); bmps.AddTail(MB_SKIN_BUTTONBACKGROUND); bmps.AddTail(MB_SKIN_BUTTONCLEARHOVER); bmps.AddTail(MB_SKIN_BUTTONCLEARIN); bmps.AddTail(MB_SKIN_BUTTONCLEAROUT); bmps.AddTail(MB_SKIN_BUTTONEXITHOVER); bmps.AddTail(MB_SKIN_BUTTONEXITIN); bmps.AddTail(MB_SKIN_BUTTONEXITOUT); bmps.AddTail(MB_SKIN_BUTTONFASTFORWARDHOVER); bmps.AddTail(MB_SKIN_BUTTONFASTFORWARDIN); bmps.AddTail(MB_SKIN_BUTTONFASTFORWARDOUT); bmps.AddTail(MB_SKIN_BUTTONLOADHOVER); bmps.AddTail(MB_SKIN_BUTTONLOADIN); bmps.AddTail(MB_SKIN_BUTTONLOADOUT); bmps.AddTail(MB_SKIN_BUTTONMAXIMIZEHOVER); bmps.AddTail(MB_SKIN_BUTTONMAXIMIZEIN); bmps.AddTail(MB_SKIN_BUTTONMAXIMIZEOUT); bmps.AddTail(MB_SKIN_BUTTONMINIMIZEHOVER); bmps.AddTail(MB_SKIN_BUTTONMINIMIZEIN); bmps.AddTail(MB_SKIN_BUTTONMINIMIZEOUT); bmps.AddTail(MB_SKIN_BUTTONMENUHOVER); bmps.AddTail(MB_SKIN_BUTTONMENUIN); bmps.AddTail(MB_SKIN_BUTTONMENUOUT); bmps.AddTail(MB_SKIN_BUTTONPAUSEOUT); bmps.AddTail(MB_SKIN_BUTTONPLAYHOVER); bmps.AddTail(MB_SKIN_BUTTONPLAYIN); bmps.AddTail(MB_SKIN_BUTTONPLAYOUT); bmps.AddTail(MB_SKIN_BUTTONPROGRESSBACKGROUND); bmps.AddTail(MB_SKIN_BUTTONPROGRESSKNOB); bmps.AddTail(MB_SKIN_BUTTONRANDOMHOVER); bmps.AddTail(MB_SKIN_BUTTONRANDOMIN); bmps.AddTail(MB_SKIN_BUTTONRANDOMOUT); bmps.AddTail(MB_SKIN_BUTTONRESIZEHOVER); bmps.AddTail(MB_SKIN_BUTTONRESIZEIN); bmps.AddTail(MB_SKIN_BUTTONRESIZEOUT); bmps.AddTail(MB_SKIN_BUTTONRESTOREHOVER); bmps.AddTail(MB_SKIN_BUTTONRESTOREIN); bmps.AddTail(MB_SKIN_BUTTONRESTOREOUT); bmps.AddTail(MB_SKIN_BUTTONREVERSEHOVER); bmps.AddTail(MB_SKIN_BUTTONREVERSEIN); bmps.AddTail(MB_SKIN_BUTTONREVERSEOUT); bmps.AddTail(MB_SKIN_BUTTONSAVEHOVER); bmps.AddTail(MB_SKIN_BUTTONSAVEIN); bmps.AddTail(MB_SKIN_BUTTONSAVEOUT); bmps.AddTail(MB_SKIN_BUTTONSHUFFLEHOVER); bmps.AddTail(MB_SKIN_BUTTONSHUFFLEIN); bmps.AddTail(MB_SKIN_BUTTONSHUFFLEOUT); bmps.AddTail(MB_SKIN_BUTTONSTOPHOVER); bmps.AddTail(MB_SKIN_BUTTONSTOPIN); bmps.AddTail(MB_SKIN_BUTTONSTOPOUT); bmps.AddTail(MB_SKIN_BUTTONVOLUMEBACKGROUND); bmps.AddTail(MB_SKIN_BUTTONVOLUMEKNOB); bmps.AddTail(MB_SKIN_SCROLLBACKGROUND); bmps.AddTail(MB_SKIN_SCROLLBUTTON); bmps.AddTail(MB_SKIN_SCROLLDOWNARROW); bmps.AddTail(MB_SKIN_SCROLLUPARROW); POSITION pos; CString name,msg,bmp; for(pos = bmps.GetHeadPosition(); pos != NULL; ) { name = bmps.GetAt(pos); bmp = getSkin(skin, name); if (bmp == "") { if (msg.GetLength()) msg += "\r\n"; msg += name; } bmps.GetNext(pos); } CString tmp ; if (msg != "") { tmp = "The following bitmaps are missing from the\r\n"; tmp += skin; tmp += " skin.\r\n"; tmp += msg + "\r\n"; msg = tmp; } // Verify SkinDef's m_SkinDefKeyVals.RemoveAll(); loadSkinDefs(); CString skindef = getSkin(skin, MB_SKIN_DEF); RegistryKey regSD(skindef); regSD.ReadFile(); tmp = ""; if (checkSkinDef(regSD, tmp) != TRUE) { msg += "Problems with " + skindef + "\r\n"; msg += tmp; msg += "Either reinstall Muzikbrowzer or fix the skin."; } // read skin def custom CString skindefcustom = getSkin(skin, MB_SKIN_DEF_CUSTOM); RegistryKey regSDCustom(skindefcustom); regSDCustom.ReadFile(); tmp = ""; if (checkSkinDef(regSDCustom, tmp) != TRUE) { msg += "Problems with " + skindefcustom + "\r\n"; msg += "Go into Settings/Display and click Ok.\r\n"; msg += tmp; } CString key,val; tmp = ""; for( pos = m_SkinDefKeyVals.GetStartPosition(); pos != NULL; ) { m_SkinDefKeyVals.GetNextAssoc(pos, key, val); tmp += key + "\r\n"; } if (tmp.GetLength()) { msg += "Missing " + skin + " SkinDef parameters:\r\n"; msg += tmp; } if (msg.GetLength()) { logger.log(msg); if (stopOnError) { MBMessageBox("Bad skin", msg,FALSE,FALSE); } return FALSE; } return TRUE; }
BOOL ModifyIDThree::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_Year.EnableWindow(FALSE); m_Track.EnableWindow(FALSE); m_Title.EnableWindow(FALSE); m_Genre.EnableWindow(FALSE); m_Artist.EnableWindow(FALSE); m_Album.EnableWindow(FALSE); // CString genre = id3_GetGenre(mID3_Tag); CString oldgenre = m_Song->getId3(CS("TCON")); oldgenre = Genre_normalize((LPCTSTR)oldgenre); CString oldartist = m_Song->getId3(CS("TPE1")); CString oldalbum = m_Song->getId3(CS("TALB")); CString oldtitle = m_Song->getId3(CS("TIT2")); CString oldtrack = m_Song->getId3(CS("TRCK")); CString oldyear = m_Song->getId3(CS("TYER")); CString file = m_Song->getId3("FILE"); m_File.SetWindowText(file); CString newgenre, newartist, newalbum, newtitle, newtrack, newyear; newgenre = oldgenre; newartist = oldartist; newalbum = oldalbum; newtitle = oldtitle; newtrack = oldtrack; newyear = oldyear; // oldgenre = "\"" + oldgenre + "\""; // oldartist = "\"" + oldartist + "\""; // oldalbum = "\"" + oldalbum + "\""; // oldtitle = "\"" + oldtitle + "\""; // oldtrack = "\"" + oldtrack + "\""; // oldyear = "\"" + oldyear + "\""; if (MBALL == newartist) { newartist = ""; } if (MBALL == newalbum) { newalbum = ""; } if (MBALL == newgenre) { newgenre = ""; } m_OldGenre.SetWindowText(oldgenre); int pos; CString tmpGenre; for (pos = 0 ; pos < mGenreList->GetSize(); pos++) { tmpGenre = mGenreList->GetAt(pos); m_Genre.AddString(tmpGenre); } m_Genre.SelectString(0, newgenre ); int x = m_Genre.GetCount(); if (mWindowFlag >= 1 /*&& genre != MBALL */) { m_Genre.EnableWindow(TRUE); } if (mWindowFlag >= 2) { m_Artist.EnableWindow(TRUE); m_Artist.SetWindowText(newartist); m_OldArtist.SetWindowText(oldartist); // if (artist == MBALL) // m_Artist.EnableWindow(FALSE); } if (mWindowFlag >= 3) { m_Album.EnableWindow(TRUE); m_Year.EnableWindow(TRUE); m_Album.SetWindowText(newalbum); m_OldAlbum.SetWindowText(oldalbum); m_Year.SetWindowText(newyear); m_OldYear.SetWindowText(oldyear); // if (album == MBALL) { // m_Album.EnableWindow(FALSE); // } } m_TagData.ShowWindow(FALSE); m_File.ShowWindow(FALSE); if (mWindowFlag >= 4) { m_Title.EnableWindow(TRUE); m_Track.EnableWindow(TRUE); m_Title.SetWindowText(newtitle); m_OldTitle.SetWindowText(oldtitle); m_Track.SetWindowText(newtrack); m_OldTrack.SetWindowText(oldtrack); m_TagData.ShowWindow(TRUE); m_File.ShowWindow(TRUE); MBTag tag; CStringList list; tag.getInfo(file,list); for(POSITION pos = list.GetHeadPosition();pos!=NULL;list.GetNext(pos)) { m_TagData.AddString(list.GetAt(pos)); } m_OldValsLabel.SetWindowText("Old value"); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
/*************************************************** StartDropList This internal function is used to parse out the label string, which contains the items to show in the list. Also this function will show the list box in the proper location on the screen. Params: <none> Return: UG_ERROR - the list is already visible. UG_SUCCESS - everything went smoothly, the drop list was shown ***************************************************/ int CUGDropListType::StartDropList() { RECT rect; RECT clientRect; int dif,len,pos,startpos; CFont * font = NULL; LOGFONT lf; CFont * cfont; CStringList list; //lists of strings for the list are assembed here CString * items; //points to the string used to assemble the list //return false if it is already up if( m_listBox->m_HasFocus) return UG_ERROR; CUGCell cell; m_ctrl->GetCellIndirect(m_btnCol,m_btnRow,&cell); // make sure that the read only cells do not show droplist if ( cell.GetReadOnly() == TRUE ) return UG_SUCCESS; //get the current row and col m_btnCol = m_ctrl->GetCurrentCol(); m_btnRow = m_ctrl->GetCurrentRow(); //add the strings to the CStringList CString string; cell.GetLabelText(&string); items = &string; len = items->GetLength(); pos =0; startpos =0; while(pos <len){ if(items->GetAt(pos)== _T('\n')){ list.AddTail(items->Mid(startpos,pos-startpos)); startpos = pos+1; } pos++; } //notify the user of the list, so it can be modified if needed if ( OnCellTypeNotify(m_ID,m_btnCol,m_btnRow,UGCT_DROPLISTSTART,(LONG_PTR)&list) == FALSE ) // if FALSE was returned from OnCellTypeNotify call, than the developer does not // wish to show the drop list at the moment. return UG_ERROR; // set default font height lf.lfHeight = 12; //get the font if(cell.IsPropertySet(UGCELL_FONT_SET)) font = cell.GetFont(); else if(m_ctrl->m_GI->m_defFont != NULL) font = m_ctrl->m_GI->m_defFont; if(font == NULL) font = CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FONT)); if(font != NULL) { //find the height of the font cfont = font; cfont->GetLogFont(&lf); // lf.lfHeight if( lf.lfHeight < 0 ){ HDC hDC = CreateCompatibleDC(NULL); lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hDC, LOGPIXELSY), 72); DeleteDC(hDC); } } //get the rectangle for the listbox m_ctrl->GetCellRect(m_btnCol,m_btnRow,&rect); rect.top = rect.bottom; rect.left+=10; rect.right+=10; len = (int)list.GetCount(); if(len >15) len = 15; rect.bottom += lf.lfHeight * len + 6; m_ctrl->m_CUGGrid->GetClientRect(&clientRect); if(rect.bottom > clientRect.bottom){ dif = rect.bottom - clientRect.bottom; rect.bottom -= dif; rect.top -= dif; if(rect.top <0) rect.top = 0; } if(rect.right > clientRect.right){ dif = rect.right - clientRect.right; rect.right -= dif; rect.left -= dif; if(rect.left <0) rect.left = 0; } //create the CListBox m_listBox->m_ctrl = m_ctrl; m_listBox->m_cellType = this; m_listBox->m_cellTypeId = m_ID; m_listBox->Create(WS_CHILD|WS_BORDER|WS_VSCROLL,rect,m_ctrl->m_CUGGrid,123); //set up the font if(font != NULL) m_listBox->SetFont(font); // v7.2 - update 03 - this works to eliminate blank lines that // can occur with odd sized fonts/number of items. Fix courtesy Gerbrand // .start int itHeight = m_listBox->GetItemHeight(0); if (len > 15) len = 15; rect.bottom = rect.top + len * itHeight + 6; if(rect.bottom > clientRect.bottom){ dif = rect.bottom - clientRect.bottom; rect.bottom -= dif; rect.top -= dif; if(rect.top <0) rect.top = 0; } // v7.2 - update 03 - Adjust the rect width to accomodate the largest string // Allen Shiels dif = GetMaxStringWidth(list) - (rect.right-rect.left); if (dif > 0) { if (len >= 15) // add a scroll bar width if max items in list dif += GetSystemMetrics(SM_CXVSCROLL); rect.right += dif; } if(rect.right > clientRect.right){ dif = rect.right - clientRect.right; rect.right -= dif; rect.left -= dif; if(rect.left <0) rect.left = 0; } // .end //resize the window again since a new font is being used m_listBox->MoveWindow(&rect,FALSE); //add the items to the list len = (int)list.GetCount(); POSITION position = list.GetHeadPosition(); pos =0; while(pos < len){ m_listBox->AddString(list.GetAt(position)); pos++; if(pos < len) list.GetNext(position); } //give the list box pointers to the cell m_listBox->m_col = &m_btnCol; m_listBox->m_row = &m_btnRow; m_listBox->ShowWindow(SW_SHOW); m_listBox->SetFocus(); m_btnDown = FALSE; m_ctrl->RedrawCell(m_btnCol,m_btnRow); return UG_SUCCESS; }
qboolean Eclass_hasModel(eclass_t *e, vec3_t &vMin, vec3_t &vMax) { if (e->modelpath != NULL) { if (e->model == NULL) { e->model = reinterpret_cast<entitymodel_t*>(qmalloc(sizeof(entitymodel_t))); } char *pModelBuff = strdup(e->modelpath); char *pSkinBuff = NULL; if (e->skinpath) { pSkinBuff = strdup(e->skinpath); } CStringList Models; CStringList Skins; char* pToken = strtok(pModelBuff, ";\0"); while (pToken != NULL) { Models.AddTail(pToken); pToken = strtok(NULL, ";\0"); } if (pSkinBuff != NULL) { pToken = strtok(pSkinBuff, ";\0"); while (pToken != NULL) { Skins.AddTail(pToken); pToken = strtok(NULL, ";\0"); } } entitymodel *model = e->model; int i = 0; for (; i < Models.GetCount(); i++) { char *pSkin = NULL; if (i < Skins.GetCount()) { pSkin = Skins.GetAt(Skins.FindIndex(i)).GetBuffer(0); } LoadModel(Models.GetAt(Models.FindIndex(i)), e, vMin, vMax, model, pSkin); model->pNext = reinterpret_cast<entitymodel_t*>(qmalloc(sizeof(entitymodel_t))); model = model->pNext; } // at this poitn vMin and vMax contain the min max of the model // which needs to be centered at origin 0, 0, 0 VectorSnap(vMin); VectorSnap(vMax); if (vMax[0] - vMin[0] < 2) { vMin[0] -= 1; vMax[0] += 1; } if (vMin[1] - vMax[1] < 2) { vMin[1] -= 1; vMax[1] += 1; } if (vMax[2] - vMin[2] < 2) { vMax[2] -= 1; vMax[2] += 1; } vec3_t vTemp; VectorAdd(vMin, vMax, vTemp); VectorScale(vTemp, 0.5, vTemp); model = e->model; while (model != NULL) { for (i = 0; i < model->nTriCount; i++) { for (int j = 0; j < 3; j++) { ;//VectorSubtract(model->pTriList[i].v[j], vTemp, model->pTriList[i].v[j]); } } model = model->pNext; } free(pModelBuff); free(e->modelpath); e->modelpath = NULL; if(e->skinpath) { free(e->skinpath); e->skinpath = NULL; free(pSkinBuff); } } return (e->model != NULL && e->model->nTriCount > 0); }
void CDlgIDirectoryObject::OnGet() { CStringList sList; UINT nCount; HRESULT hr; UpdateData(TRUE); StringToStringList(m_sAttributes, sList ); nCount = sList.GetCount(); if ( nCount == 0 ) { return; } /////////////////////////////////////// // Now build the Attribute Names List /////////////////////////////////////// POSITION pos; DWORD dwNumAttr; LPWSTR *pAttrNames=NULL; ADS_ATTR_INFO *pAttrInfo; DWORD dwReturn; USES_CONVERSION; pAttrNames = (LPWSTR*) AllocADsMem( sizeof(LPWSTR) * nCount ); pos = sList.GetHeadPosition(); dwNumAttr = 0; while( pos != NULL ) { pAttrNames[dwNumAttr] = T2OLE(sList.GetAt(pos)); dwNumAttr++; sList.GetNext(pos); } ///////////////////////////////////////// // Get attributes value requested // Note: The order is not necessarily the same as // requested via pAttrNames. /////////////////////////////////////////// hr = m_pDirObject->GetObjectAttributes( pAttrNames, dwNumAttr, &pAttrInfo, &dwReturn ); if ( SUCCEEDED(hr) ) { DWORD idx; CString sDisplay; CStringList sValueList; UINT nCount; POSITION pos; m_cValueList.ResetContent(); for( idx=0; idx < dwReturn; idx++) { ADsToStringList( pAttrInfo[idx].pADsValues, pAttrInfo[idx].dwNumValues, sValueList ); sDisplay = OLE2T(pAttrInfo[idx].pszAttrName); sDisplay += _T(":"); m_cValueList.AddString( sDisplay ); nCount = sValueList.GetCount(); if ( nCount == 0 ) // can not find/convert the value { m_cValueList.AddString(_T(" > [No Value]")); continue; } else { pos = sValueList.GetHeadPosition(); while( pos != NULL ) { sDisplay = _T(" > "); sDisplay += sValueList.GetAt(pos); m_cValueList.AddString( sDisplay ); sValueList.GetNext(pos); } } } sValueList.RemoveAll(); } /////////////////////////////////////////////////////////// // Use FreADsMem for all memory obtained from ADSI call ///////////////////////////////////////////////////////////// FreeADsMem( pAttrInfo ); FreeADsMem( pAttrNames ); }