ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

general.c
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:       See COPYING in the top level directory
00003  * PROJECT:         ReactOS Display Control Panel
00004  * FILE:            dll/cpl/desk/general.c
00005  * PURPOSE:         Advanced General settings
00006  */
00007 
00008 #include "desk.h"
00009 
00010 static VOID
00011 InitFontSizeList(HWND hWnd)
00012 {
00013     HINF hInf;
00014     HKEY hKey;
00015     HWND hFontSize;
00016     INFCONTEXT Context;
00017     int i, ci = 0;
00018     DWORD dwSize, dwValue, dwType;
00019 
00020     hFontSize = GetDlgItem(hWnd, IDC_FONTSIZE_COMBO);
00021 
00022     hInf = SetupOpenInfFile(_T("font.inf"), NULL,
00023                             INF_STYLE_WIN4, NULL);
00024 
00025     if (hInf != INVALID_HANDLE_VALUE)
00026     {
00027         if (SetupFindFirstLine(hInf, _T("Font Sizes"), NULL, &Context))
00028         {
00029             if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontDPI"),
00030                              0, KEY_READ, &hKey) == ERROR_SUCCESS)
00031             for (;;)
00032             {
00033                 TCHAR Desc[LINE_LEN];
00034 
00035                 if (SetupGetStringField(&Context, 0, Desc, sizeof(Desc), NULL) &&
00036                     SetupGetIntField(&Context, 1, &ci))
00037                 {
00038                     _stprintf(Desc, _T("%s (%d DPI)"), Desc, ci);
00039                     i = SendMessage(hFontSize, CB_ADDSTRING, 0, (LPARAM)Desc);
00040                     if (i != CB_ERR)
00041                         SendMessage(hFontSize, CB_SETITEMDATA, (WPARAM)i, (LPARAM)ci);
00042 
00043                     dwSize = MAX_PATH;
00044                     dwType = REG_DWORD;
00045 
00046                     if (RegQueryValueEx(hKey, _T("LogPixels"), NULL,
00047                                         &dwType, (LPBYTE)&dwValue, &dwSize) == ERROR_SUCCESS)
00048                     {
00049                         if ((int)dwValue == ci)
00050                         {
00051                             SendMessage(hFontSize, CB_SETCURSEL, (WPARAM)i, 0);
00052                             SetWindowText(GetDlgItem(hWnd, IDC_FONTSIZE_COSTOM), Desc);
00053                         }
00054                     }
00055                 }
00056 
00057                 if (!SetupFindNextLine(&Context, &Context))
00058                 {
00059                     RegCloseKey(hKey);
00060                     break;
00061                 }
00062             }
00063         }
00064     }
00065 
00066     SetupCloseInfFile(hInf);
00067 }
00068 
00069 static VOID
00070 InitRadioButtons(HWND hWnd)
00071 {
00072     HKEY hKey;
00073 
00074     if (RegOpenKeyEx(HKEY_CURRENT_USER,
00075                      _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Controls Folder\\Display"),
00076                      0, KEY_READ, &hKey) == ERROR_SUCCESS)
00077     {
00078         TCHAR szBuf[64];
00079         DWORD dwSize = 64;
00080 
00081         if (RegQueryValueEx(hKey, _T("DynaSettingsChange"), 0, NULL,
00082                             (LPBYTE)szBuf, &dwSize) == ERROR_SUCCESS)
00083         {
00084             switch (_ttoi(szBuf))
00085             {
00086                 case 0:
00087                     SendDlgItemMessage(hWnd, IDC_RESTART_RB, BM_SETCHECK, 1, 1);
00088                     break;
00089                 case 1:
00090                     SendDlgItemMessage(hWnd, IDC_WITHOUTREBOOT_RB, BM_SETCHECK, 1, 1);
00091                     break;
00092                 case 3:
00093                     SendDlgItemMessage(hWnd, IDC_ASKME_RB, BM_SETCHECK, 1, 1);
00094                     break;
00095             }
00096         }
00097 
00098         RegCloseKey(hKey);
00099     }
00100 }
00101 
00102 INT_PTR CALLBACK
00103 AdvGeneralPageProc(HWND hwndDlg,
00104                    UINT uMsg,
00105                    WPARAM wParam,
00106                    LPARAM lParam)
00107 {
00108     PDISPLAY_DEVICE_ENTRY DispDevice = NULL;
00109     INT_PTR Ret = 0;
00110 
00111     if (uMsg != WM_INITDIALOG)
00112         DispDevice = (PDISPLAY_DEVICE_ENTRY)GetWindowLongPtr(hwndDlg, DWLP_USER);
00113 
00114     switch (uMsg)
00115     {
00116         case WM_INITDIALOG:
00117             DispDevice = (PDISPLAY_DEVICE_ENTRY)(((LPPROPSHEETPAGE)lParam)->lParam);
00118             SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)DispDevice);
00119 
00120             InitFontSizeList(hwndDlg);
00121             InitRadioButtons(hwndDlg);
00122 
00123             Ret = TRUE;
00124             break;
00125         case WM_COMMAND:
00126             switch (LOWORD(wParam))
00127             {
00128                 case IDC_FONTSIZE_COMBO:
00129                     if (HIWORD(wParam) == CBN_SELCHANGE)
00130                     {
00131                         PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
00132                     }
00133                     break;
00134                 case IDC_RESTART_RB:
00135                 case IDC_WITHOUTREBOOT_RB:
00136                 case IDC_ASKME_RB:
00137                     PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
00138                 break;
00139             }
00140             break;
00141     }
00142 
00143     return Ret;
00144 }

Generated on Sun May 27 2012 04:20:50 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.