#include <windows.h>#include <stdio.h>#include <stdlib.h>#include <assert.h>#include "genesis.h"#include "resource.h"#include "drvlist.h"Go to the source code of this file.
Compounds | |
| struct | DrvList_LocalStruct |
Defines | |
| #define | WIN32_LEAN_AND_MEAN |
| #define | DRVLIST_OK 1 |
| #define | DRVLIST_CANCEL 2 |
| #define | DRVLIST_MAX_DISPLAY_MODES (40) |
Functions | |
| geBoolean | DrvList_FillModeList (HWND hwndDlg, int DriverNumber, DrvList_LocalStruct *DL) |
| BOOL CALLBACK | DlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| geBoolean | DrvList_PickDriver (HANDLE hInstance, HWND hwndParent, ModeList *List, int ListLength, int *ListSelection) |
Variables | |
| DrvList_LocalStruct | DrvList_Locals |
|
|
Definition at line 28 of file DRVLIST.C. Referenced by DlgProc(), and DrvList_PickDriver(). |
|
|
Definition at line 30 of file DRVLIST.C. Referenced by DlgProc(). |
|
|
Definition at line 27 of file DRVLIST.C. Referenced by DlgProc(), and DrvList_PickDriver(). |
|
|
|
|
||||||||||||||||||||
|
Definition at line 82 of file DRVLIST.C. References ModeList::Driver, ModeList::DriverNamePtr, DRVLIST_CANCEL, DrvList_FillModeList(), DrvList_Locals, DRVLIST_MAX_DISPLAY_MODES, DRVLIST_OK, hDC, HWND, IDC_DRIVERLIST, IDC_DRIVERLIST2, DrvList_LocalStruct::IndexTable, LB_ADDSTRING, DrvList_LocalStruct::ModeList, DrvList_LocalStruct::ModeListDriverCount, DrvList_LocalStruct::ModeListLength, DrvList_LocalStruct::Selection, and TRUE. Referenced by DrvList_PickDriver().
00083 {
00084 DrvList_LocalStruct *DL = &DrvList_Locals;
00085
00086 switch (uMsg)
00087 {
00088 case WM_INITDIALOG:
00089 {
00090 HWND DriverListBox;
00091 HDC hDC;
00092 int MaxCX;
00093 SIZE extents;
00094 int DriverNumber;
00095 int i,j;
00096
00097 DriverListBox = GetDlgItem(hwndDlg, IDC_DRIVERLIST);
00098 hDC = GetDC(DriverListBox);
00099
00100 MaxCX = 0;
00101
00102 DriverNumber = 0;
00103 for (i=0; i<DL->ModeListLength; i++)
00104 {
00105 int AlreadyAdded=0;
00106
00107 for (j=0; j<i; j++)
00108 {
00109 if (DL->ModeList[j].Driver == DL->ModeList[i].Driver) // only add one entry for each driver.
00110 AlreadyAdded = 1;
00111 }
00112
00113 if (!AlreadyAdded)
00114 {
00115 int index;
00116 index = SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST, LB_ADDSTRING, (WPARAM)0, (LPARAM)(DL->ModeList[i].DriverNamePtr));
00117 SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST, LB_SETITEMDATA, (WPARAM)index,(LPARAM)DriverNumber);
00118 GetTextExtentPoint32(hDC, DL->ModeList[i].DriverNamePtr, strlen(DL->ModeList[i].DriverNamePtr), &extents);
00119 if (extents.cx > MaxCX)
00120 MaxCX = extents.cx;
00121 DL->IndexTable[DriverNumber] = DL->ModeList[i].Driver;
00122 DriverNumber ++;
00123 }
00124 if (DriverNumber >= DRVLIST_MAX_DISPLAY_MODES)
00125 break;
00126 }
00127 DL->ModeListDriverCount = DriverNumber;
00128
00129 SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
00130 SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST, LB_SETHORIZONTALEXTENT, (WPARAM)MaxCX, (LPARAM)0);
00131
00132 ReleaseDC(DriverListBox, hDC);
00133
00134 DrvList_FillModeList(hwndDlg,0,DL);
00135
00136 return TRUE;
00137 }
00138 break;
00139
00140 case WM_COMMAND:
00141 switch (LOWORD(wParam))
00142 {
00143 case IDC_DRIVERLIST:
00144 if (HIWORD(wParam) == LBN_SELCHANGE)
00145 {
00146 int Driver;
00147 Driver = SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
00148 if (Driver>=0)
00149 DrvList_FillModeList(hwndDlg,Driver,DL);
00150 }
00151 break;
00152 case IDC_DRIVERLIST2:
00153 if (HIWORD(wParam) == LBN_DBLCLK)
00154 {
00155 int index;
00156 index = SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST2, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
00157 if (index>=0)
00158 {
00159 DL->Selection = SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST2, LB_GETITEMDATA, index, 0);
00160 EndDialog(hwndDlg, DRVLIST_OK);
00161 }
00162 }
00163 break;
00164 case IDOK:
00165 {
00166 int index;
00167 index = SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST2, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
00168 if (index>=0)
00169 {
00170 DL->Selection = SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST2, LB_GETITEMDATA, index, 0);
00171 EndDialog(hwndDlg, DRVLIST_OK);
00172 }
00173 }
00174 break;
00175 case IDCANCEL:
00176 EndDialog(hwndDlg, DRVLIST_CANCEL);
00177 break;
00178 }
00179 break;
00180 }
00181
00182 return 0;
00183 }
|
|
||||||||||||||||
|
Definition at line 43 of file DRVLIST.C. References ModeList::Driver, GE_FALSE, GE_TRUE, geBoolean, hDC, HWND, IDC_DRIVERLIST, IDC_DRIVERLIST2, DrvList_LocalStruct::IndexTable, LB_ADDSTRING, DrvList_LocalStruct::ModeList, DrvList_LocalStruct::ModeListLength, ModeList::ModeNamePtr, and NULL. Referenced by DlgProc().
00044 {
00045 int i;
00046 int MaxCX = 0;
00047 SIZE extents;
00048 HWND ListBox;
00049 HDC hDC;
00050
00051 ListBox = GetDlgItem(hwndDlg, IDC_DRIVERLIST);
00052 if (ListBox ==NULL)
00053 return GE_FALSE;
00054
00055 hDC = GetDC(ListBox);
00056 if (hDC == NULL)
00057 return GE_FALSE;
00058
00059 SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST2, LB_RESETCONTENT, (WPARAM)0, (LPARAM)0);
00060
00061 for (i=0; i<DL->ModeListLength; i++)
00062 {
00063 if (DL->IndexTable[DriverNumber] == DL->ModeList[i].Driver)
00064 {
00065 int index;
00066 index = SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST2, LB_ADDSTRING, (WPARAM)0,
00067 (LPARAM)(DL->ModeList[i].ModeNamePtr));
00068 SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST2, LB_SETITEMDATA, (WPARAM)index,(LPARAM)i);
00069 GetTextExtentPoint32(hDC, DL->ModeList[i].ModeNamePtr, strlen(DL->ModeList[i].ModeNamePtr), &extents);
00070 if (extents.cx > MaxCX)
00071 MaxCX = extents.cx;
00072 }
00073 }
00074 SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST2, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
00075 SendDlgItemMessage(hwndDlg, IDC_DRIVERLIST2, LB_SETHORIZONTALEXTENT, (WPARAM)MaxCX, (LPARAM)0);
00076 ReleaseDC(ListBox, hDC);
00077 return GE_TRUE;
00078 }
|
|
||||||||||||||||||||||||
|
Definition at line 185 of file DRVLIST.C. References DlgProc(), DRVLIST_CANCEL, DrvList_Locals, DRVLIST_OK, GE_FALSE, GE_TRUE, geBoolean, IDD_DRIVERDIALOG, List, DrvList_LocalStruct::ModeList, DrvList_LocalStruct::ModeListDriverCount, DrvList_LocalStruct::ModeListLength, NULL, and DrvList_LocalStruct::Selection. Referenced by PickMode().
00187 {
00188 int res;
00189 DrvList_LocalStruct *DL = &DrvList_Locals;
00190
00191 assert( hInstance != 0 );
00192 assert( List != NULL );
00193 assert( ListLength >=0 );
00194 assert( ListSelection != NULL );
00195
00196
00197 DL->ModeList = List;
00198 DL->ModeListLength = ListLength;
00199 DL->ModeListDriverCount = 0;
00200 DL->Selection = -1;
00201
00202 res = DialogBoxParam(hInstance,
00203 MAKEINTRESOURCE(IDD_DRIVERDIALOG),
00204 hwndParent,
00205 DlgProc,
00206 (LPARAM)0);
00207
00208 *ListSelection = DL->Selection;
00209
00210 if (res == DRVLIST_OK || res == DRVLIST_CANCEL)
00211 {
00212 return GE_TRUE;
00213 }
00214
00215 return GE_FALSE;
00216 }
|
|
|
Definition at line 41 of file DRVLIST.C. Referenced by DlgProc(), and DrvList_PickDriver(). |
1.3.2