Exemplo n.º 1
0
void ShowDriveList(HWND hDlg, DRIVEMAPLIST& drives)
{
   // Prepare the columns
   HWND hList = GetDlgItem (hDlg, IDC_GLOBAL_DRIVE_LIST);

   // Fill in the list of drives
   FastList_Begin (hList);

   FastList_RemoveAll(hList);

   for (size_t ii = 0; ii < 26; ++ii) {
      if (!GlobalDrives.aDriveMap[ ii ].chDrive)
         continue;

      HWND hList = GetDlgItem (hDlg, IDC_GLOBAL_DRIVE_LIST);

   	FASTLISTADDITEM ai;
   	memset (&ai, 0x00, sizeof(FASTLISTADDITEM));
   	ai.iFirstImage = IMAGE_NOIMAGE;
   	ai.iSecondImage = IMAGE_NOIMAGE;
   	// There must be DRIVE_LETTER_INDEX number of spaces before the ? character
   	ai.pszText = _tcsdup(TEXT("  ?:"));
   	ai.pszText[DRIVE_LETTER_INDEX] = GlobalDrives.aDriveMap[ ii ].chDrive;
   	ai.lParam = 0;

   	HLISTITEM hItem = FastList_AddItem (hList, &ai);

      TCHAR szAfsPath[ MAX_PATH ];
      AdjustAfsPath (szAfsPath, GlobalDrives.aDriveMap[ ii ].szMapping, TRUE, FALSE);

   	FastList_SetItemText (hList, hItem, 1, szAfsPath);
   }

   FastList_End (hList);
}
Exemplo n.º 2
0
void HostsTab_FillList (HWND hDlg)
{
   HWND hList = GetDlgItem (hDlg, IDC_LIST);
   FastList_Begin (hList);
   FastList_RemoveAll (hList);

   for (PCELLDBLINE pLine = g.Configuration.CellServDB.pFirst; pLine; pLine = pLine->pNext)
      {
      CELLDBLINEINFO Info;
      if (!CSDB_CrackLine (&Info, pLine->szLine))
         continue;
      if (!Info.szCell[0])
         continue;

      TCHAR szText[ MAX_PATH ];
      lstrcpy (szText, Info.szCell);

#if 0 // Add this if you like a more verbose Cell Hosts tab
      if (Info.szComment)
         wsprintf (&szText[ lstrlen(szText) ], TEXT(" (%s)"), Info.szComment);
#endif

      FASTLISTADDITEM ai;
      memset (&ai, 0x00, sizeof(ai));
      ai.iFirstImage = IMAGE_NOIMAGE;
      ai.iSecondImage = IMAGE_NOIMAGE;
      ai.pszText = szText;
      ai.lParam = (LPARAM)pLine;
      FastList_AddItem (hList, &ai);
      }

   FastList_End (hList);
}
Exemplo n.º 3
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);
}
Exemplo n.º 4
0
void Browse_UpdateDialog (HWND hDlg)
{
   LPBROWSE_PARAMS lpp;
   if ((lpp = (LPBROWSE_PARAMS)GetWindowLongPtr (hDlg, DWLP_USER)) != NULL)
      {
      lpp->fQuerying ++;

      // First we'll need to empty the list, and add some non-selectable thing
      // that says "querying"
      //
      HWND hList = GetDlgItem (hDlg, IDC_BROWSE_LIST);
      FastList_Begin (hList);
      FastList_RemoveAll (hList);

      TCHAR szText[ cchRESOURCE ];
      GetString (szText, IDS_QUERYING_LONG);

      FASTLISTADDITEM flai;
      memset (&flai, 0x00, sizeof(flai));
      flai.iFirstImage = IMAGE_NOIMAGE;
      flai.iSecondImage = IMAGE_NOIMAGE;
      flai.pszText = szText;
      flai.dwFlags = FLIF_DISALLOW_SELECT;
      FastList_AddItem (hList, &flai);

      FastList_End (hList);

      // Then start a background task to obtain the appropriate list
      // of stuff to show. When that task completes, we'll populate the
      // list.
      //
      TCHAR szPattern[ cchNAME ];
      GetDlgItemText (hDlg, IDC_BROWSE_PATTERN, szPattern, cchNAME);

      LPTSTR pszPattern = NULL;
      if (szPattern[0] != TEXT('\0'))
         pszPattern = CloneString (szPattern);

      StartTask ((Browse_GetSelectedType (hDlg) == TYPE_USER) ? taskUSER_ENUM : taskGROUP_ENUM, hDlg, pszPattern);
      }
}
Exemplo n.º 5
0
void Filesets_OnEndTask_BeginDrag (HWND hDlg, LPTASKPACKET ptp)
{
   LPIDENT lpi = (LPIDENT)(ptp->lpUser);

   if (ptp->rc && TASKDATA(ptp)->fs.Type != ftCLONE)
      {
      HWND hList = GetDlgItem (hDlg, IDC_SET_LIST);
      HLISTITEM hItem = FL_GetSelected (hList);

      // When creating a drag image, we'll temporarily reset the object's
      // images so we can be sure it'll draw just the Fileset icon.
      //
      FastList_Begin (hList);
      int iImage1 = FastList_GetItemFirstImage (hList, hItem);
      int iImage2 = FastList_GetItemSecondImage (hList, hItem);
      FastList_SetItemFirstImage (hList, hItem, imageFILESET);
      FastList_SetItemSecondImage (hList, hItem, IMAGE_NOIMAGE);

      l.lpiDrag = lpi;
      l.lpiTarget = NULL;
      l.fDragging = TRUE;
      l.hDragImage = FastList_CreateDragImage (hList, hItem);

      FastList_SetItemFirstImage (hList, hItem, iImage1);
      FastList_SetItemSecondImage (hList, hItem, iImage2);
      FastList_End (hList);

      // Now we've got a drag image; start dragging.
      //
      ShowCursor (FALSE);
      SetCapture (hDlg);

      DWORD dw = GetMessagePos();
      POINT pt = { LOWORD(dw), HIWORD(dw) };
      ScreenToClient (NULL, &pt);

      ImageList_BeginDrag (l.hDragImage, 0, 8, 8);
      ImageList_DragEnter (NULL, pt.x, pt.y);
      }
}
Exemplo n.º 6
0
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);
      }
}
Exemplo n.º 7
0
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();
}
Exemplo n.º 8
0
void Browse_OnEndTask_EnumObjects (HWND hDlg, LPTASKPACKET ptp)
{
   LPBROWSE_PARAMS lpp;
   size_t ii;
   if ((lpp = (LPBROWSE_PARAMS)GetWindowLongPtr (hDlg, DWLP_USER)) != NULL)
      {
      HWND hList = GetDlgItem (hDlg, IDC_BROWSE_LIST);
      FastList_Begin (hList);
      FastList_RemoveAll (hList);

      // If we were successful, we now have a list of all objects of the
      // appropriate type. However, the user may not want us to display
      // items which are on our pObjectsToSkip list; if not, convert the
      // later to a hashlist (for fast lookup) and remove the offending
      // entries from the former.
      //
      if (ptp->rc && TASKDATA(ptp)->pAsidList)
         {
         if ((IsDlgButtonChecked (hDlg, IDC_BROWSE_CHECK)) && (lpp->pObjectsToSkip))
            {
            LPHASHLIST pListToSkip = New (HASHLIST);

            for (ii = 0; ii < lpp->pObjectsToSkip->cEntries; ++ii)
               pListToSkip->AddUnique ((PVOID)(lpp->pObjectsToSkip->aEntries[ii].idObject));

            for (ii = 0; ii < TASKDATA(ptp)->pAsidList->cEntries; )
               {
               if (pListToSkip->fIsInList ((PVOID)(TASKDATA(ptp)->pAsidList->aEntries[ii].idObject)))
                  asc_AsidListRemoveEntryByIndex (&TASKDATA(ptp)->pAsidList, ii);
               else
                  ii++;
               }

            Delete (pListToSkip);
            }
         }

      // OK, we're ready to go--populate that list!
      //
      for (ii = 0; ii < TASKDATA(ptp)->pAsidList->cEntries; ++ii)
         {
         ULONG status;
         ASOBJPROP Properties;
         if (!asc_ObjectPropertiesGet_Fast (g.idClient, g.idCell, TASKDATA(ptp)->pAsidList->aEntries[ii].idObject, &Properties, &status))
            continue;

         TCHAR szName[ MAX_PATH ];
         if (Properties.Type == TYPE_USER)
            User_GetDisplayName (szName, &Properties);
         else
            lstrcpy (szName, Properties.szName);

         FASTLISTADDITEM flai;
         memset (&flai, 0x00, sizeof(flai));
         flai.iFirstImage = (Properties.Type == TYPE_USER) ? imageUSER : (Properties.Type == TYPE_GROUP) ? imageGROUP : IMAGE_NOIMAGE;
         flai.iSecondImage = IMAGE_NOIMAGE;
         flai.pszText = szName;
         FastList_AddItem (hList, &flai);
         }

      FastList_End (hList);
      lpp->fQuerying --;
      }
}