winecfg: Let the user specify the drive letter of a to be added drive. (try 2)
Rein Klazes
wijn at online.nl
Sun Aug 16 13:37:10 CDT 2009
try 2: just change English and Dutch resources
fixes bug#14728
---
programs/winecfg/En.rc | 10 +++++++++
programs/winecfg/Nl.rc | 10 +++++++++
programs/winecfg/driveui.c | 48 ++++++++++++++++++++++++++++++++++++++++++-
programs/winecfg/resource.h | 2 +
4 files changed, 69 insertions(+), 1 deletions(-)
diff --git a/programs/winecfg/En.rc b/programs/winecfg/En.rc
index 049aaa7..6aa5120 100644
--- a/programs/winecfg/En.rc
+++ b/programs/winecfg/En.rc
@@ -124,6 +124,16 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,57,74,45,14,WS_GROUP
END
+IDD_DRIVECHOOSE DIALOG DISCARDABLE 60, 70, 170, 60
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Select Drive Letter"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ COMBOBOX IDC_DRIVESA2Z,15,10,75,230,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "OK",IDOK,105,10,45,14,WS_GROUP
+ PUSHBUTTON "Cancel",IDCANCEL,105,30,45,14,WS_GROUP
+END
+
IDD_DRIVECFG DIALOG DISCARDABLE 0, 0, 260, 250
STYLE WS_CHILD | WS_DISABLED
FONT 8, "MS Shell Dlg"
diff --git a/programs/winecfg/Nl.rc b/programs/winecfg/Nl.rc
index 4cd45f0..2fbba6a 100644
--- a/programs/winecfg/Nl.rc
+++ b/programs/winecfg/Nl.rc
@@ -125,6 +125,16 @@ BEGIN
PUSHBUTTON "Annuleren",IDCANCEL,57,74,45,14,WS_GROUP
END
+IDD_DRIVECHOOSE DIALOG DISCARDABLE 60, 70, 170, 60
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Selecteer Stationsletter"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ COMBOBOX IDC_DRIVESA2Z,15,10,75,230,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "OK",IDOK,105,10,45,14,WS_GROUP
+ PUSHBUTTON "Annuleren",IDCANCEL,105,30,45,14,WS_GROUP
+END
+
IDD_DRIVECFG DIALOG DISCARDABLE 0, 0, 260, 250
STYLE WS_CHILD | WS_DISABLED
FONT 8, "MS Shell Dlg"
diff --git a/programs/winecfg/driveui.c b/programs/winecfg/driveui.c
index de54f21..87af06c 100644
--- a/programs/winecfg/driveui.c
+++ b/programs/winecfg/driveui.c
@@ -291,6 +291,47 @@ static void on_options_click(HWND dialog)
SendMessage(GetParent(dialog), PSM_CHANGED, 0, 0);
}
+static INT_PTR CALLBACK drivechoose_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ static int i, sel;
+ char c;
+ char drive[] = "X:";
+
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ ULONG mask = ~drive_available_mask(0); /* the mask is now which drives aren't available */
+ for( c = 'A'; c<= 'Z'; c++){
+ drive[0] = c;
+ if(!( mask & (1 << (c - 'A'))))
+ SendDlgItemMessageA( hwndDlg, IDC_DRIVESA2Z, CB_ADDSTRING, 0, (LPARAM) drive);
+ }
+ drive[0] = lParam;
+ SendDlgItemMessageA( hwndDlg, IDC_DRIVESA2Z, CB_SELECTSTRING, 0, (LPARAM) drive);
+ return TRUE;
+ }
+ case WM_COMMAND:
+ if(HIWORD(wParam) != BN_CLICKED) break;
+ switch (LOWORD(wParam))
+ {
+ case IDOK:
+ i = SendDlgItemMessageA( hwndDlg, IDC_DRIVESA2Z, CB_GETCURSEL, 0, 0);
+ if( i != CB_ERR){
+ SendDlgItemMessageA( hwndDlg, IDC_DRIVESA2Z, CB_GETLBTEXT, i, (LPARAM) drive);
+ sel = drive[0];
+ } else
+ sel = -1;
+ EndDialog(hwndDlg, sel);
+ return TRUE;
+ case IDCANCEL:
+ EndDialog(hwndDlg, -1);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
static void on_add_click(HWND dialog)
{
/* we should allocate a drive letter automatically. We also need
@@ -313,7 +354,12 @@ static void on_add_click(HWND dialog)
}
}
- WINE_TRACE("allocating drive letter %c\n", new);
+
+ new = DialogBoxParam(0, MAKEINTRESOURCE(IDD_DRIVECHOOSE), dialog, drivechoose_dlgproc, new);
+
+ if( new == -1) return;
+
+ WINE_TRACE("selected drive letter %c\n", new);
if (new == 'C')
{
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
index 27736b7..f006861 100644
--- a/programs/winecfg/resource.h
+++ b/programs/winecfg/resource.h
@@ -146,6 +146,8 @@
#define IDS_COL_DRIVELETTER 8208
#define IDS_COL_DRIVEMAPPING 8209
#define IDS_NO_DRIVE_C 8210
+#define IDD_DRIVECHOOSE 8211
+#define IDC_DRIVESA2Z 8212
/* graphics */
#define IDC_ENABLE_MANAGED 1100
--
1.6.3.3
More information about the wine-patches
mailing list