2 * Drive management UI code
4 * Copyright 2003 Mark Westcott
5 * Copyright 2004 Chris Morgan
6 * Copyright 2003-2004 Mike Hearn
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #define WIN32_LEAN_AND_MEAN
36 #include <wine/debug.h>
41 WINE_DEFAULT_DEBUG_CHANNEL(winecfg
);
43 #define BOX_MODE_CD_ASSIGN 1
44 #define BOX_MODE_CD_AUTODETECT 2
45 #define BOX_MODE_NONE 3
46 #define BOX_MODE_NORMAL 4
48 static BOOL advanced
= FALSE
;
49 static BOOL updating_ui
= FALSE
;
50 static struct drive
* current_drive
;
52 static void get_etched_rect(HWND dialog
, RECT
*rect
);
53 static void update_controls(HWND dialog
);
55 /**** listview helper functions ****/
57 /* clears the item at index in the listview */
58 static void lv_clear_curr_select(HWND dialog
, int index
)
60 ListView_SetItemState(GetDlgItem(dialog
, IDC_LIST_DRIVES
), index
, 0, LVIS_SELECTED
);
63 /* selects the item at index in the listview */
64 static void lv_set_curr_select(HWND dialog
, int index
)
66 /* no more than one item can be selected in our listview */
67 lv_clear_curr_select(dialog
, -1);
68 ListView_SetItemState(GetDlgItem(dialog
, IDC_LIST_DRIVES
), index
, LVIS_SELECTED
, LVIS_SELECTED
);
71 /* returns the currently selected item in the listview */
72 static int lv_get_curr_select(HWND dialog
)
74 return SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_GETNEXTITEM
, -1, LVNI_SELECTED
);
77 /* sets the item in the listview at item->iIndex */
78 static void lv_set_item(HWND dialog
, LVITEM
*item
)
80 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_SETITEM
, 0, (LPARAM
) item
);
83 /* sets specified item's text */
84 static void lv_set_item_text(HWND dialog
, int item
, int subItem
, char *text
)
87 if (item
< 0 || subItem
< 0) return;
88 lvItem
.mask
= LVIF_TEXT
;
90 lvItem
.iSubItem
= subItem
;
91 lvItem
.pszText
= text
;
92 lvItem
.cchTextMax
= lstrlen(lvItem
.pszText
);
93 lv_set_item(dialog
, &lvItem
);
96 /* inserts an item into the listview */
97 static void lv_insert_item(HWND dialog
, LVITEM
*item
)
99 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_INSERTITEM
, 0, (LPARAM
) item
);
102 /* retrieve the item at index item->iIndex */
103 static void lv_get_item(HWND dialog
, LVITEM
*item
)
105 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_GETITEM
, 0, (LPARAM
) item
);
108 static void set_advanced(HWND dialog
)
117 LoadString(GetModuleHandle(NULL
), IDS_HIDE_ADVANCED
, text
, 256);
122 LoadString(GetModuleHandle(NULL
), IDS_SHOW_ADVANCED
, text
, 256);
125 ShowWindow(GetDlgItem(dialog
, IDC_RADIO_AUTODETECT
), state
);
126 ShowWindow(GetDlgItem(dialog
, IDC_RADIO_ASSIGN
), state
);
127 ShowWindow(GetDlgItem(dialog
, IDC_EDIT_LABEL
), state
);
128 ShowWindow(GetDlgItem(dialog
, IDC_EDIT_DEVICE
), state
);
129 ShowWindow(GetDlgItem(dialog
, IDC_STATIC_LABEL
), state
);
130 ShowWindow(GetDlgItem(dialog
, IDC_BUTTON_BROWSE_DEVICE
), state
);
131 ShowWindow(GetDlgItem(dialog
, IDC_EDIT_SERIAL
), state
);
132 ShowWindow(GetDlgItem(dialog
, IDC_STATIC_SERIAL
), state
);
133 ShowWindow(GetDlgItem(dialog
, IDC_LABELSERIAL_STATIC
), state
);
134 ShowWindow(GetDlgItem(dialog
, IDC_COMBO_TYPE
), state
);
135 ShowWindow(GetDlgItem(dialog
, IDC_STATIC_TYPE
), state
);
137 /* update the button text based on the state */
138 SetWindowText(GetDlgItem(dialog
, IDC_BUTTON_SHOW_HIDE_ADVANCED
), text
);
140 /* redraw for the etched line */
141 get_etched_rect(dialog
, &rect
);
142 InflateRect(&rect
, 5, 5);
143 InvalidateRect(dialog
, &rect
, TRUE
);
146 struct drive_typemap
{
151 static const struct drive_typemap type_pairs
[] = {
152 { DRIVE_UNKNOWN
, "Autodetect" },
153 { DRIVE_FIXED
, "Local hard disk" },
154 { DRIVE_REMOTE
, "Network share" },
155 { DRIVE_REMOVABLE
, "Floppy disk" },
156 { DRIVE_CDROM
, "CD-ROM" }
159 #define DRIVE_TYPE_DEFAULT 0
161 static void fill_drive_droplist(long mask
, char curletter
, HWND dialog
)
170 for (i
= 0, count
= 0, selection
= -1, next_letter
= -1; i
<= 'Z'-'A'; ++i
)
172 if (mask
& DRIVE_MASK_BIT('A' + i
))
177 index
= SendDlgItemMessage(dialog
, IDC_COMBO_LETTER
, CB_ADDSTRING
, 0, (LPARAM
) sName
);
179 if (toupper(curletter
) == 'A' + i
)
184 if (i
>= 2 && next_letter
== -1)
186 /* default drive is first one of C-Z */
196 selection
= next_letter
;
199 SendDlgItemMessage(dialog
, IDC_COMBO_LETTER
, CB_SETCURSEL
, selection
, 0);
203 static void enable_labelserial_box(HWND dialog
, int mode
)
205 WINE_TRACE("mode=%d\n", mode
);
209 case BOX_MODE_CD_ASSIGN
:
210 enable(IDC_RADIO_ASSIGN
);
211 disable(IDC_EDIT_DEVICE
);
212 disable(IDC_BUTTON_BROWSE_DEVICE
);
213 enable(IDC_EDIT_SERIAL
);
214 enable(IDC_EDIT_LABEL
);
215 enable(IDC_STATIC_SERIAL
);
216 enable(IDC_STATIC_LABEL
);
219 case BOX_MODE_CD_AUTODETECT
:
220 enable(IDC_RADIO_ASSIGN
);
221 enable(IDC_EDIT_DEVICE
);
222 enable(IDC_BUTTON_BROWSE_DEVICE
);
223 disable(IDC_EDIT_SERIAL
);
224 disable(IDC_EDIT_LABEL
);
225 disable(IDC_STATIC_SERIAL
);
226 disable(IDC_STATIC_LABEL
);
230 disable(IDC_RADIO_ASSIGN
);
231 disable(IDC_EDIT_DEVICE
);
232 disable(IDC_BUTTON_BROWSE_DEVICE
);
233 disable(IDC_EDIT_SERIAL
);
234 disable(IDC_EDIT_LABEL
);
235 disable(IDC_STATIC_SERIAL
);
236 disable(IDC_STATIC_LABEL
);
239 case BOX_MODE_NORMAL
:
240 enable(IDC_RADIO_ASSIGN
);
241 disable(IDC_EDIT_DEVICE
);
242 disable(IDC_BUTTON_BROWSE_DEVICE
);
243 enable(IDC_EDIT_SERIAL
);
244 enable(IDC_EDIT_LABEL
);
245 enable(IDC_STATIC_SERIAL
);
246 enable(IDC_STATIC_LABEL
);
251 static int fill_drives_list(HWND dialog
)
254 BOOL drivec_present
= FALSE
;
262 prevsel
= lv_get_curr_select(dialog
);
264 /* Clear the listbox */
265 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_DELETEALLITEMS
, 0, 0);
267 for(i
= 0; i
< 26; i
++)
272 /* skip over any unused drives */
273 if (!drives
[i
].in_use
)
276 if (drives
[i
].letter
== 'C')
277 drivec_present
= TRUE
;
283 memset(&item
, 0, sizeof(item
));
284 item
.mask
= LVIF_TEXT
| LVIF_PARAM
;
287 item
.pszText
= letter
;
288 item
.cchTextMax
= lstrlen(item
.pszText
);
289 item
.lParam
= (LPARAM
) &drives
[i
];
291 lv_insert_item(dialog
, &item
);
292 lv_set_item_text(dialog
, count
, 1, drives
[i
].unixpath
);
297 WINE_TRACE("loaded %d drives\n", count
);
299 /* show the warning if there is no Drive C */
301 ShowWindow(GetDlgItem(dialog
, IDS_DRIVE_NO_C
), SW_NORMAL
);
303 ShowWindow(GetDlgItem(dialog
, IDS_DRIVE_NO_C
), SW_HIDE
);
305 lv_set_curr_select(dialog
, prevsel
== -1 ? 0 : prevsel
);
311 static void on_options_click(HWND dialog
)
313 if (IsDlgButtonChecked(dialog
, IDC_SHOW_DOT_FILES
) == BST_CHECKED
)
314 set_reg_key(config_key
, "", "ShowDotFiles", "Y");
316 set_reg_key(config_key
, "", "ShowDotFiles", "N");
318 SendMessage(GetParent(dialog
), PSM_CHANGED
, 0, 0);
321 static void on_add_click(HWND dialog
)
323 /* we should allocate a drive letter automatically. We also need
324 some way to let the user choose the mapping point, for now we
325 will just force them to enter a path automatically, with / being
326 the default. In future we should be able to temporarily map /
327 then invoke the directory chooser dialog. */
329 char new = 'C'; /* we skip A and B, they are historically floppy drives */
330 long mask
= ~drive_available_mask(0); /* the mask is now which drives aren't available */
333 while (mask
& (1 << (new - 'A')))
338 MessageBox(dialog
, "You cannot add any more drives.\n\nEach drive must have a letter, from A to Z, so you cannot have more than 26", "", MB_OK
| MB_ICONEXCLAMATION
);
343 WINE_TRACE("allocating drive letter %c\n", new);
345 if (new == 'C') add_drive(new, "../drive_c", "System Drive", "", DRIVE_FIXED
);
346 else add_drive(new, "/", "", "", DRIVE_UNKNOWN
);
348 fill_drives_list(dialog
);
350 /* select the newly created drive */
351 mask
= ~drive_available_mask(0);
353 for (i
= 0; i
< 26; i
++)
355 if ('A' + i
== new) break;
356 if ((1 << i
) & mask
) c
++;
358 lv_set_curr_select(dialog
, c
);
360 SetFocus(GetDlgItem(dialog
, IDC_LIST_DRIVES
));
362 update_controls(dialog
);
365 static void on_remove_click(HWND dialog
)
371 itemIndex
= lv_get_curr_select(dialog
);
372 if (itemIndex
== -1) return; /* no selection */
374 memset(&item
, 0, sizeof(item
));
375 item
.mask
= LVIF_PARAM
;
376 item
.iItem
= itemIndex
;
379 lv_get_item(dialog
, &item
);
381 drive
= (struct drive
*) item
.lParam
;
383 WINE_ERR("unixpath: %s\n", drive
->unixpath
);
385 if (drive
->letter
== 'C')
387 DWORD result
= MessageBox(dialog
, "Are you sure you want to delete drive C?\n\nMost Windows applications expect drive C to exist, and will die messily if it doesn't. If you proceed remember to recreate it!", "", MB_YESNO
| MB_ICONEXCLAMATION
);
388 if (result
== IDNO
) return;
393 fill_drives_list(dialog
);
395 itemIndex
= itemIndex
- 1;
396 if (itemIndex
< 0) itemIndex
= 0;
397 lv_set_curr_select(dialog
, itemIndex
); /* previous item */
399 SetFocus(GetDlgItem(dialog
, IDC_LIST_DRIVES
));
401 update_controls(dialog
);
404 static void update_controls(HWND dialog
)
411 int i
, selection
= -1;
416 i
= lv_get_curr_select(dialog
);
419 /* no selection? let's select something for the user. this will re-enter */
420 lv_set_curr_select(dialog
, i
);
424 memset(&item
, 0, sizeof(item
));
425 item
.mask
= LVIF_PARAM
;
429 lv_get_item(dialog
, &item
);
430 current_drive
= (struct drive
*) item
.lParam
;
432 WINE_TRACE("Updating sheet for drive %c\n", current_drive
->letter
);
435 fill_drive_droplist(drive_available_mask(current_drive
->letter
), current_drive
->letter
, dialog
);
438 path
= current_drive
->unixpath
;
439 WINE_TRACE("set path control text to '%s'\n", path
);
440 set_text(dialog
, IDC_EDIT_PATH
, path
);
443 type
= current_drive
->type
;
444 SendDlgItemMessage(dialog
, IDC_COMBO_TYPE
, CB_RESETCONTENT
, 0, 0);
446 for (i
= 0; i
< sizeof(type_pairs
) / sizeof(struct drive_typemap
); i
++)
448 SendDlgItemMessage(dialog
, IDC_COMBO_TYPE
, CB_ADDSTRING
, 0, (LPARAM
) type_pairs
[i
].sDesc
);
450 if (type_pairs
[i
].sCode
== type
)
456 if (selection
== -1) selection
= DRIVE_TYPE_DEFAULT
;
457 SendDlgItemMessage(dialog
, IDC_COMBO_TYPE
, CB_SETCURSEL
, selection
, 0);
459 /* removeable media properties */
460 label
= current_drive
->label
;
461 set_text(dialog
, IDC_EDIT_LABEL
, label
);
463 /* set serial edit text */
464 serial
= current_drive
->serial
;
465 set_text(dialog
, IDC_EDIT_SERIAL
, serial
);
467 /* TODO: get the device here to put into the edit box */
468 device
= "Not implemented yet";
469 set_text(dialog
, IDC_EDIT_DEVICE
, device
);
472 selection
= IDC_RADIO_ASSIGN
;
473 if ((type
== DRIVE_CDROM
) || (type
== DRIVE_REMOVABLE
))
477 selection
= IDC_RADIO_AUTODETECT
;
478 enable_labelserial_box(dialog
, BOX_MODE_CD_AUTODETECT
);
482 selection
= IDC_RADIO_ASSIGN
;
483 enable_labelserial_box(dialog
, BOX_MODE_CD_ASSIGN
);
488 enable_labelserial_box(dialog
, BOX_MODE_NORMAL
);
489 selection
= IDC_RADIO_ASSIGN
;
492 CheckRadioButton(dialog
, IDC_RADIO_AUTODETECT
, IDC_RADIO_ASSIGN
, selection
);
499 static void on_edit_changed(HWND dialog
, WORD id
)
501 if (updating_ui
) return;
503 WINE_TRACE("edit id %d changed\n", id
);
511 label
= get_text(dialog
, id
);
512 HeapFree(GetProcessHeap(), 0, current_drive
->label
);
513 current_drive
->label
= label
? label
: strdupA("");
515 WINE_TRACE("set label to %s\n", current_drive
->label
);
517 /* enable the apply button */
518 SendMessage(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
526 path
= get_text(dialog
, id
);
527 HeapFree(GetProcessHeap(), 0, current_drive
->unixpath
);
528 current_drive
->unixpath
= path
? path
: strdupA("drive_c");
530 WINE_TRACE("set path to %s\n", current_drive
->unixpath
);
532 lv_set_item_text(dialog
, lv_get_curr_select(dialog
), 1,
533 current_drive
->unixpath
);
535 /* enable the apply button */
536 SendMessage(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
540 case IDC_EDIT_SERIAL
:
544 serial
= get_text(dialog
, id
);
545 HeapFree(GetProcessHeap(), 0, current_drive
->serial
);
546 current_drive
->serial
= serial
? serial
: strdupA("");
548 WINE_TRACE("set serial to %s", current_drive
->serial
);
550 /* enable the apply button */
551 SendMessage(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
555 case IDC_EDIT_DEVICE
:
557 char *device
= get_text(dialog
, id
);
558 /* TODO: handle device if/when it makes sense to do so.... */
559 HeapFree(GetProcessHeap(), 0, device
);
565 static void get_etched_rect(HWND dialog
, RECT
*rect
)
567 GetClientRect(dialog
, rect
);
569 /* these dimensions from the labelserial static in En.rc */
576 /* this just draws a nice line to separate the advanced gui from the n00b gui :) */
577 static void paint(HWND dialog
)
581 BeginPaint(dialog
, &ps
);
587 get_etched_rect(dialog
, &rect
);
589 DrawEdge(ps
.hdc
, &rect
, EDGE_ETCHED
, BF_TOP
);
592 EndPaint(dialog
, &ps
);
595 BOOL
browse_for_unix_folder(HWND dialog
, char *pszPath
)
597 static WCHAR wszUnixRootDisplayName
[] =
598 { ':',':','{','C','C','7','0','2','E','B','2','-','7','D','C','5','-','1','1','D','9','-',
599 'C','6','8','7','-','0','0','0','4','2','3','8','A','0','1','C','D','}', 0 };
600 char pszChoosePath
[256];
611 IShellFolder
*pDesktop
;
612 LPITEMIDLIST pidlUnixRoot
, pidlSelectedPath
;
615 LoadString(GetModuleHandle(NULL
), IDS_CHOOSE_PATH
, pszChoosePath
, 256);
617 hr
= SHGetDesktopFolder(&pDesktop
);
618 if (!SUCCEEDED(hr
)) return FALSE
;
620 hr
= IShellFolder_ParseDisplayName(pDesktop
, NULL
, NULL
, wszUnixRootDisplayName
, NULL
,
621 &pidlUnixRoot
, NULL
);
622 if (!SUCCEEDED(hr
)) {
623 IShellFolder_Release(pDesktop
);
627 bi
.pidlRoot
= pidlUnixRoot
;
628 pidlSelectedPath
= SHBrowseForFolderA(&bi
);
629 SHFree(pidlUnixRoot
);
631 if (pidlSelectedPath
) {
632 STRRET strSelectedPath
;
633 char *pszSelectedPath
;
636 hr
= IShellFolder_GetDisplayNameOf(pDesktop
, pidlSelectedPath
, SHGDN_FORPARSING
,
638 IShellFolder_Release(pDesktop
);
639 if (!SUCCEEDED(hr
)) {
640 SHFree(pidlSelectedPath
);
644 hr
= StrRetToStr(&strSelectedPath
, pidlSelectedPath
, &pszSelectedPath
);
645 SHFree(pidlSelectedPath
);
646 if (!SUCCEEDED(hr
)) return FALSE
;
648 lstrcpy(pszPath
, pszSelectedPath
);
650 CoTaskMemFree(pszSelectedPath
);
656 static void init_listview_columns(HWND dialog
)
662 GetClientRect(GetDlgItem(dialog
, IDC_LIST_DRIVES
), &viewRect
);
663 width
= (viewRect
.right
- viewRect
.left
) / 6 - 5;
665 listColumn
.mask
= LVCF_TEXT
| LVCF_WIDTH
| LVCF_SUBITEM
;
666 listColumn
.pszText
= (char*) "Letter";
667 listColumn
.cchTextMax
= lstrlen(listColumn
.pszText
);
668 listColumn
.cx
= width
;
670 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_INSERTCOLUMN
, 0, (LPARAM
) &listColumn
);
672 listColumn
.cx
= viewRect
.right
- viewRect
.left
- width
;
673 listColumn
.pszText
= (char*) "Drive Mapping";
674 listColumn
.cchTextMax
= lstrlen(listColumn
.pszText
);
676 SendDlgItemMessage(dialog
, IDC_LIST_DRIVES
, LVM_INSERTCOLUMN
, 1, (LPARAM
) &listColumn
);
679 static void load_drive_options(HWND dialog
)
681 if (!strcmp(get_reg_key(config_key
, "", "ShowDotFiles", "N"), "Y"))
682 CheckDlgButton(dialog
, IDC_SHOW_DOT_FILES
, BST_CHECKED
);
686 DriveDlgProc (HWND dialog
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
694 init_listview_columns(dialog
);
696 load_drive_options(dialog
);
698 if (!drives
[2].in_use
)
699 MessageBox(dialog
, "You don't have a drive C. This is not so great.\n\nRemember to click 'Add' in the Drives tab to create one!\n", "", MB_OK
| MB_ICONEXCLAMATION
);
701 fill_drives_list(dialog
);
702 update_controls(dialog
);
703 /* put in non-advanced mode by default */
704 set_advanced(dialog
);
708 set_window_title(dialog
);
716 switch (HIWORD(wParam
))
719 on_edit_changed(dialog
, LOWORD(wParam
));
723 switch (LOWORD(wParam
))
725 case IDC_SHOW_DOT_FILES
:
726 on_options_click(dialog
);
732 SendMessage(GetParent(dialog
), PSM_CHANGED
, 0, 0);
736 switch (LOWORD(wParam
))
739 if (HIWORD(wParam
) != BN_CLICKED
) break;
740 on_add_click(dialog
);
743 case IDC_BUTTON_REMOVE
:
744 if (HIWORD(wParam
) != BN_CLICKED
) break;
745 on_remove_click(dialog
);
748 case IDC_BUTTON_EDIT
:
749 if (HIWORD(wParam
) != BN_CLICKED
) break;
750 item
= SendMessage(GetDlgItem(dialog
, IDC_LIST_DRIVES
), LB_GETCURSEL
, 0, 0);
751 drive
= (struct drive
*) SendMessage(GetDlgItem(dialog
, IDC_LIST_DRIVES
), LB_GETITEMDATA
, item
, 0);
752 /*DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_DRIVE_EDIT), NULL, (DLGPROC) DriveEditDlgProc, (LPARAM) drive); */
755 case IDC_BUTTON_AUTODETECT
:
757 fill_drives_list(dialog
);
758 SendMessage(GetParent(dialog
), PSM_CHANGED
, 0, 0);
761 case IDC_BUTTON_SHOW_HIDE_ADVANCED
:
762 advanced
= !advanced
;
763 set_advanced(dialog
);
766 case IDC_BUTTON_BROWSE_PATH
:
768 char szTargetPath
[FILENAME_MAX
];
769 if (browse_for_unix_folder(dialog
, szTargetPath
))
770 set_text(dialog
, IDC_EDIT_PATH
, szTargetPath
);
774 case IDC_RADIO_ASSIGN
:
778 str
= get_text(dialog
, IDC_EDIT_LABEL
);
779 HeapFree(GetProcessHeap(), 0, current_drive
->label
);
780 current_drive
->label
= str
? str
: strdupA("");
782 str
= get_text(dialog
, IDC_EDIT_SERIAL
);
783 HeapFree(GetProcessHeap(), 0, current_drive
->serial
);
784 current_drive
->serial
= str
? str
: strdupA("");
786 /* TODO: we don't have a device at this point */
788 enable_labelserial_box(dialog
, BOX_MODE_CD_ASSIGN
);
796 int mode
= BOX_MODE_NORMAL
;
799 if (HIWORD(wParam
) != CBN_SELCHANGE
) break;
801 selection
= SendDlgItemMessage(dialog
, IDC_COMBO_TYPE
, CB_GETCURSEL
, 0, 0);
803 if (selection
>= 0 &&
804 (type_pairs
[selection
].sCode
== DRIVE_CDROM
||
805 type_pairs
[selection
].sCode
== DRIVE_REMOVABLE
))
807 if (IsDlgButtonChecked(dialog
, IDC_RADIO_AUTODETECT
))
808 mode
= BOX_MODE_CD_AUTODETECT
;
810 mode
= BOX_MODE_CD_ASSIGN
;
813 enable_labelserial_box(dialog
, mode
);
815 current_drive
->type
= type_pairs
[selection
].sCode
;
823 switch (((LPNMHDR
)lParam
)->code
)
826 WINE_TRACE("PSN_KILLACTIVE\n");
827 SetWindowLongPtr(dialog
, DWLP_MSGRESULT
, FALSE
);
830 apply_drive_changes();
831 SetWindowLongPtr(dialog
, DWLP_MSGRESULT
, PSNRET_NOERROR
);
835 case LVN_ITEMCHANGED
:
837 LPNMLISTVIEW lpnm
= (LPNMLISTVIEW
)lParam
;
838 if (!(lpnm
->uOldState
& LVIS_SELECTED
) &&
839 (lpnm
->uNewState
& LVIS_SELECTED
))
840 update_controls(dialog
);