void CellEdit_OnDestroy (HWND hDlg) { HWND hList = GetDlgItem (hDlg, IDC_LIST); for (HLISTITEM hItem = FastList_FindFirst (hList); hItem; hItem = FastList_FindNext (hList, hItem)) { PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem); Delete (pInfo); } }
void CellEdit_OnAdd (HWND hDlg) { CELLDBLINE Line; memset (&Line, 0x00, sizeof(CELLDBLINE)); int iOrder = 0; HWND hList = GetDlgItem (hDlg, IDC_LIST); for (HLISTITEM hItem = FastList_FindFirst (hList); hItem; hItem = FastList_FindNext (hList, hItem)) { PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem); iOrder = max (iOrder, 1+ (int)(pInfo->pNext)); } if (ModalDialogParam (IDD_SERVER_EDIT, hDlg, (DLGPROC)ServerEdit_DlgProc, (LPARAM)&Line) == IDOK) { CellEdit_AddServerEntry (hDlg, &Line, iOrder); } }
void CellEdit_OnApply (HWND hDlg) { TCHAR szCell[ cchCELLDBLINE ]; GetDlgItemText (hDlg, IDC_CELL, szCell, cchCELLDBLINE); TCHAR szComment[ cchCELLDBLINE ]; GetDlgItemText (hDlg, IDC_COMMENT, szComment, cchCELLDBLINE); TCHAR szLinkedCell[ cchCELLDBLINE ] = TEXT(""); // Find out if there's already an entry in CellServDB for this cell // PCELLDBLINE pCellLine; if ((pCellLine = CSDB_FindCell (&g.Configuration.CellServDB, szCell)) != NULL) { CELLDBLINEINFO Info; if (CSDB_CrackLine (&Info, pCellLine->szLine)) lstrcpy (szLinkedCell, Info.szLinkedCell); } // Replace our cell's entry in CellServDB, or add one if necessary. // if ((pCellLine = CSDB_AddCell (&g.Configuration.CellServDB, szCell, szLinkedCell, szComment)) != NULL) { // Remove the old servers from this cell // CSDB_RemoveCellServers (&g.Configuration.CellServDB, pCellLine); // Add the servers from our list to the CellServDB // PCELLDBLINE pAppendTo = pCellLine; HWND hList = GetDlgItem (hDlg, IDC_LIST); for (HLISTITEM hItem = FastList_FindFirst (hList); hItem; hItem = FastList_FindNext (hList, hItem)) { PCELLDBLINE pFromList = (PCELLDBLINE)FastList_GetItemParam (hList, hItem); pAppendTo = CSDB_AddLine (&g.Configuration.CellServDB, pAppendTo, pFromList->szLine); } } }
static void ShowPartitionInfo() { // The SetWndText call below will mess up our bAutoSetPartitionName variable. // It will trigger the change event on the partition name field causing our // OnPartitionName function to get called, and making it look to us like the // user set the partition name. Therefore, we will save the current value, // make the call, then restore the value. BOOL bAutoSet = bAutoSetPartitionName; SetWndText(hDlg, IDC_PARTITION_NAME, g_CfgData.szPartitionName); bAutoSetPartitionName = bAutoSet; if (g_CfgData.chDeviceName != 0) { HLISTITEM hItem = NULL; while ((hItem = FastList_FindNext(hDriveList, hItem)) != NULL) { LPCTSTR pDrive = FastList_GetItemText(hDriveList, hItem, 0); if (pDrive[0] == g_CfgData.chDeviceName) { FastList_SelectItem(hDriveList, hItem, TRUE); hSelectedItem = hItem; break; } } } }
void Display_RefreshView (LPVIEWINFO pviNew, ICONVIEW ivNew) { // Find the current VIEWINFO and ICONVIEW settings // HWND hDlg = GetTabChild (GetDlgItem (g.hMain, IDC_TAB)); HWND hList; LPVIEWINFO pviOld; ICONVIEW *pivOld; switch (Display_GetActiveTab()) { case ttUSERS: pivOld = &gr.ivUsr; pviOld = &gr.viewUsr; hList = GetDlgItem (hDlg, IDC_USERS_LIST); break; case ttGROUPS: pivOld = &gr.ivGrp; pviOld = &gr.viewGrp; hList = GetDlgItem (hDlg, IDC_GROUPS_LIST); break; case ttMACHINES: pivOld = &gr.ivMch; pviOld = &gr.viewMch; hList = GetDlgItem (hDlg, IDC_MACHINES_LIST); break; } if (IsWindow(hList)) { FastList_Begin (hList); // If the VIEWINFO state has changed, fix it. This will change between // large icons, small icons and details, as well as correct the currently- // displayed columns to match what's in the new VIEWINFO structure. // BOOL fChangedLayouts = FALSE; if (memcmp (pviOld, pviNew, sizeof(VIEWINFO))) { FL_RestoreView (hList, pviNew); fChangedLayouts = ((pviOld->lvsView & FLS_VIEW_MASK) != (pviNew->lvsView & FLS_VIEW_MASK)) ? TRUE : FALSE; memcpy (pviOld, pviNew, sizeof(VIEWINFO)); } // If the ICONVIEW state has changed, fix all items to show just // the appropriate icons. We'll also have to do this if we just changed // from details/small/large icons to another layout (that's what // fChangedLayouts indicates) // if ((*pivOld != ivNew) || (fChangedLayouts)) { DWORD dwStyle = GetWindowLong (hList, GWL_STYLE); HLISTITEM hItem = NULL; while ((hItem = FastList_FindNext (hList, hItem)) != NULL) { ASID idObject = (ASID)FastList_GetItemParam (hList, hItem); int iFirstImage; int iSecondImage; if (pviOld == &gr.viewUsr) Display_GetImageIcons (dwStyle, ivNew, idObject, imageUSER, IMAGE_NOIMAGE, &iFirstImage, &iSecondImage); else if (pviOld == &gr.viewGrp) Display_GetImageIcons (dwStyle, ivNew, idObject, imageGROUP, IMAGE_NOIMAGE, &iFirstImage, &iSecondImage); else Display_GetImageIcons (dwStyle, ivNew, idObject, imageSERVER, IMAGE_NOIMAGE, &iFirstImage, &iSecondImage); FastList_SetItemFirstImage (hList, hItem, iFirstImage); FastList_SetItemSecondImage (hList, hItem, iSecondImage); } *pivOld = ivNew; } FastList_End (hList); } }
void Display_OnEndTask_UpdMachines (LPTASKPACKET ptp) { HWND hDlg = GetTabChild (GetDlgItem (g.hMain, IDC_TAB)); HWND hList = GetDlgItem (hDlg, IDC_MACHINES_LIST); if (IsWindow (hList) && !lstrcmpi (TASKDATA(ptp)->szPattern, g.szPatternMachines)) { FastList_Begin (hList); // Update the title above the list to indicate what we're showing // TCHAR szCell[ cchRESOURCE ]; asc_CellNameGet_Fast (g.idClient, g.idCell, szCell); LPTSTR pszTitle = FormatString ((TASKDATA(ptp)->szPattern[0]) ? IDS_MACHINES_PATTERN : IDS_MACHINES_ALL, TEXT("%s"), szCell); SetDlgItemText (hDlg, IDC_MACHINES_TITLE, pszTitle); FreeString (pszTitle); // For faster access, we'll want to use a hashlist to deal with // the items in our ASIDLIST (right now it's just a flat array). // This lets us remove duplicates--which is no big deal because // there shouldn't be any anyway--but more importantly it lets // us instantly determine if a particular ASID is in the list // (the asc_AsidListTest function is O(n), and we need O(1)). // LPHASHLIST pAsidList = New (HASHLIST); if (TASKDATA(ptp)->pAsidList) { for (size_t iAsid = 0; iAsid < TASKDATA(ptp)->pAsidList->cEntries; ++iAsid) pAsidList->AddUnique ((PVOID)(TASKDATA(ptp)->pAsidList->aEntries[ iAsid ].idObject)); } // Delete any items which are currently in the FastList but // which aren't in our AsidList. // HLISTITEM hItemNext; for (HLISTITEM hItem = FastList_FindFirst (hList); hItem; hItem = hItemNext) { hItemNext = FastList_FindNext (hList, hItem); ASID idObject = (ASID)FastList_GetItemParam (hList, hItem); if (!pAsidList->fIsInList ((PVOID)idObject)) FastList_RemoveItem (hList, hItem); } // Add items for any entries which are in our AsidList but aren't // currently in the FastList. // DWORD dwStyle = GetWindowLong (hList, GWL_STYLE); for (LPENUM pEnum = pAsidList->FindFirst(); pEnum; pEnum = pEnum->FindNext()) { ASID idObject = (ASID)( pEnum->GetObject() ); HLISTITEM hItem; if ((hItem = FastList_FindItem (hList, (LPARAM)idObject)) == NULL) { FASTLISTADDITEM ai; memset (&ai, 0x00, sizeof(ai)); Display_GetImageIcons (dwStyle, gr.ivMch, idObject, imageSERVER, IMAGE_NOIMAGE, &ai.iFirstImage, &ai.iSecondImage); ai.lParam = (LPARAM)idObject; hItem = FastList_AddItem (hList, &ai); } } Delete (pAsidList); FastList_End (hList); } Display_StopWorking(); }