Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / afssvrmgr / set_tab.cpp
blob69a9d08fe5f47763c200e91dcfcd2b88aacd5b49
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
10 #include <winsock2.h>
11 #include <ws2tcpip.h>
13 extern "C" {
14 #include <afs/param.h>
15 #include <afs/stds.h>
18 #include "svrmgr.h"
19 #include "svr_window.h"
20 #include "svr_general.h"
21 #include "svc_tab.h"
22 #include "agg_tab.h"
23 #include "agg_general.h"
24 #include "set_tab.h"
25 #include "set_general.h"
26 #include "set_move.h"
27 #include "set_repprop.h"
28 #include "set_createrep.h"
29 #include "display.h"
30 #include "columns.h"
31 #include "command.h"
35 * RESIZING WINDOWS ___________________________________________________________
39 rwWindowData awdFilesets[] = {
40 { IDC_SET_DESC, raSizeX, 0, 0 },
41 { IDC_SET_LIST, raSizeX | raSizeY, 0, 0 },
42 { IDC_SET_CREATE, raMoveX | raMoveY, 0, 0 },
43 { IDC_SET_DELETE, raMoveX | raMoveY, 0, 0 },
44 { IDC_SET_REP, raMoveX | raMoveY, 0, 0 },
45 { IDC_SET_SETQUOTA, raMoveX | raMoveY, 0, 0 },
46 { idENDLIST, 0, 0, 0 }
51 * VARIABLES __________________________________________________________________
55 static struct // l
57 BOOL fDragging;
58 BOOL fRightBtn;
59 HIMAGELIST hDragImage;
60 LPIDENT lpiDrag;
61 LPIDENT lpiTarget;
62 HWND hwndTarget;
63 HLISTITEM hItemTarget;
64 } l;
68 * PROTOTYPES _________________________________________________________________
72 void Filesets_OnView (HWND hDlg);
73 void Filesets_OnSelect (HWND hDlg);
74 void Filesets_OnEndTask_Select (HWND hDlg, LPTASKPACKET ptp);
75 void Filesets_OnEndTask_BeginDrag (HWND hDlg, LPTASKPACKET ptp);
76 void Filesets_OnEndTask_DragMenu (HWND hDlg, LPTASKPACKET ptp);
77 void Filesets_OnEndTask_Menu (HWND hDlg, LPTASKPACKET ptp);
79 void Filesets_OnNotifyFromDispatch (LPNOTIFYSTRUCT lpns);
81 LPIDENT IdentifyPoint (HWND hTarget, POINT ptClient, HLISTITEM *phItemTarget);
83 void Filesets_SubclassList (HWND hDlg);
84 void Filesets_Subclass_OnCommand (HWND hList, UINT msg, WPARAM wp, LPARAM lp);
86 BOOL Filesets_BeginDrag (HWND hDlg, BOOL fRightBtn);
87 void Filesets_ContinueDrag (HWND hDlg);
88 void Filesets_FinishDrag (HWND hDlg, BOOL fDropped, BOOL fMenu);
89 void Filesets_CancelDrag (HWND hDlg);
91 void Filesets_ShowPopupMenu (HWND hList, POINT ptList, POINT ptScreen);
95 * ROUTINES ___________________________________________________________________
99 BOOL CALLBACK Filesets_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
101 if (HandleColumnNotify (hDlg, msg, wp, lp, &gr.viewSet))
102 return FALSE;
104 switch (msg)
106 case WM_INITDIALOG:
108 RECT rTab;
109 GetClientRect (GetParent(hDlg), &rTab);
110 TabCtrl_AdjustRect (GetParent (hDlg), FALSE, &rTab);
111 ResizeWindow (hDlg, awdFilesets, rwaMoveToHere, &rTab);
113 FL_RestoreView (GetDlgItem (hDlg, IDC_SET_LIST), &gr.viewSet);
114 FastList_SetTextCallback (GetDlgItem (hDlg, IDC_SET_LIST), GetItemText, &gr.viewSet);
116 Filesets_SubclassList (hDlg);
118 Filesets_OnView (hDlg);
119 Filesets_OnSelect (hDlg);
121 break;
123 case WM_HELP:
124 WinHelp (hDlg, cszHELPFILENAME, HELP_FINDER, 0);
125 break;
127 case WM_DESTROY:
128 FL_StoreView (GetDlgItem (hDlg, IDC_SET_LIST), &gr.viewSet);
129 DontNotifyMeEver (hDlg);
130 break;
132 case WM_SIZE:
133 // if (lp==0), we're minimizing--don't call ResizeWindow().
135 if (lp != 0)
136 ResizeWindow (hDlg, awdFilesets, rwaFixupGuts);
137 break;
139 case WM_CONTEXTMENU:
141 POINT ptScreen;
142 POINT ptClient;
143 ptScreen.x = LOWORD(lp);
144 ptScreen.y = HIWORD(lp);
146 ptClient = ptScreen;
147 ScreenToClient ((HWND)wp, &ptClient);
149 if ((HWND)wp == GetDlgItem (hDlg, IDC_SET_LIST))
150 Filesets_ShowPopupMenu ((HWND)wp, ptClient, ptScreen);
152 break;
154 case WM_SERVER_CHANGED:
156 LPIDENT lpiServer = Server_GetServerForChild (hDlg);
157 DontNotifyMeEver (hDlg);
158 NotifyMe (WHEN_OBJECT_CHANGES, NULL, hDlg, 0);
160 // Fix the text at the top of the Aggregates tab:
162 TCHAR szName[ cchRESOURCE ];
163 LPTSTR pszText;
165 if (lpiServer != NULL)
167 LPSERVER_PREF lpsp = (LPSERVER_PREF)lpiServer->GetUserParam();
168 lpiServer->GetServerName (szName);
169 if (lpsp && !lpsp->fIsMonitored)
170 pszText = FormatString (IDS_FILESET_UNMON, TEXT("%s"), szName);
171 else
172 pszText = FormatString (IDS_FILESETS_IN_SERVER, TEXT("%s"), szName);
174 else if (g.lpiCell != NULL)
176 g.lpiCell->GetCellName (szName);
177 if (g.sub)
178 pszText = FormatString (IDS_FILESET_SOME, TEXT("%s"), szName);
179 else
180 pszText = FormatString (IDS_FILESETS_IN_CELL, TEXT("%s"), szName);
182 else
184 pszText = FormatString (IDS_FILESETS_IN_NOTHING);
187 SetDlgItemText (hDlg, IDC_SET_DESC, pszText);
188 FreeString (pszText);
190 UpdateDisplay_Filesets (FALSE, GetDlgItem (hDlg, IDC_SET_LIST), NULL, 0, NULL, NULL, NULL);
192 break;
194 case WM_NOTIFY_FROM_DISPATCH:
195 Filesets_OnNotifyFromDispatch ((LPNOTIFYSTRUCT)lp);
196 Delete ((LPNOTIFYSTRUCT)lp);
197 break;
199 case WM_COMMAND:
200 switch (LOWORD(wp))
202 case IDC_SET_CREATE:
203 SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_CREATE, 0);
204 break;
206 case IDC_SET_DELETE:
207 SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_DELETE, 0);
208 break;
210 case IDC_SET_REP:
211 SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_REPLICATION, 0);
212 break;
214 case IDC_SET_SETQUOTA:
215 SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_SETQUOTA, 0);
216 break;
218 break;
220 case WM_MOUSEMOVE:
221 Filesets_ContinueDrag (hDlg);
222 break;
224 case WM_LBUTTONDOWN:
225 if (l.fDragging && l.fRightBtn)
226 Filesets_FinishDrag (hDlg, FALSE, FALSE);
227 break;
229 case WM_RBUTTONDOWN:
230 if (l.fDragging && !l.fRightBtn)
231 Filesets_FinishDrag (hDlg, FALSE, FALSE);
232 break;
234 case WM_LBUTTONUP:
235 if (l.fDragging && !l.fRightBtn)
236 Filesets_FinishDrag (hDlg, TRUE, FALSE);
237 break;
239 case WM_RBUTTONUP:
240 if (l.fDragging && l.fRightBtn)
241 Filesets_FinishDrag (hDlg, TRUE, TRUE);
242 break;
244 case WM_ENDTASK:
245 LPTASKPACKET ptp;
246 if ((ptp = (LPTASKPACKET)lp) != NULL)
248 if (ptp->idTask == taskSET_SELECT)
249 Filesets_OnEndTask_Select (hDlg, ptp);
250 else if (ptp->idTask == taskSET_BEGINDRAG)
251 Filesets_OnEndTask_BeginDrag (hDlg, ptp);
252 else if (ptp->idTask == taskSET_DRAGMENU)
253 Filesets_OnEndTask_DragMenu (hDlg, ptp);
254 else if (ptp->idTask == taskSET_MENU)
255 Filesets_OnEndTask_Menu (hDlg, ptp);
256 FreeTaskPacket (ptp);
258 break;
260 case WM_NOTIFY:
261 switch (((LPNMHDR)lp)->code)
263 case FLN_ITEMSELECT:
264 if (((LPNMHDR)lp)->hwndFrom == GetDlgItem (hDlg, IDC_SET_LIST))
266 Filesets_OnSelect (hDlg);
268 break;
270 case FLN_ITEMEXPAND:
271 if (((LPNMHDR)lp)->hwndFrom == GetDlgItem (hDlg, IDC_SET_LIST))
273 HLISTITEM hItem = ((LPFLN_ITEMEXPAND_PARAMS)lp)->hItem;
274 LPIDENT lpi = (LPIDENT)FastList_GetItemParam (GetDlgItem (hDlg, IDC_SET_LIST), hItem);
275 BOOL fExpanded = ((LPFLN_ITEMEXPAND_PARAMS)lp)->fExpanded;
277 if (lpi && lpi->fIsServer())
279 LPSERVER_PREF lpsp;
280 if ((lpsp = (LPSERVER_PREF)lpi->GetUserParam()) != NULL)
282 lpsp->fExpandTree = fExpanded;
283 Server_SavePreferences (lpi);
286 else if (lpi && lpi->fIsAggregate())
288 LPAGGREGATE_PREF lpap;
289 if ((lpap = (LPAGGREGATE_PREF)lpi->GetUserParam()) != NULL)
291 lpap->fExpandTree = fExpanded;
292 Aggregates_SavePreferences (lpi);
296 break;
298 case FLN_BEGINDRAG:
299 return Filesets_BeginDrag (hDlg, ((LPFLN_DRAG_PARAMS)lp)->fRightButton);
301 case FLN_LDBLCLICK:
302 if (((LPNMHDR)lp)->hwndFrom == GetDlgItem (hDlg, IDC_SET_LIST))
304 BOOL fShowProperties = TRUE;
306 HLISTITEM hItem;
307 if ((hItem = FastList_GetFocus (GetDlgItem (hDlg, IDC_SET_LIST))) != NULL)
309 if (FastList_FindFirstChild (GetDlgItem (hDlg, IDC_SET_LIST), hItem))
310 fShowProperties = FALSE;
313 LPIDENT lpi = Filesets_GetFocused (hDlg);
314 if (lpi && !lpi->fIsCell() && fShowProperties)
316 PostMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_PROPERTIES, 0);
317 return TRUE;
320 break;
322 break;
325 return FALSE;
329 void Filesets_OnSelect (HWND hDlg)
331 LPIDENT lpi = Filesets_GetSelected (hDlg);
333 if (!lpi || !lpi->fIsFileset())
335 EnableWindow (GetDlgItem (hDlg, IDC_SET_REP), FALSE);
336 EnableWindow (GetDlgItem (hDlg, IDC_SET_DELETE), FALSE);
337 EnableWindow (GetDlgItem (hDlg, IDC_SET_SETQUOTA), FALSE);
339 else
341 StartTask (taskSET_SELECT, hDlg, lpi);
346 void Filesets_OnEndTask_Select (HWND hDlg, LPTASKPACKET ptp)
348 LPIDENT lpi = (LPIDENT)(ptp->lpUser);
350 if (!ptp->rc)
351 EnableWindow (GetDlgItem (hDlg, IDC_SET_DELETE), FALSE);
352 else
353 EnableWindow (GetDlgItem (hDlg, IDC_SET_DELETE), TRUE);
355 if ((!ptp->rc) || (TASKDATA(ptp)->fs.Type == ftCLONE))
356 EnableWindow (GetDlgItem (hDlg, IDC_SET_REP), FALSE);
357 else
358 EnableWindow (GetDlgItem (hDlg, IDC_SET_REP), TRUE);
360 if ((!ptp->rc) || (TASKDATA(ptp)->fs.Type != ftREADWRITE))
361 EnableWindow (GetDlgItem (hDlg, IDC_SET_SETQUOTA), FALSE);
362 else
363 EnableWindow (GetDlgItem (hDlg, IDC_SET_SETQUOTA), TRUE);
367 void Filesets_OnNotifyFromDispatch (LPNOTIFYSTRUCT lpns)
369 switch (lpns->evt)
371 case evtRefreshFilesetsEnd:
372 case evtRefreshStatusEnd:
373 case evtAlertsChanged:
374 case evtDestroy:
375 if ( (!lpns->Params.lpi1) ||
376 (lpns->Params.lpi1->fIsServer()) ||
377 (lpns->Params.lpi1->fIsAggregate()) ||
378 (lpns->Params.lpi1->fIsFileset()) )
380 UpdateDisplay_Filesets (FALSE, GetDlgItem (lpns->hwndTarget, IDC_SET_LIST), lpns->Params.lpi1, lpns->Params.status, NULL, NULL, NULL);
382 break;
387 static LONG_PTR procFilesetsList = 0;
389 LRESULT CALLBACK Filesets_SubclassListProc (HWND hList, UINT msg, WPARAM wp, LPARAM lp)
391 LRESULT rc;
393 if (procFilesetsList == 0)
394 rc = DefWindowProc (hList, msg, wp, lp);
395 else
396 rc = (LRESULT) CallWindowProc ((WNDPROC)procFilesetsList, hList, msg, wp, lp);
398 switch (msg)
400 case WM_DESTROY:
401 if (procFilesetsList != 0)
402 SetWindowLongPtr (hList, GWLP_WNDPROC, procFilesetsList);
403 break;
405 case WM_COMMAND:
406 Filesets_Subclass_OnCommand (hList, msg, wp, lp);
407 break;
410 return rc;
414 void Filesets_Subclass_OnCommand (HWND hList, UINT msg, WPARAM wp, LPARAM lp)
416 HWND hChild = GetParent (hList);
417 LPIDENT lpi = Filesets_GetSelected (hChild);
419 switch (LOWORD(wp))
421 case M_COLUMNS:
422 ShowColumnsDialog (hChild, &gr.viewSet);
423 break;
425 case M_SET_VIEW_TREELIST:
426 gr.viewSet.lvsView = FLS_VIEW_TREELIST;
427 Filesets_OnView (hChild);
428 break;
430 case M_SET_VIEW_TREE:
431 gr.viewSet.lvsView = FLS_VIEW_TREE;
432 Filesets_OnView (hChild);
433 break;
435 case M_SET_VIEW_REPORT:
436 gr.viewSet.lvsView = FLS_VIEW_LIST;
437 Filesets_OnView (hChild);
438 break;
440 case M_SET_MOVEHERE:
441 if (l.lpiDrag && l.lpiDrag->fIsFileset() && l.lpiTarget)
442 Filesets_ShowMoveTo (l.lpiDrag, l.lpiTarget);
443 break;
445 case M_SET_REPHERE:
446 if (l.lpiDrag && l.lpiDrag->fIsFileset() && l.lpiTarget)
448 Filesets_CreateReplica (l.lpiDrag, l.lpiTarget);
450 break;
452 default:
453 StartContextCommand (Server_GetWindowForChild (GetParent(hList)),
454 Server_GetServerForChild (GetParent(hList)),
455 lpi,
456 LOWORD(wp));
457 break;
462 void Filesets_SubclassList (HWND hDlg)
464 HWND hList = GetDlgItem (hDlg, IDC_SET_LIST);
465 procFilesetsList = GetWindowLongPtr (hList, GWLP_WNDPROC);
466 SetWindowLongPtr (hList, GWLP_WNDPROC, (LONG_PTR)Filesets_SubclassListProc);
470 void Filesets_OnView (HWND hDlg)
472 HWND hList = GetDlgItem (hDlg, IDC_SET_LIST);
474 DWORD dwStyle = GetWindowLong (hList, GWL_STYLE);
475 dwStyle &= (~FLS_VIEW_MASK);
476 dwStyle |= gr.viewSet.lvsView;
478 SetWindowLong (hList, GWL_STYLE, dwStyle);
482 BOOL Filesets_BeginDrag (HWND hDlg, BOOL fRightBtn)
484 LPIDENT lpi = Filesets_GetFocused (hDlg);
486 if (!lpi || !lpi->fIsFileset()) // can only drag filesets!
487 return FALSE;
489 l.fRightBtn = fRightBtn;
490 StartTask (taskSET_BEGINDRAG, hDlg, lpi);
491 return TRUE;
495 void Filesets_OnEndTask_BeginDrag (HWND hDlg, LPTASKPACKET ptp)
497 LPIDENT lpi = (LPIDENT)(ptp->lpUser);
499 if (ptp->rc && TASKDATA(ptp)->fs.Type != ftCLONE)
501 HWND hList = GetDlgItem (hDlg, IDC_SET_LIST);
502 HLISTITEM hItem = FL_GetSelected (hList);
504 // When creating a drag image, we'll temporarily reset the object's
505 // images so we can be sure it'll draw just the Fileset icon.
507 FastList_Begin (hList);
508 int iImage1 = FastList_GetItemFirstImage (hList, hItem);
509 int iImage2 = FastList_GetItemSecondImage (hList, hItem);
510 FastList_SetItemFirstImage (hList, hItem, imageFILESET);
511 FastList_SetItemSecondImage (hList, hItem, IMAGE_NOIMAGE);
513 l.lpiDrag = lpi;
514 l.lpiTarget = NULL;
515 l.fDragging = TRUE;
516 l.hDragImage = FastList_CreateDragImage (hList, hItem);
518 FastList_SetItemFirstImage (hList, hItem, iImage1);
519 FastList_SetItemSecondImage (hList, hItem, iImage2);
520 FastList_End (hList);
522 // Now we've got a drag image; start dragging.
524 ShowCursor (FALSE);
525 SetCapture (hDlg);
527 DWORD dw = GetMessagePos();
528 POINT pt = { LOWORD(dw), HIWORD(dw) };
529 ScreenToClient (NULL, &pt);
531 ImageList_BeginDrag (l.hDragImage, 0, 8, 8);
532 ImageList_DragEnter (NULL, pt.x, pt.y);
537 void Filesets_ContinueDrag (HWND hDlg)
539 if (l.fDragging)
541 LPIDENT lpi = NULL;
542 HLISTITEM hItemTarget;
544 DWORD dw = GetMessagePos();
545 POINT pt = { LOWORD(dw), HIWORD(dw) };
546 HWND hTarget = WindowFromPoint (pt);
548 if (hTarget != NULL)
550 POINT ptClient = pt;
551 ScreenToClient (hTarget, &ptClient);
553 if ((lpi = IdentifyPoint (hTarget, ptClient, &hItemTarget)) != NULL)
555 if (!lpi->fIsServer() && !lpi->fIsAggregate())
556 lpi = NULL;
560 if (lpi != l.lpiTarget)
562 ImageList_DragLeave (NULL);
564 if (l.hItemTarget)
566 LPARAM dwFlags = FastList_GetItemFlags (l.hwndTarget, l.hItemTarget);
567 FastList_SetItemFlags (l.hwndTarget, l.hItemTarget, dwFlags & (~FLIF_DROPHIGHLIGHT));
568 l.hItemTarget = NULL;
569 l.lpiTarget = NULL;
572 if ((l.lpiTarget = lpi) != NULL)
574 l.hwndTarget = hTarget;
575 l.hItemTarget = hItemTarget;
576 LPARAM dwFlags = FastList_GetItemFlags (l.hwndTarget, l.hItemTarget);
577 FastList_SetItemFlags (l.hwndTarget, l.hItemTarget, dwFlags | FLIF_DROPHIGHLIGHT);
580 ScreenToClient (NULL, &pt);
581 ImageList_DragEnter (NULL, pt.x, pt.y);
584 ImageList_DragMove (LOWORD(dw), HIWORD(dw));
589 void Filesets_FinishDrag (HWND hDlg, BOOL fDropped, BOOL fMenu)
591 if (l.fDragging)
593 Filesets_ContinueDrag (hDlg);
594 ReleaseCapture();
595 l.fDragging = FALSE;
597 ImageList_EndDrag ();
598 ImageList_DragLeave (NULL);
599 ShowCursor (TRUE);
601 if (l.lpiTarget != NULL)
603 if (!fDropped)
605 Filesets_CancelDrag (hDlg);
607 else if (fDropped && !fMenu)
609 SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_MOVEHERE, 0);
610 Filesets_CancelDrag (hDlg);
612 else // (fDropped && fMenu)
614 DWORD dw = GetMessagePos();
615 POINT pt = { LOWORD(dw), HIWORD(dw) };
617 LPMENUTASK lpp = New (MENUTASK);
618 lpp->hParent = GetDlgItem (hDlg, IDC_SET_LIST);
619 lpp->ptScreen = pt;
620 lpp->lpi = l.lpiDrag;
622 StartTask (taskSET_DRAGMENU, hDlg, lpp);
629 void Filesets_OnEndTask_DragMenu (HWND hDlg, LPTASKPACKET ptp)
631 HMENU hm = TaLocale_LoadMenu (MENU_SET_DRAGDROP);
633 if (!ptp->rc)
634 EnableMenu (hm, M_SET_MOVEHERE, FALSE);
636 if (!ptp->rc || (TASKDATA(ptp)->fs.Type != ftREADWRITE))
637 EnableMenu (hm, M_SET_REPHERE, FALSE);
639 DisplayContextMenu (hm, TASKDATA(ptp)->mt.ptScreen, TASKDATA(ptp)->mt.hParent);
640 Filesets_CancelDrag (hDlg);
644 void Filesets_CancelDrag (HWND hDlg)
646 if (l.hItemTarget != NULL)
648 LPARAM dwFlags = FastList_GetItemFlags (l.hwndTarget, l.hItemTarget);
649 FastList_SetItemFlags (l.hwndTarget, l.hItemTarget, dwFlags & (~FLIF_DROPHIGHLIGHT));
650 l.hItemTarget = NULL;
655 LPIDENT IdentifyPoint (HWND hTarget, POINT ptClient, HLISTITEM *phItemTarget)
657 if ((*phItemTarget = FastList_ItemFromPoint (hTarget, &ptClient, TRUE)) == NULL)
658 return NULL;
660 return (LPIDENT)FL_GetData (hTarget, *phItemTarget);
664 void Filesets_ShowPopupMenu (HWND hList, POINT ptList, POINT ptScreen)
666 if (!ptScreen.x && !ptScreen.y)
668 RECT rWindow;
669 GetWindowRect (hList, &rWindow);
670 ptScreen.x = rWindow.left + (rWindow.right -rWindow.left)/2;
671 ptScreen.y = rWindow.top + (rWindow.bottom -rWindow.top)/2;
672 Filesets_ShowParticularPopupMenu (hList, ptScreen, NULL);
674 else if (FL_HitTestForHeaderBar (hList, ptList))
676 HMENU hm = TaLocale_LoadMenu (MENU_COLUMNS);
677 DisplayContextMenu (hm, ptScreen, hList);
679 else
681 LPIDENT lpi = Filesets_GetFocused (GetParent (hList), &ptList);
682 if (lpi && (lpi != Filesets_GetSelected (GetParent (hList))))
684 lpi = NULL; // right-click on item other than highlighted one?
687 if (lpi && lpi->fIsFileset())
689 Filesets_ShowParticularPopupMenu (hList, ptScreen, lpi);
691 else if (lpi && lpi->fIsAggregate())
693 Aggregates_ShowParticularPopupMenu (hList, ptScreen, lpi);
695 else if (lpi && lpi->fIsServer())
697 Server_ShowParticularPopupMenu (hList, ptScreen, lpi);
699 else if (!lpi) // display the _NONE menu? (no menu if it's a cell ident)
701 Filesets_ShowParticularPopupMenu (hList, ptScreen, lpi);
707 void Filesets_ShowParticularPopupMenu (HWND hParent, POINT ptScreen, LPIDENT lpiFileset)
709 LPMENUTASK pmt;
710 if ((pmt = New (MENUTASK)) != NULL)
712 pmt->hParent = hParent;
713 pmt->ptScreen = ptScreen;
714 pmt->lpi = lpiFileset;
715 StartTask (taskSET_MENU, GetParent(hParent), pmt);
720 void Filesets_OnEndTask_Menu (HWND hDlg, LPTASKPACKET ptp)
722 LPIDENT lpiFileset = (LPIDENT)(TASKDATA(ptp)->mt.lpi);
724 HMENU hm;
725 if (lpiFileset != NULL)
726 hm = TaLocale_LoadMenu (MENU_SET);
727 else
728 hm = TaLocale_LoadMenu (MENU_SET_NONE);
730 if (hm != NULL)
732 if (lpiFileset == NULL)
734 HMENU hmView = GetSubMenu (hm, 0);
735 DWORD dwStyle = GetWindowLong (TASKDATA(ptp)->mt.hParent, GWL_STYLE);
737 CheckMenuRadioItem (hmView,
738 M_SET_VIEW_REPORT, M_SET_VIEW_TREE,
739 ((dwStyle & FLS_VIEW_MASK) == FLS_VIEW_TREELIST) ? M_SET_VIEW_TREELIST :
740 ((dwStyle & FLS_VIEW_MASK) == FLS_VIEW_TREE) ? M_SET_VIEW_TREE : M_SET_VIEW_REPORT,
741 MF_BYCOMMAND);
743 CheckMenuRadioItem (hmView,
744 M_VIEW_ONEICON, M_VIEW_STATUS,
745 (gr.ivSet == ivTWOICONS) ? M_VIEW_TWOICONS :
746 (gr.ivSet == ivONEICON) ? M_VIEW_ONEICON : M_VIEW_STATUS,
747 MF_BYCOMMAND);
749 else
751 if (!ptp->rc)
753 EnableMenu (hm, M_SET_REPLICATION, FALSE);
754 EnableMenu (hm, M_SET_SETQUOTA, FALSE);
755 EnableMenu (hm, M_SET_RELEASE, FALSE);
756 EnableMenu (hm, M_SET_CLONE, FALSE);
757 EnableMenu (hm, M_SET_MOVETO, FALSE);
758 EnableMenu (hm, M_SET_DUMP, FALSE);
759 EnableMenu (hm, M_SET_RESTORE, FALSE);
761 else
763 if (TASKDATA(ptp)->fs.Type == ftCLONE)
765 EnableMenu (hm, M_SET_REPLICATION, FALSE);
766 EnableMenu (hm, M_SET_RELEASE, FALSE);
767 EnableMenu (hm, M_SET_CLONE, FALSE);
768 EnableMenu (hm, M_SET_MOVETO, FALSE);
771 if (TASKDATA(ptp)->fs.Type != ftREADWRITE)
773 EnableMenu (hm, M_SET_CLONE, FALSE);
774 EnableMenu (hm, M_SET_RELEASE, FALSE);
775 EnableMenu (hm, M_SET_SETQUOTA, FALSE);
776 EnableMenu (hm, M_SET_RESTORE, FALSE);
781 DisplayContextMenu (hm, TASKDATA(ptp)->mt.ptScreen, TASKDATA(ptp)->mt.hParent);