Beispiel #1
0
void Time_Edit_SetText (TimeInfo *pti, HWND hEdit)
{
   DWORD dwNow;

   if (hEdit == pti->hHours)
      {
      BOOL fPM = (pti->timeNow.wHour >= 12) ? TRUE : FALSE;

      if (pti->f24Hour)
         dwNow = pti->timeNow.wHour;
      else if ((dwNow = pti->timeNow.wHour % 12) == 0)
         dwNow = 12;

      if (pti->hSpinnerBuddy == hEdit)
         {
         SP_SetPos (hEdit, dwNow);
         }
      else
         {
         TCHAR szText[ cchRESOURCE ];

         if (!pti->f0Hours)
            wsprintf (szText, TEXT("%lu"), dwNow);
         else
            wsprintf (szText, TEXT("%02lu"), dwNow);

         SetWindowText (hEdit, szText);
         }

      if (!pti->f24Hour)
         {
         LB_SetSelected (pti->hAMPM, (int)fPM);
         }
      }
   else if (hEdit == pti->hMinutes)
      {
      if (pti->hSpinnerBuddy == hEdit)
         {
         SP_SetPos (hEdit, pti->timeNow.wMinute);
         }
      else
         {
         TCHAR szText[ cchRESOURCE ];
         wsprintf (szText, TEXT("%02lu"), pti->timeNow.wMinute);
         SetWindowText (hEdit, szText);
         }
      }
}
Beispiel #2
0
BOOL CALLBACK Misc_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
{
   switch (msg)
      {
      case WM_INITDIALOG:
         Misc_OnInitDialog (hDlg);
         break;

      case WM_CTLCOLORSTATIC:
         if ((HWND)lp == GetDlgItem (hDlg, IDC_CHUNK_SIZE))
            {
            if (IsWindowEnabled ((HWND)lp))
               {
               static HBRUSH hbrStatic = CreateSolidBrush (GetSysColor (COLOR_WINDOW));
               SetTextColor ((HDC)wp, GetSysColor (COLOR_WINDOWTEXT));
               SetBkColor ((HDC)wp, GetSysColor (COLOR_WINDOW));
               return (BOOL)hbrStatic;
               }
            }
         break;

      case WM_COMMAND:
         switch (LOWORD(wp))
            {
            case IDHELP:
               Misc_DlgProc (hDlg, WM_HELP, 0, 0);
               break;

            case IDOK:
                Misc_OnOK(hDlg);
                break;

            case IDCANCEL:
                Misc_OnCancel(hDlg);
                break;
#if undef
			case IDC_AUTOLANA:
				if (IsDlgButtonChecked(hDlg,IDC_AUTOLANA))
					nLanAdapter=-1;
				else
					nLanAdapter=0;
				SP_SetPos (GetDlgItem (hDlg, IDC_LAN_ADAPTER),nLanAdapter);
				EnableWindow(GetDlgItem(hDlg,IDC_LAN_ADAPTER),(nLanAdapter!=-1));
#endif
            }
         break;

      case WM_HELP:
         WinHelp (hDlg, g.szHelpFile, HELP_CONTEXT, IDH_AFSCONFIG_ADVANCED_MISC);
         break;
      }

   return FALSE;
}
Beispiel #3
0
void Time_Edit_OnSetFocus (TimeInfo *pti, HWND hEdit)
{
   DWORD dwMin;
   DWORD dwNow;
   DWORD dwMax;

   pti->fCanCallBack --;

   if (hEdit == pti->hHours)
      {
      dwMin = (pti->f24Hour) ? 0 : 1;
      dwNow = (pti->f24Hour) ? pti->timeNow.wHour : (pti->timeNow.wHour % 12);
      dwMax = (pti->f24Hour) ? 24 : 12;

      if (!pti->f24Hour && !dwNow)
         dwNow = 12;
      }
   else if (hEdit == pti->hMinutes)
      {
      dwMin = 0;
      dwNow = pti->timeNow.wMinute;
      dwMax = 59;
      }
   else // (hEdit == pti->hAMPM)
      {
      dwMin = 0;
      dwNow = (pti->timeNow.wHour >= 12) ? 1 : 0;
      dwMax = 1;
      }

   if (pti->hSpinnerBuddy != hEdit)
      {
      SP_SetBuddy (pti->hSpinnerBuddy, hEdit, FALSE);
      pti->hSpinnerBuddy = hEdit;
      }

   SP_SetRange (hEdit, dwMin, dwMax);
   SP_SetPos (hEdit, dwNow);

   if ((hEdit == pti->hHours) && (!pti->f0Hours))
      SP_SetFormat (hEdit, TEXT("%lu"));
   else if ((hEdit == pti->hHours) || (hEdit == pti->hMinutes))
      SP_SetFormat (hEdit, TEXT("%02lu"));

   if ((hEdit == pti->hHours) || (hEdit == pti->hMinutes))
      SendMessage (hEdit, EM_SETSEL, (WPARAM)0, (LPARAM)-1);  // select all

   pti->fCanCallBack ++;
}
Beispiel #4
0
void Group_Create_OnEndTask_ObjectGet (HWND hDlg, LPTASKPACKET ptp)
{
   if (ptp->rc)
      {
      TCHAR szText[ cchRESOURCE ];
      GetDlgItemText (hDlg, IDC_NEWGROUP_ID_AUTO, szText, cchRESOURCE);

      LPTSTR pszText = FormatString (TEXT("%1 (%2)"), TEXT("%s%ld"), szText, TASKDATA(ptp)->Properties.u.CellProperties.idGroupMax-1);
      SetDlgItemText (hDlg, IDC_NEWGROUP_ID_AUTO, pszText);
      FreeString (pszText);

      if (!IsWindowEnabled (GetDlgItem (hDlg, IDC_NEWGROUP_ID)))
         SP_SetPos (GetDlgItem (hDlg, IDC_NEWGROUP_ID), TASKDATA(ptp)->Properties.u.CellProperties.idGroupMax-1);
      }
}
Beispiel #5
0
void Elapsed_Edit_SetText (ElapsedInfo *pei, HWND hEdit)
{
   DWORD dwMin;
   DWORD dwNow;
   DWORD dwMax;
   Elapsed_Edit_GetSpinnerRange (pei, hEdit, &dwMin, &dwNow, &dwMax);

   if (pei->hSpinnerBuddy == hEdit)
      {
      SP_SetPos (hEdit, dwNow);
      }
   else
      {
      TCHAR szText[ cchRESOURCE ];

      if (hEdit == pei->hHours)
         wsprintf (szText, TEXT("%lu"), dwNow);
      else
         wsprintf (szText, TEXT("%02lu"), dwNow);

      SetWindowText (hEdit, szText);
      }
}
Beispiel #6
0
void Filesets_Create_OnEndTask_FindQuotaLimits (HWND hDlg, LPTASKPACKET ptp, LPSET_CREATE_PARAMS pscp)
{
   size_t cMin = TASKDATA(ptp)->ckMin;
   size_t cNow = pscp->ckQuota;
   size_t cMax = TASKDATA(ptp)->ckMax;

   if (gr.cbQuotaUnits == cb1MB)
      {
      cMin /= ck1MB;
      cNow /= ck1MB;
      cMax /= ck1MB;
      }

   HWND hQuota = GetDlgItem (hDlg, IDC_SET_QUOTA);
   if (!fHasSpinner (hQuota))
      {
      CreateSpinner (hQuota, 10, FALSE, (DWORD)cMin, (DWORD)cNow, (DWORD)cMax);
      }
   else
      {
      SP_SetRange (hQuota, cMin, cMax);
      SP_SetPos (hQuota, cNow);
      }
}