void HostsTab_OnRemove (HWND hDlg) { HWND hList = GetDlgItem (hDlg, IDC_LIST); HLISTITEM hItem = FastList_FindFirstSelected (hList); HLISTITEM hNext = FastList_FindNextSelected (hList, hItem); if (!hItem) { return; } else if (hNext) { if (Message (MB_ICONEXCLAMATION | MB_OKCANCEL, GetCautionTitle(), IDS_HOSTREM_MANY) != IDOK) return; } else // (!hNext) { PCELLDBLINE pLine = (PCELLDBLINE)FastList_GetItemParam (hList, hItem); CELLDBLINEINFO Info; CSDB_CrackLine (&Info, pLine->szLine); if (Message (MB_ICONEXCLAMATION | MB_OKCANCEL, GetCautionTitle(), IDS_HOSTREM_ONE, TEXT("%s"), Info.szCell) != IDOK) return; } for ( ; hItem; hItem = FastList_FindNextSelected (hList, hItem)) { PCELLDBLINE pLine = (PCELLDBLINE)FastList_GetItemParam (hList, hItem); CSDB_RemoveCell (&g.Configuration.CellServDB, pLine); } HostsTab_FillList (hDlg); HostsTab_OnSelect (hDlg); }
void Aggregates_ShowPopupMenu (HWND hList, POINT ptList, POINT ptScreen) { if (!ptScreen.x && !ptScreen.y) { RECT rWindow; GetWindowRect (hList, &rWindow); ptScreen.x = rWindow.left + (rWindow.right -rWindow.left)/2; ptScreen.y = rWindow.top + (rWindow.bottom -rWindow.top)/2; Aggregates_ShowParticularPopupMenu (hList, ptScreen, NULL); } else if (FL_HitTestForHeaderBar (hList, ptList)) { HMENU hm = TaLocale_LoadMenu (MENU_COLUMNS); DisplayContextMenu (hm, ptScreen, hList); } else { LPIDENT lpiSelected = NULL; HLISTITEM hItem; if ((hItem = FastList_ItemFromPoint (hList, &ptList, TRUE)) != NULL) lpiSelected = (LPIDENT)FastList_GetItemParam (hList, hItem); if (lpiSelected && (lpiSelected != (LPIDENT)FL_GetSelectedData (hList))) lpiSelected = NULL; if (lpiSelected && lpiSelected->fIsServer()) Server_ShowParticularPopupMenu (hList, ptScreen, lpiSelected); else Aggregates_ShowParticularPopupMenu (hList, ptScreen, lpiSelected); } }
LPASIDLIST Display_GetSelectedList (void) { LPASIDLIST pAsidList = NULL; HWND hDlg = GetTabChild (GetDlgItem (g.hMain, IDC_TAB)); HWND hList = GetDlgItem (hDlg, IDC_GROUPS_LIST); if (!IsWindow (hList)) hList = GetDlgItem (hDlg, IDC_USERS_LIST); if (!IsWindow (hList)) hList = GetDlgItem (hDlg, IDC_MACHINES_LIST); if (IsWindow (hList)) { if (asc_AsidListCreate (&pAsidList)) { for (HLISTITEM hItem = FastList_FindFirstSelected (hList); hItem != NULL; hItem = FastList_FindNextSelected (hList, hItem)) { ASID idObject = (ASID)FastList_GetItemParam (hList, hItem); if (idObject) asc_AsidListAddEntry (&pAsidList, idObject, 0); } } } return pAsidList; }
static void OnListSelection(LPFLN_ITEMSELECT_PARAMS pItemParms) { ASSERT(pItemParms); hSelectedItem = 0; if (pItemParms->hItem) { LPARAM lParam = FastList_GetItemParam(hDriveList, pItemParms->hItem); if (lParam == 0) { hSelectedItem = pItemParms->hItem; if (bAutoSetPartitionName) { LPCTSTR pDrive = FastList_GetItemText(hDriveList, hSelectedItem, 0); g_CfgData.szPartitionName[0] = _totlower(pDrive[0]); g_CfgData.szPartitionName[1] = 0; SetWndText(hDlg, IDC_PARTITION_NAME, g_CfgData.szPartitionName); // Must set this to true because the call to SetWndText will cause // a call to OnPartitionName, which would incorrectly think that the // Partition Name had been set by the user rather than by us, thus // setting bAutoSetPartitionName to false. bAutoSetPartitionName = TRUE; } } } CheckEnableButtons(); }
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_OnRemove (HWND hDlg) { HWND hList = GetDlgItem (hDlg, IDC_LIST); FastList_Begin (hList); HLISTITEM hItem; while ((hItem = FastList_FindFirstSelected (hList)) != NULL) { PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem); Delete (pInfo); FastList_RemoveItem (hList, hItem); } FastList_End (hList); }
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 CellEdit_OnEdit (HWND hDlg) { HWND hList = GetDlgItem (hDlg, IDC_LIST); HLISTITEM hItem = FastList_FindFirstSelected (hList); PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem); CELLDBLINE Line; memcpy (&Line, pInfo, sizeof(CELLDBLINE)); if (ModalDialogParam (IDD_SERVER_EDIT, hDlg, (DLGPROC)ServerEdit_DlgProc, (LPARAM)&Line) == IDOK) { CELLDBLINEINFO Info; CSDB_CrackLine (&Info, Line.szLine); TCHAR szServer[ cchRESOURCE ]; lstrcpy (szServer, inet_ntoa (*(struct in_addr *)&Info.ipServer)); FastList_SetItemText (hList, hItem, 0, Info.szComment); FastList_SetItemText (hList, hItem, 1, szServer); lstrcpy (pInfo->szLine, Line.szLine); } }
void HostsTab_OnEdit (HWND hDlg) { HWND hList = GetDlgItem (hDlg, IDC_LIST); HLISTITEM hItem = FastList_FindFirstSelected (hList); if (hItem) { PCELLDBLINE pLine = (PCELLDBLINE)FastList_GetItemParam (hList, hItem); CELLDBLINEINFO Info; CSDB_CrackLine (&Info, pLine->szLine); LPTSTR pszTitle = FormatString (IDS_CELLEDIT_TITLE, TEXT("%s"), ((Info.szComment[0]) ? Info.szComment : Info.szCell)); LPPROPSHEET psh = PropSheet_Create (pszTitle, FALSE, GetParent(hDlg), (LPARAM)pLine); psh->sh.dwFlags |= PSH_NOAPPLYNOW; // Remove the Apply button psh->sh.dwFlags |= PSH_HASHELP; // Add a Help button instead PropSheet_AddTab (psh, ((Info.szComment[0]) ? Info.szComment : Info.szCell), IDD_CELL_EDIT, (DLGPROC)CellEdit_DlgProc, (LPARAM)pLine, TRUE); PropSheet_ShowModal (psh); FreeString (pszTitle); } HostsTab_FillList (hDlg); HostsTab_OnSelect (hDlg); }
BOOL CALLBACK Filesets_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) { if (HandleColumnNotify (hDlg, msg, wp, lp, &gr.viewSet)) return FALSE; switch (msg) { case WM_INITDIALOG: { RECT rTab; GetClientRect (GetParent(hDlg), &rTab); TabCtrl_AdjustRect (GetParent (hDlg), FALSE, &rTab); ResizeWindow (hDlg, awdFilesets, rwaMoveToHere, &rTab); FL_RestoreView (GetDlgItem (hDlg, IDC_SET_LIST), &gr.viewSet); FastList_SetTextCallback (GetDlgItem (hDlg, IDC_SET_LIST), GetItemText, &gr.viewSet); Filesets_SubclassList (hDlg); Filesets_OnView (hDlg); Filesets_OnSelect (hDlg); } break; case WM_HELP: WinHelp (hDlg, cszHELPFILENAME, HELP_FINDER, 0); break; case WM_DESTROY: FL_StoreView (GetDlgItem (hDlg, IDC_SET_LIST), &gr.viewSet); DontNotifyMeEver (hDlg); break; case WM_SIZE: // if (lp==0), we're minimizing--don't call ResizeWindow(). // if (lp != 0) ResizeWindow (hDlg, awdFilesets, rwaFixupGuts); break; case WM_CONTEXTMENU: { POINT ptScreen; POINT ptClient; ptScreen.x = LOWORD(lp); ptScreen.y = HIWORD(lp); ptClient = ptScreen; ScreenToClient ((HWND)wp, &ptClient); if ((HWND)wp == GetDlgItem (hDlg, IDC_SET_LIST)) Filesets_ShowPopupMenu ((HWND)wp, ptClient, ptScreen); } break; case WM_SERVER_CHANGED: { LPIDENT lpiServer = Server_GetServerForChild (hDlg); DontNotifyMeEver (hDlg); NotifyMe (WHEN_OBJECT_CHANGES, NULL, hDlg, 0); // Fix the text at the top of the Aggregates tab: // TCHAR szName[ cchRESOURCE ]; LPTSTR pszText; if (lpiServer != NULL) { LPSERVER_PREF lpsp = (LPSERVER_PREF)lpiServer->GetUserParam(); lpiServer->GetServerName (szName); if (lpsp && !lpsp->fIsMonitored) pszText = FormatString (IDS_FILESET_UNMON, TEXT("%s"), szName); else pszText = FormatString (IDS_FILESETS_IN_SERVER, TEXT("%s"), szName); } else if (g.lpiCell != NULL) { g.lpiCell->GetCellName (szName); if (g.sub) pszText = FormatString (IDS_FILESET_SOME, TEXT("%s"), szName); else pszText = FormatString (IDS_FILESETS_IN_CELL, TEXT("%s"), szName); } else { pszText = FormatString (IDS_FILESETS_IN_NOTHING); } SetDlgItemText (hDlg, IDC_SET_DESC, pszText); FreeString (pszText); UpdateDisplay_Filesets (FALSE, GetDlgItem (hDlg, IDC_SET_LIST), NULL, 0, NULL, NULL, NULL); } break; case WM_NOTIFY_FROM_DISPATCH: Filesets_OnNotifyFromDispatch ((LPNOTIFYSTRUCT)lp); Delete ((LPNOTIFYSTRUCT)lp); break; case WM_COMMAND: switch (LOWORD(wp)) { case IDC_SET_CREATE: SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_CREATE, 0); break; case IDC_SET_DELETE: SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_DELETE, 0); break; case IDC_SET_REP: SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_REPLICATION, 0); break; case IDC_SET_SETQUOTA: SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_SETQUOTA, 0); break; } break; case WM_MOUSEMOVE: Filesets_ContinueDrag (hDlg); break; case WM_LBUTTONDOWN: if (l.fDragging && l.fRightBtn) Filesets_FinishDrag (hDlg, FALSE, FALSE); break; case WM_RBUTTONDOWN: if (l.fDragging && !l.fRightBtn) Filesets_FinishDrag (hDlg, FALSE, FALSE); break; case WM_LBUTTONUP: if (l.fDragging && !l.fRightBtn) Filesets_FinishDrag (hDlg, TRUE, FALSE); break; case WM_RBUTTONUP: if (l.fDragging && l.fRightBtn) Filesets_FinishDrag (hDlg, TRUE, TRUE); break; case WM_ENDTASK: LPTASKPACKET ptp; if ((ptp = (LPTASKPACKET)lp) != NULL) { if (ptp->idTask == taskSET_SELECT) Filesets_OnEndTask_Select (hDlg, ptp); else if (ptp->idTask == taskSET_BEGINDRAG) Filesets_OnEndTask_BeginDrag (hDlg, ptp); else if (ptp->idTask == taskSET_DRAGMENU) Filesets_OnEndTask_DragMenu (hDlg, ptp); else if (ptp->idTask == taskSET_MENU) Filesets_OnEndTask_Menu (hDlg, ptp); FreeTaskPacket (ptp); } break; case WM_NOTIFY: switch (((LPNMHDR)lp)->code) { case FLN_ITEMSELECT: if (((LPNMHDR)lp)->hwndFrom == GetDlgItem (hDlg, IDC_SET_LIST)) { Filesets_OnSelect (hDlg); } break; case FLN_ITEMEXPAND: if (((LPNMHDR)lp)->hwndFrom == GetDlgItem (hDlg, IDC_SET_LIST)) { HLISTITEM hItem = ((LPFLN_ITEMEXPAND_PARAMS)lp)->hItem; LPIDENT lpi = (LPIDENT)FastList_GetItemParam (GetDlgItem (hDlg, IDC_SET_LIST), hItem); BOOL fExpanded = ((LPFLN_ITEMEXPAND_PARAMS)lp)->fExpanded; if (lpi && lpi->fIsServer()) { LPSERVER_PREF lpsp; if ((lpsp = (LPSERVER_PREF)lpi->GetUserParam()) != NULL) { lpsp->fExpandTree = fExpanded; Server_SavePreferences (lpi); } } else if (lpi && lpi->fIsAggregate()) { LPAGGREGATE_PREF lpap; if ((lpap = (LPAGGREGATE_PREF)lpi->GetUserParam()) != NULL) { lpap->fExpandTree = fExpanded; Aggregates_SavePreferences (lpi); } } } break; case FLN_BEGINDRAG: return Filesets_BeginDrag (hDlg, ((LPFLN_DRAG_PARAMS)lp)->fRightButton); case FLN_LDBLCLICK: if (((LPNMHDR)lp)->hwndFrom == GetDlgItem (hDlg, IDC_SET_LIST)) { BOOL fShowProperties = TRUE; HLISTITEM hItem; if ((hItem = FastList_GetFocus (GetDlgItem (hDlg, IDC_SET_LIST))) != NULL) { if (FastList_FindFirstChild (GetDlgItem (hDlg, IDC_SET_LIST), hItem)) fShowProperties = FALSE; } LPIDENT lpi = Filesets_GetFocused (hDlg); if (lpi && !lpi->fIsCell() && fShowProperties) { PostMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_PROPERTIES, 0); return TRUE; } } break; } break; } return FALSE; }
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(); }