8 #include "agg_general.h"
9 #include "svr_window.h"
10 #include "svr_general.h"
16 * RESIZING WINDOWS ___________________________________________________________
20 rwWindowData awdAggregates[] = {
21 { IDC_AGG_DESC, raSizeX },
22 { IDC_AGG_LIST, raSizeX | raSizeY },
23 { IDC_AGG_CREATESET, raMoveX | raMoveY },
29 * PROTOTYPES _________________________________________________________________
33 void Aggregates_OnNotifyFromDispatch (LPNOTIFYSTRUCT lpns);
35 void Aggregates_SubclassList (HWND hDlg);
39 * ROUTINES ___________________________________________________________________
43 BOOL CALLBACK Aggregates_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
45 if (HandleColumnNotify (hDlg, msg, wp, lp, &gr.viewAgg))
53 GetClientRect (GetParent(hDlg), &rTab);
54 TabCtrl_AdjustRect (GetParent (hDlg), FALSE, &rTab);
55 ResizeWindow (hDlg, awdAggregates, rwaMoveToHere, &rTab);
57 FL_RestoreView (GetDlgItem (hDlg, IDC_AGG_LIST), &gr.viewAgg);
58 FastList_SetTextCallback (GetDlgItem (hDlg, IDC_AGG_LIST), GetItemText, (DWORD)&gr.viewAgg);
60 Aggregates_SubclassList (hDlg);
65 WinHelp (hDlg, cszHELPFILENAME, HELP_FINDER, 0);
69 DontNotifyMeEver (hDlg);
70 FL_StoreView (GetDlgItem (hDlg, IDC_AGG_LIST), &gr.viewAgg);
74 // if (lp==0), we're minimizing--don't call ResizeWindow().
77 ResizeWindow (hDlg, awdAggregates, rwaFixupGuts);
80 case WM_SERVER_CHANGED:
82 LPIDENT lpiServer = Server_GetServerForChild (hDlg);
83 DontNotifyMeEver (hDlg);
84 NotifyMe (WHEN_AGGS_CHANGE, lpiServer, hDlg, 0);
86 // Fix the text at the top of the Aggregates tab:
88 TCHAR szName[ cchRESOURCE ];
91 if (lpiServer != NULL)
93 LPSERVER_PREF lpsp = (LPSERVER_PREF)lpiServer->GetUserParam();
94 lpiServer->GetServerName (szName);
95 if (lpsp && !lpsp->fIsMonitored)
96 pszText = FormatString (IDS_AGGREGATE_UNMON, TEXT("%s"), szName);
98 pszText = FormatString (IDS_AGGREGATES_IN_SERVER, TEXT("%s"), szName);
100 else if (g.lpiCell != NULL)
102 g.lpiCell->GetCellName (szName);
104 pszText = FormatString (IDS_AGGREGATE_SOME, TEXT("%s"), szName);
106 pszText = FormatString (IDS_AGGREGATES_IN_CELL, TEXT("%s"), szName);
110 pszText = FormatString (IDS_AGGREGATES_IN_NOTHING);
113 SetDlgItemText (hDlg, IDC_AGG_DESC, pszText);
114 FreeString (pszText);
116 UpdateDisplay_Aggregates (FALSE, GetDlgItem (hDlg, IDC_AGG_LIST), NULL, 0, NULL, NULL, NULL);
120 case WM_NOTIFY_FROM_DISPATCH:
121 Aggregates_OnNotifyFromDispatch ((LPNOTIFYSTRUCT)lp);
122 Delete ((LPNOTIFYSTRUCT)lp);
126 switch (((LPNMHDR)lp)->code)
129 if (((LPNMHDR)lp)->hwndFrom == GetDlgItem (hDlg, IDC_AGG_LIST))
131 if (FL_GetSelectedData (GetDlgItem (hDlg, IDC_AGG_LIST)))
132 PostMessage (GetDlgItem (hDlg, IDC_AGG_LIST), WM_COMMAND, M_PROPERTIES, 0);
143 ptScreen.x = LOWORD(lp);
144 ptScreen.y = HIWORD(lp);
147 ScreenToClient ((HWND)wp, &ptClient);
149 if ((HWND)wp == GetDlgItem (hDlg, IDC_AGG_LIST))
150 Aggregates_ShowPopupMenu ((HWND)wp, ptClient, ptScreen);
157 case IDC_AGG_CREATESET:
158 SendMessage (GetDlgItem (hDlg, IDC_AGG_LIST), WM_COMMAND, M_SET_CREATE, 0);
168 void Aggregates_OnNotifyFromDispatch (LPNOTIFYSTRUCT lpns)
172 case evtRefreshAggregatesEnd:
173 case evtRefreshStatusEnd:
174 case evtAlertsChanged:
176 UpdateDisplay_Aggregates (FALSE, GetDlgItem (lpns->hwndTarget, IDC_AGG_LIST), lpns->Params.lpi1, lpns->Params.status, NULL, NULL, NULL);
182 static LONG procAggregatesList = 0;
184 LRESULT CALLBACK Aggregates_SubclassListProc (HWND hList, UINT msg, WPARAM wp, LPARAM lp)
188 if (procAggregatesList == 0)
189 rc = DefWindowProc (hList, msg, wp, lp);
191 rc = CallWindowProc ((WNDPROC)procAggregatesList, hList, msg, wp, lp);
196 if (procAggregatesList != 0)
197 SetWindowLong (hList, GWL_WNDPROC, procAggregatesList);
201 StartContextCommand (Server_GetWindowForChild (GetParent(hList)),
202 Server_GetServerForChild (GetParent(hList)),
203 Aggregates_GetFocused (GetParent(hList)),
212 void Aggregates_SubclassList (HWND hDlg)
214 HWND hList = GetDlgItem (hDlg, IDC_AGG_LIST);
215 procAggregatesList = GetWindowLong (hList, GWL_WNDPROC);
216 SetWindowLong (hList, GWL_WNDPROC, (LONG)Aggregates_SubclassListProc);
220 void Aggregates_ShowPopupMenu (HWND hList, POINT ptList, POINT ptScreen)
222 if (!ptScreen.x && !ptScreen.y)
225 GetWindowRect (hList, &rWindow);
226 ptScreen.x = rWindow.left + (rWindow.right -rWindow.left)/2;
227 ptScreen.y = rWindow.top + (rWindow.bottom -rWindow.top)/2;
228 Aggregates_ShowParticularPopupMenu (hList, ptScreen, NULL);
230 else if (FL_HitTestForHeaderBar (hList, ptList))
232 HMENU hm = TaLocale_LoadMenu (MENU_COLUMNS);
233 DisplayContextMenu (hm, ptScreen, hList);
237 LPIDENT lpiSelected = NULL;
240 if ((hItem = FastList_ItemFromPoint (hList, &ptList, TRUE)) != NULL)
241 lpiSelected = (LPIDENT)FastList_GetItemParam (hList, hItem);
243 if (lpiSelected && (lpiSelected != (LPIDENT)FL_GetSelectedData (hList)))
246 if (lpiSelected && lpiSelected->fIsServer())
247 Server_ShowParticularPopupMenu (hList, ptScreen, lpiSelected);
249 Aggregates_ShowParticularPopupMenu (hList, ptScreen, lpiSelected);
254 void Aggregates_ShowParticularPopupMenu (HWND hParent, POINT ptScreen, LPIDENT lpiAggregate)
258 if (lpiAggregate == NULL)
259 hm = TaLocale_LoadMenu (MENU_AGG_NONE);
261 hm = TaLocale_LoadMenu (MENU_AGG);
265 if (lpiAggregate == NULL)
267 HMENU hmView = GetSubMenu (hm, 0);
269 CheckMenuRadioItem (hmView,
270 M_VIEW_ONEICON, M_VIEW_STATUS,
271 (gr.ivAgg == ivTWOICONS) ? M_VIEW_TWOICONS :
272 (gr.ivAgg == ivONEICON) ? M_VIEW_ONEICON : M_VIEW_STATUS,
276 DisplayContextMenu (hm, ptScreen, hParent);