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_Enable (HWND hDlg) { BOOL fEnable = TRUE; TCHAR szText[ cchRESOURCE ]; GetDlgItemText (hDlg, IDC_CELL, szText, cchRESOURCE); if (!szText[0]) fEnable = FALSE; if (!FastList_FindFirst (GetDlgItem (hDlg, IDC_LIST))) fEnable = FALSE; EnableWindow (GetDlgItem (GetParent (hDlg), IDOK), fEnable); }
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); } } }
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(); }