Beispiel #1
0
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);
}
Beispiel #2
0
void Display_SelectAll (void)
{
   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))
      {
      // Select all items in the list
      //
      FastList_SelectAll (hList);

      // Simulate a FLN_ITEMSELECT notification (since we changed
      // the selection programmatically, no notification will have been
      // sent).
      //
      FLN_ITEMSELECT_PARAMS fln;
      fln.hdr.hwndFrom = hList;
      fln.hdr.idFrom = GetWindowLong (hList, GWL_ID);
      fln.hdr.code = FLN_ITEMSELECT;
      fln.hItem = FastList_FindFirstSelected (hList);
      SendMessage (GetParent (hList), WM_NOTIFY, (WPARAM)fln.hdr.idFrom, (LPARAM)&fln);
      }
}
Beispiel #3
0
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;
}
Beispiel #4
0
void CellEdit_OnSelect (HWND hDlg)
{
   HWND hList = GetDlgItem (hDlg, IDC_LIST);
   HLISTITEM hItem = FastList_FindFirstSelected (hList);
   HLISTITEM hNext = FastList_FindNextSelected (hList, hItem);

   EnableWindow (GetDlgItem (hDlg, IDC_EDIT), !!hItem && !hNext);
   EnableWindow (GetDlgItem (hDlg, IDC_REMOVE), !!hItem);
}
Beispiel #5
0
void AutoMap_OnSelect (HWND hDlg)
{
   HWND hList = GetDlgItem (hDlg, IDC_GLOBAL_DRIVE_LIST);

   BOOL bEnable = FastList_FindFirstSelected (hList) != NULL;

	EnableWindow (GetDlgItem (hDlg, IDC_REMOVE), bEnable);
   EnableWindow (GetDlgItem (hDlg, IDC_CHANGE), bEnable);
}
Beispiel #6
0
void Server_Hosts_OnSelect (HWND hDlg, LPSVR_HOSTS_PARAMS lpp)
{
   HWND hList = GetDlgItem (hDlg, IDC_HOST_LIST);

   BOOL fEnableRemove = TRUE;

   if (!IsWindowEnabled (hList))
      fEnableRemove = FALSE;

   if (FastList_FindFirstSelected (hList) == NULL)
      fEnableRemove = FALSE;

   EnableWindow (GetDlgItem (hDlg, IDC_HOST_REMOVE), fEnableRemove);
}
Beispiel #7
0
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);
}
Beispiel #8
0
void Server_Hosts_OnDelEntry (HWND hDlg, LPSVR_HOSTS_PARAMS lpp)
{
   HWND hList = GetDlgItem (hDlg, IDC_HOST_LIST);
   FL_StartChange (hList, FALSE);

   HLISTITEM hItem;
   while ((hItem = FastList_FindFirstSelected (hList)) != NULL)
      {
      size_t iEntry = (size_t)FL_GetData (hList, hItem);
      AfsClass_HostList_DelEntry (lpp->lpList, iEntry);
      FastList_RemoveItem (hList, hItem);
      }

   FL_EndChange (hList);
}
Beispiel #9
0
DRIVEMAP *GetSelectedDrive(HWND hDlg, HLISTITEM  *pItem)
{
	static DRIVEMAP DriveMap;
   HLISTITEM hItem;

   HWND hList = GetDlgItem (hDlg, IDC_GLOBAL_DRIVE_LIST);

   if (!pItem)
      pItem = &hItem;

   if ((*pItem = FastList_FindFirstSelected (hList)) == NULL)
   	return 0;

	LPCTSTR pszDrive = FastList_GetItemText (hList, *pItem, 0);
   int nCurDrive = pszDrive[DRIVE_LETTER_INDEX] - TEXT('A');

   memcpy(&DriveMap, &GlobalDrives.aDriveMap[nCurDrive], sizeof(DRIVEMAP));

   return &DriveMap;
}
Beispiel #10
0
void Server_OnKey_Menu (void)
{
   HWND hFocus = GetFocus();
   if (fIsFastList (hFocus))
      {
      POINT ptScreen = { 0, 0 };

      HLISTITEM hItem;
      if ((hItem = FastList_FindFirstSelected (hFocus)) != NULL)
         {
         FASTLISTITEMREGIONS reg;
         FastList_GetItemRegions (hFocus, hItem, &reg);

         ptScreen.x = reg.rItem.left + (reg.rItem.right -reg.rItem.left) /2;
         ptScreen.y = reg.rItem.top + (reg.rItem.bottom -reg.rItem.top) /2;
         ClientToScreen (GetFocus(), &ptScreen);
         }

      PostMessage (GetParent (GetFocus()), WM_CONTEXTMENU, (WPARAM)GetFocus(), MAKELONG(ptScreen.x,ptScreen.y));
      }
}
Beispiel #11
0
size_t Display_GetSelectedCount (void)
{
   size_t cSelected = 0;

   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))
      {
      for (HLISTITEM hItem = FastList_FindFirstSelected (hList);
           hItem != NULL;
           hItem = FastList_FindNextSelected (hList, hItem))
         {
         ++cSelected;
         }
      }

   return cSelected;
}
Beispiel #12
0
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);
      }
}
Beispiel #13
0
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);
}