Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenoptions.c
Go to the documentation of this file.
00001 /* 00002 * PROJECT: ReactOS Console Configuration DLL 00003 * LICENSE: GPL - See COPYING in the top level directory 00004 * FILE: dll/win32/console/options.c 00005 * PURPOSE: displays options dialog 00006 * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@student.tugraz.at) 00007 */ 00008 00009 #include "console.h" 00010 00011 static 00012 void 00013 UpdateDialogElements(HWND hwndDlg, PConsoleInfo pConInfo); 00014 00015 INT_PTR 00016 CALLBACK 00017 OptionsProc( 00018 HWND hwndDlg, 00019 UINT uMsg, 00020 WPARAM wParam, 00021 LPARAM lParam 00022 ) 00023 { 00024 PConsoleInfo pConInfo; 00025 LRESULT lResult; 00026 HWND hDlgCtrl; 00027 LPPSHNOTIFY lppsn; 00028 00029 pConInfo = (PConsoleInfo) GetWindowLongPtr(hwndDlg, DWLP_USER); 00030 00031 switch(uMsg) 00032 { 00033 case WM_INITDIALOG: 00034 { 00035 pConInfo = (PConsoleInfo) ((LPPROPSHEETPAGE)lParam)->lParam; 00036 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pConInfo); 00037 UpdateDialogElements(hwndDlg, pConInfo); 00038 return TRUE; 00039 } 00040 case WM_NOTIFY: 00041 { 00042 if (!pConInfo) 00043 { 00044 break; 00045 } 00046 lppsn = (LPPSHNOTIFY) lParam; 00047 if (lppsn->hdr.code == UDN_DELTAPOS) 00048 { 00049 hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_BUFFER_SIZE); 00050 pConInfo->HistoryBufferSize = LOWORD(SendMessage(hDlgCtrl, UDM_GETPOS, 0, 0)); 00051 00052 hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_NUM_BUFFER); 00053 pConInfo->NumberOfHistoryBuffers = LOWORD(SendMessage(hDlgCtrl, UDM_GETPOS, 0, 0)); 00054 PropSheet_Changed(GetParent(hwndDlg), hwndDlg); 00055 } 00056 else if (lppsn->hdr.code == PSN_APPLY) 00057 { 00058 if (!pConInfo->AppliedConfig) 00059 { 00060 ApplyConsoleInfo(hwndDlg, pConInfo); 00061 } 00062 else 00063 { 00064 /* Options have already been applied */ 00065 SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR); 00066 return TRUE; 00067 } 00068 return TRUE; 00069 } 00070 break; 00071 } 00072 case WM_COMMAND: 00073 { 00074 if (!pConInfo) 00075 { 00076 break; 00077 } 00078 switch(LOWORD(wParam)) 00079 { 00080 case IDC_RADIO_SMALL_CURSOR: 00081 { 00082 pConInfo->CursorSize = 0x0; 00083 PropSheet_Changed(GetParent(hwndDlg), hwndDlg); 00084 break; 00085 } 00086 case IDC_RADIO_MEDIUM_CURSOR: 00087 { 00088 pConInfo->CursorSize = 0x32; 00089 PropSheet_Changed(GetParent(hwndDlg), hwndDlg); 00090 break; 00091 } 00092 case IDC_RADIO_LARGE_CURSOR: 00093 { 00094 pConInfo->CursorSize = 0x64; 00095 PropSheet_Changed(GetParent(hwndDlg), hwndDlg); 00096 break; 00097 } 00098 case IDC_RADIO_DISPLAY_WINDOW: 00099 { 00100 pConInfo->FullScreen = FALSE; 00101 PropSheet_Changed(GetParent(hwndDlg), hwndDlg); 00102 break; 00103 } 00104 case IDC_RADIO_DISPLAY_FULL: 00105 { 00106 pConInfo->FullScreen = TRUE; 00107 PropSheet_Changed(GetParent(hwndDlg), hwndDlg); 00108 break; 00109 } 00110 case IDC_CHECK_QUICK_EDIT: 00111 { 00112 lResult = SendMessage((HWND)lParam, BM_GETCHECK, (WPARAM)0, (LPARAM)0); 00113 if (lResult == BST_CHECKED) 00114 { 00115 pConInfo->QuickEdit = FALSE; 00116 SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED, (LPARAM)0); 00117 } 00118 else if (lResult == BST_UNCHECKED) 00119 { 00120 pConInfo->QuickEdit = TRUE; 00121 SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0); 00122 } 00123 PropSheet_Changed(GetParent(hwndDlg), hwndDlg); 00124 break; 00125 } 00126 case IDC_CHECK_INSERT_MODE: 00127 { 00128 lResult = SendMessage((HWND)lParam, BM_GETCHECK, (WPARAM)0, (LPARAM)0); 00129 if (lResult == BST_CHECKED) 00130 { 00131 pConInfo->InsertMode = FALSE; 00132 SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED, (LPARAM)0); 00133 } 00134 else if (lResult == BST_UNCHECKED) 00135 { 00136 pConInfo->InsertMode = TRUE; 00137 SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0); 00138 } 00139 PropSheet_Changed(GetParent(hwndDlg), hwndDlg); 00140 break; 00141 } 00142 case IDC_CHECK_DISCARD_DUPLICATES: 00143 { 00144 lResult = SendMessage((HWND)lParam, BM_GETCHECK, (WPARAM)0, (LPARAM)0); 00145 if (lResult == BST_CHECKED) 00146 { 00147 pConInfo->HistoryNoDup = FALSE; 00148 SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_UNCHECKED, (LPARAM)0); 00149 } 00150 else if (lResult == BST_UNCHECKED) 00151 { 00152 pConInfo->HistoryNoDup = TRUE; 00153 SendMessage((HWND)lParam, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0); 00154 } 00155 PropSheet_Changed(GetParent(hwndDlg), hwndDlg); 00156 break; 00157 } 00158 default: 00159 break; 00160 } 00161 break; 00162 } 00163 default: 00164 break; 00165 } 00166 00167 return FALSE; 00168 } 00169 00170 static 00171 void 00172 UpdateDialogElements(HWND hwndDlg, PConsoleInfo pConInfo) 00173 { 00174 HWND hDlgCtrl; 00175 TCHAR szBuffer[MAX_PATH]; 00176 00177 /* Update cursor size */ 00178 if ( pConInfo->CursorSize == 0) 00179 { 00180 /* Small cursor */ 00181 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR); 00182 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); 00183 00184 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR); 00185 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); 00186 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR); 00187 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); 00188 } 00189 else if ( pConInfo->CursorSize == 0x32 ) 00190 { 00191 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR); 00192 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); 00193 00194 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR); 00195 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); 00196 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR); 00197 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); 00198 } 00199 else if ( pConInfo->CursorSize == 0x64 ) 00200 { 00201 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_LARGE_CURSOR); 00202 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); 00203 00204 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_SMALL_CURSOR); 00205 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); 00206 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_MEDIUM_CURSOR); 00207 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); 00208 } 00209 00210 /* Update num buffers */ 00211 hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_NUM_BUFFER); 00212 SendMessage(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG((short)999, (short)1)); 00213 hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_NUM_BUFFER); 00214 _stprintf(szBuffer, _T("%d"), pConInfo->NumberOfHistoryBuffers); 00215 SendMessage(hDlgCtrl, WM_SETTEXT, 0, (LPARAM)szBuffer); 00216 00217 /* Update buffer size */ 00218 hDlgCtrl = GetDlgItem(hwndDlg, IDC_UPDOWN_BUFFER_SIZE); 00219 SendMessage(hDlgCtrl, UDM_SETRANGE, 0, MAKELONG((short)999, (short)1)); 00220 hDlgCtrl = GetDlgItem(hwndDlg, IDC_EDIT_BUFFER_SIZE); 00221 _stprintf(szBuffer, _T("%d"), pConInfo->HistoryBufferSize); 00222 SendMessage(hDlgCtrl, WM_SETTEXT, 0, (LPARAM)szBuffer); 00223 00224 00225 00226 /* Update discard duplicates */ 00227 hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_DISCARD_DUPLICATES); 00228 if ( pConInfo->HistoryNoDup ) 00229 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); 00230 else 00231 SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); 00232 00233 /* Update full/window screen */ 00234 if ( pConInfo->FullScreen ) 00235 { 00236 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL); 00237 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); 00238 00239 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW); 00240 SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); 00241 } 00242 else 00243 { 00244 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_WINDOW); 00245 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); 00246 00247 hDlgCtrl = GetDlgItem(hwndDlg, IDC_RADIO_DISPLAY_FULL); 00248 SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); 00249 } 00250 00251 /* Update quick edit */ 00252 hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_QUICK_EDIT); 00253 if ( pConInfo->QuickEdit ) 00254 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); 00255 else 00256 SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); 00257 00258 /* Update insert mode */ 00259 hDlgCtrl = GetDlgItem(hwndDlg, IDC_CHECK_INSERT_MODE); 00260 if ( pConInfo->InsertMode ) 00261 SendMessage(hDlgCtrl, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); 00262 else 00263 SendMessage(hDlgCtrl, BM_SETCHECK, (LPARAM)BST_UNCHECKED, 0); 00264 } Generated on Fri May 25 2012 04:17:22 for ReactOS by
1.7.6.1
|