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_DEVICE 1
44 #define BOX_MODE_NORMAL 2
46 static BOOL advanced
= FALSE
;
47 static BOOL updating_ui
= FALSE
;
48 static struct drive
* current_drive
;
50 static void update_controls(HWND dialog
);
52 static DWORD
driveui_msgbox (HWND parent
, UINT messageId
, DWORD flags
)
54 WCHAR
* caption
= load_string (IDS_WINECFG_TITLE
);
55 WCHAR
* text
= load_string (messageId
);
56 DWORD result
= MessageBoxW (parent
, text
, caption
, flags
);
62 /**** listview helper functions ****/
64 /* clears the item at index in the listview */
65 static void lv_clear_curr_select(HWND dialog
, int index
)
69 item
.mask
= LVIF_STATE
;
71 item
.stateMask
= LVIS_SELECTED
;
72 SendDlgItemMessageW( dialog
, IDC_LIST_DRIVES
, LVM_SETITEMSTATE
, index
, (LPARAM
)&item
);
75 /* selects the item at index in the listview */
76 static void lv_set_curr_select(HWND dialog
, int index
)
80 /* no more than one item can be selected in our listview */
81 lv_clear_curr_select(dialog
, -1);
82 item
.mask
= LVIF_STATE
;
83 item
.state
= LVIS_SELECTED
;
84 item
.stateMask
= LVIS_SELECTED
;
85 SendDlgItemMessageW( dialog
, IDC_LIST_DRIVES
, LVM_SETITEMSTATE
, index
, (LPARAM
)&item
);
88 /* returns the currently selected item in the listview */
89 static int lv_get_curr_select(HWND dialog
)
91 return SendDlgItemMessageW(dialog
, IDC_LIST_DRIVES
, LVM_GETNEXTITEM
, -1, LVNI_SELECTED
);
94 /* sets the item in the listview at item->iIndex */
95 static void lv_set_item(HWND dialog
, LVITEMW
*item
)
97 SendDlgItemMessageW(dialog
, IDC_LIST_DRIVES
, LVM_SETITEMW
, 0, (LPARAM
) item
);
100 /* sets specified item's text */
101 static void lv_set_item_text(HWND dialog
, int item
, int subItem
, WCHAR
*text
)
104 if (item
< 0 || subItem
< 0) return;
105 lvItem
.mask
= LVIF_TEXT
;
107 lvItem
.iSubItem
= subItem
;
108 lvItem
.pszText
= text
;
109 lvItem
.cchTextMax
= lstrlenW(lvItem
.pszText
);
110 lv_set_item(dialog
, &lvItem
);
113 /* inserts an item into the listview */
114 static void lv_insert_item(HWND dialog
, LVITEMW
*item
)
116 SendDlgItemMessageW(dialog
, IDC_LIST_DRIVES
, LVM_INSERTITEMW
, 0, (LPARAM
) item
);
119 /* retrieve the item at index item->iIndex */
120 static void lv_get_item(HWND dialog
, LVITEMW
*item
)
122 SendDlgItemMessageW(dialog
, IDC_LIST_DRIVES
, LVM_GETITEMW
, 0, (LPARAM
) item
);
125 static void set_advanced(HWND dialog
)
133 LoadStringW(GetModuleHandleW(NULL
), IDS_HIDE_ADVANCED
, text
, 256);
138 LoadStringW(GetModuleHandleW(NULL
), IDS_SHOW_ADVANCED
, text
, 256);
141 ShowWindow(GetDlgItem(dialog
, IDC_EDIT_DEVICE
), state
);
142 ShowWindow(GetDlgItem(dialog
, IDC_STATIC_DEVICE
), state
);
143 ShowWindow(GetDlgItem(dialog
, IDC_EDIT_LABEL
), state
);
144 ShowWindow(GetDlgItem(dialog
, IDC_STATIC_LABEL
), state
);
145 ShowWindow(GetDlgItem(dialog
, IDC_BUTTON_BROWSE_DEVICE
), state
);
146 ShowWindow(GetDlgItem(dialog
, IDC_EDIT_SERIAL
), state
);
147 ShowWindow(GetDlgItem(dialog
, IDC_STATIC_SERIAL
), state
);
148 ShowWindow(GetDlgItem(dialog
, IDC_COMBO_TYPE
), state
);
149 ShowWindow(GetDlgItem(dialog
, IDC_STATIC_TYPE
), state
);
151 /* update the button text based on the state */
152 SetWindowTextW(GetDlgItem(dialog
, IDC_BUTTON_SHOW_HIDE_ADVANCED
), text
);
155 struct drive_typemap
{
160 static const struct drive_typemap type_pairs
[] = {
161 { DRIVE_UNKNOWN
, IDS_DRIVE_UNKNOWN
},
162 { DRIVE_FIXED
, IDS_DRIVE_FIXED
},
163 { DRIVE_REMOTE
, IDS_DRIVE_REMOTE
},
164 { DRIVE_REMOVABLE
, IDS_DRIVE_REMOVABLE
},
165 { DRIVE_CDROM
, IDS_DRIVE_CDROM
}
168 #define DRIVE_TYPE_DEFAULT 0
170 static void enable_labelserial_box(HWND dialog
, int mode
)
172 WINE_TRACE("mode=%d\n", mode
);
176 case BOX_MODE_DEVICE
:
177 /* FIXME: enable device editing */
178 disable(IDC_EDIT_DEVICE
);
179 disable(IDC_BUTTON_BROWSE_DEVICE
);
180 disable(IDC_EDIT_SERIAL
);
181 disable(IDC_EDIT_LABEL
);
184 case BOX_MODE_NORMAL
:
185 disable(IDC_EDIT_DEVICE
);
186 disable(IDC_BUTTON_BROWSE_DEVICE
);
187 enable(IDC_EDIT_SERIAL
);
188 enable(IDC_EDIT_LABEL
);
193 static int fill_drives_list(HWND dialog
)
196 BOOL drivec_present
= FALSE
;
204 prevsel
= lv_get_curr_select(dialog
);
206 /* Clear the listbox */
207 SendDlgItemMessageW(dialog
, IDC_LIST_DRIVES
, LVM_DELETEALLITEMS
, 0, 0);
209 for(i
= 0; i
< 26; i
++)
215 /* skip over any unused drives */
216 if (!drives
[i
].in_use
)
219 if (drives
[i
].letter
== 'C')
220 drivec_present
= TRUE
;
226 item
.mask
= LVIF_TEXT
| LVIF_PARAM
;
229 item
.pszText
= strdupU2W(letter
);
230 item
.cchTextMax
= lstrlenW(item
.pszText
);
231 item
.lParam
= (LPARAM
) &drives
[i
];
233 lv_insert_item(dialog
, &item
);
236 path
= strdupU2W(drives
[i
].unixpath
);
237 lv_set_item_text(dialog
, count
, 1, path
);
243 WINE_TRACE("loaded %d drives\n", count
);
245 /* show the warning if there is no Drive C */
247 ShowWindow(GetDlgItem(dialog
, IDS_DRIVE_NO_C
), SW_NORMAL
);
249 ShowWindow(GetDlgItem(dialog
, IDS_DRIVE_NO_C
), SW_HIDE
);
251 lv_set_curr_select(dialog
, prevsel
== -1 ? 0 : prevsel
);
257 static void on_options_click(HWND dialog
)
259 if (IsDlgButtonChecked(dialog
, IDC_SHOW_DOT_FILES
) == BST_CHECKED
)
260 set_reg_key(config_key
, L
"", L
"ShowDotFiles", L
"Y");
262 set_reg_key(config_key
, L
"", L
"ShowDotFiles", L
"N");
264 SendMessageW(GetParent(dialog
), PSM_CHANGED
, 0, 0);
267 static INT_PTR CALLBACK
drivechoose_dlgproc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
271 WCHAR drive
[] = L
"X:";
277 ULONG mask
= ~drive_available_mask(0); /* the mask is now which drives aren't available */
278 for( c
= 'A'; c
<= 'Z'; c
++){
280 if(!( mask
& (1 << (c
- 'A'))))
281 SendDlgItemMessageW( hwndDlg
, IDC_DRIVESA2Z
, CB_ADDSTRING
, 0, (LPARAM
) drive
);
284 SendDlgItemMessageW( hwndDlg
, IDC_DRIVESA2Z
, CB_SELECTSTRING
, 0, (LPARAM
) drive
);
288 if(HIWORD(wParam
) != BN_CLICKED
) break;
289 switch (LOWORD(wParam
))
292 i
= SendDlgItemMessageW( hwndDlg
, IDC_DRIVESA2Z
, CB_GETCURSEL
, 0, 0);
294 SendDlgItemMessageW( hwndDlg
, IDC_DRIVESA2Z
, CB_GETLBTEXT
, i
, (LPARAM
) drive
);
298 EndDialog(hwndDlg
, sel
);
301 EndDialog(hwndDlg
, -1);
308 static void on_add_click(HWND dialog
)
310 /* we should allocate a drive letter automatically. We also need
311 some way to let the user choose the mapping point, for now we
312 will just force them to enter a path automatically, with / being
313 the default. In future we should be able to temporarily map /
314 then invoke the directory chooser dialog. */
316 char new = 'C'; /* we skip A and B, they are historically floppy drives */
317 ULONG mask
= ~drive_available_mask(0); /* the mask is now which drives aren't available */
321 while (mask
& (1 << (new - 'A')))
326 driveui_msgbox (dialog
, IDS_DRIVE_LETTERS_EXCEEDED
, MB_OK
| MB_ICONEXCLAMATION
);
332 ret
= DialogBoxParamW(0, MAKEINTRESOURCEW(IDD_DRIVECHOOSE
), dialog
, drivechoose_dlgproc
, new);
334 if( ret
== -1) return;
337 WINE_TRACE("selected drive letter %c\n", new);
342 LoadStringW(GetModuleHandleW(NULL
), IDS_SYSTEM_DRIVE_LABEL
, label
, ARRAY_SIZE(label
));
343 add_drive(new, "../drive_c", NULL
, label
, 0, DRIVE_FIXED
);
345 else add_drive(new, "/", NULL
, NULL
, 0, DRIVE_UNKNOWN
);
347 fill_drives_list(dialog
);
349 /* select the newly created drive */
350 mask
= ~drive_available_mask(0);
352 for (i
= 0; i
< 26; i
++)
354 if ('A' + i
== new) break;
355 if ((1 << i
) & mask
) c
++;
357 lv_set_curr_select(dialog
, c
);
359 SetFocus(GetDlgItem(dialog
, IDC_LIST_DRIVES
));
361 update_controls(dialog
);
362 SendMessageW(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
365 static void on_remove_click(HWND dialog
)
371 itemIndex
= lv_get_curr_select(dialog
);
372 if (itemIndex
== -1) return; /* no selection */
374 item
.mask
= LVIF_PARAM
;
375 item
.iItem
= itemIndex
;
378 lv_get_item(dialog
, &item
);
380 drive
= (struct drive
*) item
.lParam
;
382 WINE_TRACE("unixpath: %s\n", drive
->unixpath
);
384 if (drive
->letter
== 'C')
386 DWORD result
= driveui_msgbox (dialog
, IDS_CONFIRM_DELETE_C
, MB_YESNO
| MB_ICONEXCLAMATION
);
387 if (result
== IDNO
) return;
392 fill_drives_list(dialog
);
394 itemIndex
= itemIndex
- 1;
395 if (itemIndex
< 0) itemIndex
= 0;
396 lv_set_curr_select(dialog
, itemIndex
); /* previous item */
398 SetFocus(GetDlgItem(dialog
, IDC_LIST_DRIVES
));
400 update_controls(dialog
);
401 SendMessageW(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
404 static void update_controls(HWND dialog
)
406 static const WCHAR emptyW
[1];
410 int i
, selection
= -1;
415 i
= lv_get_curr_select(dialog
);
418 /* no selection? let's select something for the user. this will re-enter */
419 lv_set_curr_select(dialog
, i
);
423 item
.mask
= LVIF_PARAM
;
427 lv_get_item(dialog
, &item
);
428 current_drive
= (struct drive
*) item
.lParam
;
430 WINE_TRACE("Updating sheet for drive %c\n", current_drive
->letter
);
433 WINE_TRACE("set path control text to '%s'\n", current_drive
->unixpath
);
434 path
= strdupU2W(current_drive
->unixpath
);
435 set_textW(dialog
, IDC_EDIT_PATH
, path
);
439 type
= current_drive
->type
;
440 SendDlgItemMessageW(dialog
, IDC_COMBO_TYPE
, CB_RESETCONTENT
, 0, 0);
442 for (i
= 0; i
< ARRAY_SIZE(type_pairs
); i
++)
445 LoadStringW(GetModuleHandleW(NULL
), type_pairs
[i
].idDesc
, driveDesc
, ARRAY_SIZE(driveDesc
));
446 SendDlgItemMessageW (dialog
, IDC_COMBO_TYPE
, CB_ADDSTRING
, 0, (LPARAM
)driveDesc
);
448 if (type_pairs
[i
].sCode
== type
)
454 if (selection
== -1) selection
= DRIVE_TYPE_DEFAULT
;
455 SendDlgItemMessageW(dialog
, IDC_COMBO_TYPE
, CB_SETCURSEL
, selection
, 0);
457 EnableWindow( GetDlgItem( dialog
, IDC_BUTTON_REMOVE
), (current_drive
->letter
!= 'C') );
458 EnableWindow( GetDlgItem( dialog
, IDC_EDIT_PATH
), (current_drive
->letter
!= 'C') );
459 EnableWindow( GetDlgItem( dialog
, IDC_BUTTON_BROWSE_PATH
), (current_drive
->letter
!= 'C') );
460 EnableWindow( GetDlgItem( dialog
, IDC_COMBO_TYPE
), (current_drive
->letter
!= 'C') );
462 /* removable media properties */
463 set_textW(dialog
, IDC_EDIT_LABEL
, current_drive
->label
? current_drive
->label
: emptyW
);
465 /* set serial edit text */
466 sprintf( serial
, "%lX", current_drive
->serial
);
467 set_text(dialog
, IDC_EDIT_SERIAL
, serial
);
469 set_text(dialog
, IDC_EDIT_DEVICE
, current_drive
->device
);
471 if ((type
== DRIVE_CDROM
) || (type
== DRIVE_REMOVABLE
))
472 enable_labelserial_box(dialog
, BOX_MODE_DEVICE
);
474 enable_labelserial_box(dialog
, BOX_MODE_NORMAL
);
481 static void on_edit_changed(HWND dialog
, WORD id
)
483 if (updating_ui
) return;
485 WINE_TRACE("edit id %d changed\n", id
);
491 WCHAR
*label
= get_text(dialog
, id
);
492 free(current_drive
->label
);
493 current_drive
->label
= label
;
494 current_drive
->modified
= TRUE
;
496 WINE_TRACE("set label to %s\n", wine_dbgstr_w(current_drive
->label
));
498 /* enable the apply button */
499 SendMessageW(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
509 wpath
= get_text(dialog
, id
);
510 if( (lenW
= WideCharToMultiByte(CP_UNIXCP
, 0, wpath
, -1, NULL
, 0, NULL
, NULL
)) )
513 WideCharToMultiByte(CP_UNIXCP
, 0, wpath
, -1, path
, lenW
, NULL
, NULL
);
518 wpath
= strdupU2W("drive_c");
521 free(current_drive
->unixpath
);
522 current_drive
->unixpath
= path
? path
: strdup("drive_c");
523 current_drive
->modified
= TRUE
;
525 WINE_TRACE("set path to %s\n", current_drive
->unixpath
);
527 lv_set_item_text(dialog
, lv_get_curr_select(dialog
), 1,
531 /* enable the apply button */
532 SendMessageW(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
536 case IDC_EDIT_SERIAL
:
540 serial
= get_text(dialog
, id
);
541 current_drive
->serial
= serial
? wcstoul( serial
, NULL
, 16 ) : 0;
543 current_drive
->modified
= TRUE
;
545 WINE_TRACE("set serial to %08lX\n", current_drive
->serial
);
547 /* enable the apply button */
548 SendMessageW(GetParent(dialog
), PSM_CHANGED
, (WPARAM
) dialog
, 0);
552 case IDC_EDIT_DEVICE
:
554 WCHAR
*device
= get_text(dialog
, id
);
555 /* TODO: handle device if/when it makes sense to do so.... */
562 BOOL
browse_for_unix_folder(HWND dialog
, WCHAR
*pszPath
)
564 static WCHAR wszUnixRootDisplayName
[] = L
"::{CC702EB2-7DC5-11D9-C687-0004238A01CD}";
565 WCHAR pszChoosePath
[FILENAME_MAX
];
576 IShellFolder
*pDesktop
;
577 LPITEMIDLIST pidlUnixRoot
, pidlSelectedPath
;
580 LoadStringW(GetModuleHandleW(NULL
), IDS_CHOOSE_PATH
, pszChoosePath
, FILENAME_MAX
);
582 hr
= SHGetDesktopFolder(&pDesktop
);
583 if (FAILED(hr
)) return FALSE
;
585 hr
= IShellFolder_ParseDisplayName(pDesktop
, NULL
, NULL
, wszUnixRootDisplayName
, NULL
,
586 &pidlUnixRoot
, NULL
);
588 IShellFolder_Release(pDesktop
);
592 bi
.pidlRoot
= pidlUnixRoot
;
593 pidlSelectedPath
= SHBrowseForFolderW(&bi
);
594 SHFree(pidlUnixRoot
);
596 if (pidlSelectedPath
) {
597 STRRET strSelectedPath
;
598 WCHAR
*pszSelectedPath
;
601 hr
= IShellFolder_GetDisplayNameOf(pDesktop
, pidlSelectedPath
, SHGDN_FORPARSING
,
603 IShellFolder_Release(pDesktop
);
605 SHFree(pidlSelectedPath
);
609 hr
= StrRetToStrW(&strSelectedPath
, pidlSelectedPath
, &pszSelectedPath
);
610 SHFree(pidlSelectedPath
);
611 if (FAILED(hr
)) return FALSE
;
613 lstrcpyW(pszPath
, pszSelectedPath
);
615 CoTaskMemFree(pszSelectedPath
);
621 static void init_listview_columns(HWND dialog
)
623 LVCOLUMNW listColumn
;
628 GetClientRect(GetDlgItem(dialog
, IDC_LIST_DRIVES
), &viewRect
);
629 width
= (viewRect
.right
- viewRect
.left
) / 6 - 5;
631 LoadStringW(GetModuleHandleW(NULL
), IDS_COL_DRIVELETTER
, column
, ARRAY_SIZE(column
));
632 listColumn
.mask
= LVCF_TEXT
| LVCF_WIDTH
| LVCF_SUBITEM
;
633 listColumn
.pszText
= column
;
634 listColumn
.cchTextMax
= lstrlenW (listColumn
.pszText
);
635 listColumn
.cx
= width
;
637 SendDlgItemMessageW (dialog
, IDC_LIST_DRIVES
, LVM_INSERTCOLUMNW
, 0, (LPARAM
) &listColumn
);
639 LoadStringW(GetModuleHandleW(NULL
), IDS_COL_DRIVEMAPPING
, column
, ARRAY_SIZE(column
));
640 listColumn
.cx
= viewRect
.right
- viewRect
.left
- width
;
641 listColumn
.pszText
= column
;
642 listColumn
.cchTextMax
= lstrlenW (listColumn
.pszText
);
644 SendDlgItemMessageW (dialog
, IDC_LIST_DRIVES
, LVM_INSERTCOLUMNW
, 1, (LPARAM
) &listColumn
);
647 static void load_drive_options(HWND dialog
)
649 if (!wcscmp(get_reg_key(config_key
, L
"", L
"ShowDotFiles", L
"N"), L
"Y"))
650 CheckDlgButton(dialog
, IDC_SHOW_DOT_FILES
, BST_CHECKED
);
654 DriveDlgProc (HWND dialog
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
661 init_listview_columns(dialog
);
664 ShowWindow( GetDlgItem( dialog
, IDC_STATIC_MOUNTMGR_ERROR
), SW_SHOW
);
665 ShowWindow( GetDlgItem( dialog
, IDC_LIST_DRIVES
), SW_HIDE
);
666 ShowWindow( GetDlgItem( dialog
, IDC_BUTTON_ADD
), SW_HIDE
);
667 ShowWindow( GetDlgItem( dialog
, IDC_BUTTON_REMOVE
), SW_HIDE
);
668 ShowWindow( GetDlgItem( dialog
, IDC_STATIC_PATH
), SW_HIDE
);
669 ShowWindow( GetDlgItem( dialog
, IDC_EDIT_PATH
), SW_HIDE
);
670 ShowWindow( GetDlgItem( dialog
, IDC_BUTTON_BROWSE_PATH
), SW_HIDE
);
671 ShowWindow( GetDlgItem( dialog
, IDC_COMBO_TYPE
), SW_HIDE
);
672 ShowWindow( GetDlgItem( dialog
, IDC_BUTTON_SHOW_HIDE_ADVANCED
), SW_HIDE
);
673 set_advanced(dialog
);
676 ShowWindow( GetDlgItem( dialog
, IDC_STATIC_MOUNTMGR_ERROR
), SW_HIDE
);
677 load_drive_options(dialog
);
679 if (!drives
[2].in_use
)
680 driveui_msgbox (dialog
, IDS_NO_DRIVE_C
, MB_OK
| MB_ICONEXCLAMATION
);
682 fill_drives_list(dialog
);
683 update_controls(dialog
);
684 /* put in non-advanced mode by default */
685 set_advanced(dialog
);
689 set_window_title(dialog
);
693 switch (HIWORD(wParam
))
696 on_edit_changed(dialog
, LOWORD(wParam
));
700 switch (LOWORD(wParam
))
702 case IDC_SHOW_DOT_FILES
:
703 on_options_click(dialog
);
709 SendMessageW(GetParent(dialog
), PSM_CHANGED
, 0, 0);
713 switch (LOWORD(wParam
))
716 if (HIWORD(wParam
) != BN_CLICKED
) break;
717 on_add_click(dialog
);
720 case IDC_BUTTON_REMOVE
:
721 if (HIWORD(wParam
) != BN_CLICKED
) break;
722 on_remove_click(dialog
);
725 case IDC_BUTTON_EDIT
:
726 if (HIWORD(wParam
) != BN_CLICKED
) break;
727 item
= SendMessageW(GetDlgItem(dialog
, IDC_LIST_DRIVES
), LB_GETCURSEL
, 0, 0);
728 SendMessageW(GetDlgItem(dialog
, IDC_LIST_DRIVES
), LB_GETITEMDATA
, item
, 0);
731 case IDC_BUTTON_SHOW_HIDE_ADVANCED
:
732 advanced
= !advanced
;
733 set_advanced(dialog
);
736 case IDC_BUTTON_BROWSE_PATH
:
738 WCHAR szTargetPath
[FILENAME_MAX
];
739 if (browse_for_unix_folder(dialog
, szTargetPath
))
740 set_textW(dialog
, IDC_EDIT_PATH
, szTargetPath
);
746 int mode
= BOX_MODE_NORMAL
;
749 if (HIWORD(wParam
) != CBN_SELCHANGE
) break;
751 selection
= SendDlgItemMessageW(dialog
, IDC_COMBO_TYPE
, CB_GETCURSEL
, 0, 0);
753 if (selection
>= 0 &&
754 (type_pairs
[selection
].sCode
== DRIVE_CDROM
||
755 type_pairs
[selection
].sCode
== DRIVE_REMOVABLE
))
756 mode
= BOX_MODE_DEVICE
;
758 mode
= BOX_MODE_NORMAL
;
760 enable_labelserial_box(dialog
, mode
);
762 current_drive
->type
= type_pairs
[selection
].sCode
;
763 current_drive
->modified
= TRUE
;
771 switch (((LPNMHDR
)lParam
)->code
)
774 WINE_TRACE("PSN_KILLACTIVE\n");
775 SetWindowLongPtrW(dialog
, DWLP_MSGRESULT
, FALSE
);
778 apply_drive_changes();
779 SetWindowLongPtrW(dialog
, DWLP_MSGRESULT
, PSNRET_NOERROR
);
783 case LVN_ITEMCHANGED
:
785 LPNMLISTVIEW lpnm
= (LPNMLISTVIEW
)lParam
;
786 if (!(lpnm
->uOldState
& LVIS_SELECTED
) &&
787 (lpnm
->uNewState
& LVIS_SELECTED
))
788 update_controls(dialog
);