2004-11-23 13:50:23 +00:00
|
|
|
/*
|
|
|
|
* Drive management UI code
|
|
|
|
*
|
|
|
|
* Copyright 2003 Mark Westcott
|
|
|
|
* Copyright 2004 Chris Morgan
|
|
|
|
* Copyright 2003-2004 Mike Hearn
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-11-23 13:50:23 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-02-14 12:09:30 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2006-01-19 10:55:01 +00:00
|
|
|
#define WIN32_LEAN_AND_MEAN
|
2005-09-07 13:28:25 +00:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2006-01-19 10:55:01 +00:00
|
|
|
#include <windows.h>
|
2004-11-23 13:50:23 +00:00
|
|
|
#include <shellapi.h>
|
|
|
|
#include <objbase.h>
|
|
|
|
#include <shlguid.h>
|
|
|
|
#include <shlwapi.h>
|
|
|
|
#include <shlobj.h>
|
|
|
|
|
2008-10-17 12:11:56 +00:00
|
|
|
#include <wine/unicode.h>
|
2004-11-23 13:50:23 +00:00
|
|
|
#include <wine/debug.h>
|
|
|
|
|
|
|
|
#include "winecfg.h"
|
|
|
|
#include "resource.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
|
|
|
|
|
2010-06-09 11:26:23 +00:00
|
|
|
#define BOX_MODE_DEVICE 1
|
|
|
|
#define BOX_MODE_NORMAL 2
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
static BOOL advanced = FALSE;
|
|
|
|
static BOOL updating_ui = FALSE;
|
|
|
|
static struct drive* current_drive;
|
|
|
|
|
2005-01-09 18:00:46 +00:00
|
|
|
static void update_controls(HWND dialog);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2006-08-18 21:58:32 +00:00
|
|
|
static DWORD driveui_msgbox (HWND parent, UINT messageId, DWORD flags)
|
|
|
|
{
|
|
|
|
WCHAR* caption = load_string (IDS_WINECFG_TITLE);
|
2006-08-23 06:53:56 +00:00
|
|
|
WCHAR* text = load_string (messageId);
|
2006-08-18 21:58:32 +00:00
|
|
|
DWORD result = MessageBoxW (parent, text, caption, flags);
|
|
|
|
HeapFree (GetProcessHeap(), 0, caption);
|
|
|
|
HeapFree (GetProcessHeap(), 0, text);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2005-05-09 14:34:56 +00:00
|
|
|
/**** listview helper functions ****/
|
|
|
|
|
|
|
|
/* clears the item at index in the listview */
|
|
|
|
static void lv_clear_curr_select(HWND dialog, int index)
|
|
|
|
{
|
2012-01-20 11:42:33 +00:00
|
|
|
LVITEMW item;
|
|
|
|
|
|
|
|
item.mask = LVIF_STATE;
|
|
|
|
item.state = 0;
|
|
|
|
item.stateMask = LVIS_SELECTED;
|
|
|
|
SendDlgItemMessageW( dialog, IDC_LIST_DRIVES, LVM_SETITEMSTATE, index, (LPARAM)&item );
|
2005-05-09 14:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* selects the item at index in the listview */
|
|
|
|
static void lv_set_curr_select(HWND dialog, int index)
|
|
|
|
{
|
2012-01-20 11:42:33 +00:00
|
|
|
LVITEMW item;
|
|
|
|
|
2005-05-09 14:34:56 +00:00
|
|
|
/* no more than one item can be selected in our listview */
|
|
|
|
lv_clear_curr_select(dialog, -1);
|
2012-01-20 11:42:33 +00:00
|
|
|
item.mask = LVIF_STATE;
|
|
|
|
item.state = LVIS_SELECTED;
|
|
|
|
item.stateMask = LVIS_SELECTED;
|
|
|
|
SendDlgItemMessageW( dialog, IDC_LIST_DRIVES, LVM_SETITEMSTATE, index, (LPARAM)&item );
|
2005-05-09 14:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* returns the currently selected item in the listview */
|
|
|
|
static int lv_get_curr_select(HWND dialog)
|
|
|
|
{
|
2012-01-20 11:42:33 +00:00
|
|
|
return SendDlgItemMessageW(dialog, IDC_LIST_DRIVES, LVM_GETNEXTITEM, -1, LVNI_SELECTED);
|
2005-05-09 14:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* sets the item in the listview at item->iIndex */
|
2009-02-06 23:37:32 +00:00
|
|
|
static void lv_set_item(HWND dialog, LVITEMW *item)
|
2005-05-09 14:34:56 +00:00
|
|
|
{
|
2009-02-06 23:37:32 +00:00
|
|
|
SendDlgItemMessageW(dialog, IDC_LIST_DRIVES, LVM_SETITEMW, 0, (LPARAM) item);
|
2005-05-09 14:34:56 +00:00
|
|
|
}
|
|
|
|
|
2005-10-29 10:29:47 +00:00
|
|
|
/* sets specified item's text */
|
2009-02-06 23:37:32 +00:00
|
|
|
static void lv_set_item_text(HWND dialog, int item, int subItem, WCHAR *text)
|
2005-10-29 10:29:47 +00:00
|
|
|
{
|
2009-02-06 23:37:32 +00:00
|
|
|
LVITEMW lvItem;
|
2005-10-29 10:29:47 +00:00
|
|
|
if (item < 0 || subItem < 0) return;
|
|
|
|
lvItem.mask = LVIF_TEXT;
|
|
|
|
lvItem.iItem = item;
|
|
|
|
lvItem.iSubItem = subItem;
|
|
|
|
lvItem.pszText = text;
|
2009-02-06 23:37:32 +00:00
|
|
|
lvItem.cchTextMax = lstrlenW(lvItem.pszText);
|
2005-10-29 10:29:47 +00:00
|
|
|
lv_set_item(dialog, &lvItem);
|
|
|
|
}
|
|
|
|
|
2005-05-09 14:34:56 +00:00
|
|
|
/* inserts an item into the listview */
|
2009-02-06 23:37:32 +00:00
|
|
|
static void lv_insert_item(HWND dialog, LVITEMW *item)
|
2005-05-09 14:34:56 +00:00
|
|
|
{
|
2009-02-06 23:37:32 +00:00
|
|
|
SendDlgItemMessageW(dialog, IDC_LIST_DRIVES, LVM_INSERTITEMW, 0, (LPARAM) item);
|
2005-05-09 14:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* retrieve the item at index item->iIndex */
|
2009-02-06 23:37:32 +00:00
|
|
|
static void lv_get_item(HWND dialog, LVITEMW *item)
|
2005-05-09 14:34:56 +00:00
|
|
|
{
|
2009-02-06 23:37:32 +00:00
|
|
|
SendDlgItemMessageW(dialog, IDC_LIST_DRIVES, LVM_GETITEMW, 0, (LPARAM) item);
|
2005-05-09 14:34:56 +00:00
|
|
|
}
|
|
|
|
|
2004-11-23 13:50:23 +00:00
|
|
|
static void set_advanced(HWND dialog)
|
|
|
|
{
|
|
|
|
int state;
|
2008-04-27 20:34:13 +00:00
|
|
|
WCHAR text[256];
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
if (advanced)
|
|
|
|
{
|
|
|
|
state = SW_NORMAL;
|
2012-01-20 11:42:33 +00:00
|
|
|
LoadStringW(GetModuleHandleW(NULL), IDS_HIDE_ADVANCED, text, 256);
|
2004-11-23 13:50:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
state = SW_HIDE;
|
2012-01-20 11:42:33 +00:00
|
|
|
LoadStringW(GetModuleHandleW(NULL), IDS_SHOW_ADVANCED, text, 256);
|
2004-11-23 13:50:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ShowWindow(GetDlgItem(dialog, IDC_EDIT_DEVICE), state);
|
2010-06-09 11:26:23 +00:00
|
|
|
ShowWindow(GetDlgItem(dialog, IDC_STATIC_DEVICE), state);
|
|
|
|
ShowWindow(GetDlgItem(dialog, IDC_EDIT_LABEL), state);
|
2004-11-23 13:50:23 +00:00
|
|
|
ShowWindow(GetDlgItem(dialog, IDC_STATIC_LABEL), state);
|
|
|
|
ShowWindow(GetDlgItem(dialog, IDC_BUTTON_BROWSE_DEVICE), state);
|
|
|
|
ShowWindow(GetDlgItem(dialog, IDC_EDIT_SERIAL), state);
|
|
|
|
ShowWindow(GetDlgItem(dialog, IDC_STATIC_SERIAL), state);
|
2005-10-18 12:02:51 +00:00
|
|
|
ShowWindow(GetDlgItem(dialog, IDC_COMBO_TYPE), state);
|
|
|
|
ShowWindow(GetDlgItem(dialog, IDC_STATIC_TYPE), state);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
/* update the button text based on the state */
|
2008-04-27 20:34:13 +00:00
|
|
|
SetWindowTextW(GetDlgItem(dialog, IDC_BUTTON_SHOW_HIDE_ADVANCED), text);
|
2004-11-23 13:50:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct drive_typemap {
|
2005-03-14 10:05:12 +00:00
|
|
|
unsigned int sCode;
|
2006-08-18 21:58:32 +00:00
|
|
|
UINT idDesc;
|
2004-11-23 13:50:23 +00:00
|
|
|
};
|
|
|
|
|
2005-03-14 10:05:12 +00:00
|
|
|
static const struct drive_typemap type_pairs[] = {
|
2006-08-18 21:58:32 +00:00
|
|
|
{ DRIVE_UNKNOWN, IDS_DRIVE_UNKNOWN },
|
|
|
|
{ DRIVE_FIXED, IDS_DRIVE_FIXED },
|
|
|
|
{ DRIVE_REMOTE, IDS_DRIVE_REMOTE },
|
|
|
|
{ DRIVE_REMOVABLE, IDS_DRIVE_REMOVABLE },
|
|
|
|
{ DRIVE_CDROM, IDS_DRIVE_CDROM }
|
2004-11-23 13:50:23 +00:00
|
|
|
};
|
|
|
|
|
2005-10-20 13:16:46 +00:00
|
|
|
#define DRIVE_TYPE_DEFAULT 0
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2005-06-02 15:11:32 +00:00
|
|
|
static void enable_labelserial_box(HWND dialog, int mode)
|
2004-11-23 13:50:23 +00:00
|
|
|
{
|
|
|
|
WINE_TRACE("mode=%d\n", mode);
|
|
|
|
|
|
|
|
switch (mode)
|
|
|
|
{
|
2010-06-09 11:26:23 +00:00
|
|
|
case BOX_MODE_DEVICE:
|
|
|
|
/* FIXME: enable device editing */
|
2004-11-23 13:50:23 +00:00
|
|
|
disable(IDC_EDIT_DEVICE);
|
|
|
|
disable(IDC_BUTTON_BROWSE_DEVICE);
|
|
|
|
disable(IDC_EDIT_SERIAL);
|
|
|
|
disable(IDC_EDIT_LABEL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOX_MODE_NORMAL:
|
|
|
|
disable(IDC_EDIT_DEVICE);
|
|
|
|
disable(IDC_BUTTON_BROWSE_DEVICE);
|
|
|
|
enable(IDC_EDIT_SERIAL);
|
|
|
|
enable(IDC_EDIT_LABEL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-02 15:11:32 +00:00
|
|
|
static int fill_drives_list(HWND dialog)
|
2004-11-23 13:50:23 +00:00
|
|
|
{
|
|
|
|
int count = 0;
|
|
|
|
BOOL drivec_present = FALSE;
|
|
|
|
int i;
|
|
|
|
int prevsel = -1;
|
|
|
|
|
|
|
|
WINE_TRACE("\n");
|
|
|
|
|
|
|
|
updating_ui = TRUE;
|
|
|
|
|
2005-05-09 14:34:56 +00:00
|
|
|
prevsel = lv_get_curr_select(dialog);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
/* Clear the listbox */
|
2012-01-20 11:42:33 +00:00
|
|
|
SendDlgItemMessageW(dialog, IDC_LIST_DRIVES, LVM_DELETEALLITEMS, 0, 0);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
for(i = 0; i < 26; i++)
|
|
|
|
{
|
2009-02-06 23:37:32 +00:00
|
|
|
LVITEMW item;
|
|
|
|
WCHAR *path;
|
2006-01-11 20:12:14 +00:00
|
|
|
char letter[4];
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
/* skip over any unused drives */
|
|
|
|
if (!drives[i].in_use)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (drives[i].letter == 'C')
|
|
|
|
drivec_present = TRUE;
|
|
|
|
|
2006-01-19 10:55:01 +00:00
|
|
|
letter[0] = 'A' + i;
|
|
|
|
letter[1] = ':';
|
|
|
|
letter[2] = 0;
|
2005-05-09 14:34:56 +00:00
|
|
|
|
2006-01-11 20:12:14 +00:00
|
|
|
item.mask = LVIF_TEXT | LVIF_PARAM;
|
2005-05-09 14:34:56 +00:00
|
|
|
item.iItem = count;
|
|
|
|
item.iSubItem = 0;
|
2009-02-06 23:37:32 +00:00
|
|
|
item.pszText = strdupU2W(letter);
|
|
|
|
item.cchTextMax = lstrlenW(item.pszText);
|
2006-01-11 20:12:14 +00:00
|
|
|
item.lParam = (LPARAM) &drives[i];
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2005-05-09 14:34:56 +00:00
|
|
|
lv_insert_item(dialog, &item);
|
2009-02-06 23:37:32 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, item.pszText);
|
|
|
|
|
|
|
|
path = strdupU2W(drives[i].unixpath);
|
|
|
|
lv_set_item_text(dialog, count, 1, path);
|
|
|
|
HeapFree(GetProcessHeap(), 0, path);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
WINE_TRACE("loaded %d drives\n", count);
|
|
|
|
|
|
|
|
/* show the warning if there is no Drive C */
|
|
|
|
if (!drivec_present)
|
|
|
|
ShowWindow(GetDlgItem(dialog, IDS_DRIVE_NO_C), SW_NORMAL);
|
|
|
|
else
|
|
|
|
ShowWindow(GetDlgItem(dialog, IDS_DRIVE_NO_C), SW_HIDE);
|
|
|
|
|
2005-05-09 14:34:56 +00:00
|
|
|
lv_set_curr_select(dialog, prevsel == -1 ? 0 : prevsel);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
updating_ui = FALSE;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2005-06-02 15:11:32 +00:00
|
|
|
static void on_options_click(HWND dialog)
|
2005-05-18 09:48:47 +00:00
|
|
|
{
|
|
|
|
if (IsDlgButtonChecked(dialog, IDC_SHOW_DOT_FILES) == BST_CHECKED)
|
2005-06-23 11:42:54 +00:00
|
|
|
set_reg_key(config_key, "", "ShowDotFiles", "Y");
|
2005-05-18 09:48:47 +00:00
|
|
|
else
|
2005-06-23 11:42:54 +00:00
|
|
|
set_reg_key(config_key, "", "ShowDotFiles", "N");
|
2006-01-11 20:12:14 +00:00
|
|
|
|
2012-01-20 11:42:33 +00:00
|
|
|
SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0);
|
2005-05-18 09:48:47 +00:00
|
|
|
}
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2009-08-16 18:37:10 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2005-06-02 15:11:32 +00:00
|
|
|
static void on_add_click(HWND dialog)
|
2004-11-23 13:50:23 +00:00
|
|
|
{
|
|
|
|
/* we should allocate a drive letter automatically. We also need
|
|
|
|
some way to let the user choose the mapping point, for now we
|
|
|
|
will just force them to enter a path automatically, with / being
|
|
|
|
the default. In future we should be able to temporarily map /
|
|
|
|
then invoke the directory chooser dialog. */
|
|
|
|
|
|
|
|
char new = 'C'; /* we skip A and B, they are historically floppy drives */
|
2009-04-02 10:05:35 +00:00
|
|
|
ULONG mask = ~drive_available_mask(0); /* the mask is now which drives aren't available */
|
2004-11-23 13:50:23 +00:00
|
|
|
int i, c;
|
2011-01-12 23:29:55 +00:00
|
|
|
INT_PTR ret;
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
while (mask & (1 << (new - 'A')))
|
|
|
|
{
|
|
|
|
new++;
|
|
|
|
if (new > 'Z')
|
|
|
|
{
|
2006-08-18 21:58:32 +00:00
|
|
|
driveui_msgbox (dialog, IDS_DRIVE_LETTERS_EXCEEDED, MB_OK | MB_ICONEXCLAMATION);
|
2004-11-23 13:50:23 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-16 18:37:10 +00:00
|
|
|
|
2012-01-20 11:42:33 +00:00
|
|
|
ret = DialogBoxParamW(0, MAKEINTRESOURCEW(IDD_DRIVECHOOSE), dialog, drivechoose_dlgproc, new);
|
2009-08-16 18:37:10 +00:00
|
|
|
|
2011-01-12 23:29:55 +00:00
|
|
|
if( ret == -1) return;
|
|
|
|
new = ret;
|
2009-08-16 18:37:10 +00:00
|
|
|
|
|
|
|
WINE_TRACE("selected drive letter %c\n", new);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2006-08-18 21:58:32 +00:00
|
|
|
if (new == 'C')
|
|
|
|
{
|
2008-10-17 12:11:56 +00:00
|
|
|
WCHAR label[64];
|
2018-05-17 22:17:06 +00:00
|
|
|
LoadStringW(GetModuleHandleW(NULL), IDS_SYSTEM_DRIVE_LABEL, label, ARRAY_SIZE(label));
|
2008-10-23 14:19:36 +00:00
|
|
|
add_drive(new, "../drive_c", NULL, label, 0, DRIVE_FIXED);
|
2006-08-18 21:58:32 +00:00
|
|
|
}
|
2008-10-23 14:19:36 +00:00
|
|
|
else add_drive(new, "/", NULL, NULL, 0, DRIVE_UNKNOWN);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
fill_drives_list(dialog);
|
|
|
|
|
|
|
|
/* select the newly created drive */
|
|
|
|
mask = ~drive_available_mask(0);
|
|
|
|
c = 0;
|
|
|
|
for (i = 0; i < 26; i++)
|
|
|
|
{
|
|
|
|
if ('A' + i == new) break;
|
|
|
|
if ((1 << i) & mask) c++;
|
|
|
|
}
|
2005-05-09 14:34:56 +00:00
|
|
|
lv_set_curr_select(dialog, c);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
SetFocus(GetDlgItem(dialog, IDC_LIST_DRIVES));
|
2005-01-09 18:00:46 +00:00
|
|
|
|
|
|
|
update_controls(dialog);
|
2012-01-20 11:42:33 +00:00
|
|
|
SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
|
2004-11-23 13:50:23 +00:00
|
|
|
}
|
|
|
|
|
2005-06-02 15:11:32 +00:00
|
|
|
static void on_remove_click(HWND dialog)
|
2004-11-23 13:50:23 +00:00
|
|
|
{
|
2005-05-09 14:34:56 +00:00
|
|
|
int itemIndex;
|
2004-11-23 13:50:23 +00:00
|
|
|
struct drive *drive;
|
2009-02-06 23:37:32 +00:00
|
|
|
LVITEMW item;
|
2005-05-09 14:34:56 +00:00
|
|
|
|
|
|
|
itemIndex = lv_get_curr_select(dialog);
|
|
|
|
if (itemIndex == -1) return; /* no selection */
|
|
|
|
|
|
|
|
item.mask = LVIF_PARAM;
|
|
|
|
item.iItem = itemIndex;
|
|
|
|
item.iSubItem = 0;
|
|
|
|
|
|
|
|
lv_get_item(dialog, &item);
|
|
|
|
|
|
|
|
drive = (struct drive *) item.lParam;
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2007-04-24 16:12:23 +00:00
|
|
|
WINE_TRACE("unixpath: %s\n", drive->unixpath);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
if (drive->letter == 'C')
|
|
|
|
{
|
2006-08-18 21:58:32 +00:00
|
|
|
DWORD result = driveui_msgbox (dialog, IDS_CONFIRM_DELETE_C, MB_YESNO | MB_ICONEXCLAMATION);
|
2004-11-23 13:50:23 +00:00
|
|
|
if (result == IDNO) return;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete_drive(drive);
|
|
|
|
|
|
|
|
fill_drives_list(dialog);
|
|
|
|
|
2005-05-09 14:34:56 +00:00
|
|
|
itemIndex = itemIndex - 1;
|
|
|
|
if (itemIndex < 0) itemIndex = 0;
|
|
|
|
lv_set_curr_select(dialog, itemIndex); /* previous item */
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
SetFocus(GetDlgItem(dialog, IDC_LIST_DRIVES));
|
2005-01-09 18:00:46 +00:00
|
|
|
|
|
|
|
update_controls(dialog);
|
2012-01-20 11:42:33 +00:00
|
|
|
SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
|
2004-11-23 13:50:23 +00:00
|
|
|
}
|
|
|
|
|
2005-01-09 18:00:46 +00:00
|
|
|
static void update_controls(HWND dialog)
|
|
|
|
{
|
2008-10-17 12:11:56 +00:00
|
|
|
static const WCHAR emptyW[1];
|
2009-02-06 23:37:32 +00:00
|
|
|
WCHAR *path;
|
2005-03-14 10:05:12 +00:00
|
|
|
unsigned int type;
|
2008-10-17 11:37:04 +00:00
|
|
|
char serial[16];
|
2004-11-23 13:50:23 +00:00
|
|
|
int i, selection = -1;
|
2009-02-06 23:37:32 +00:00
|
|
|
LVITEMW item;
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
updating_ui = TRUE;
|
|
|
|
|
2005-05-09 14:34:56 +00:00
|
|
|
i = lv_get_curr_select(dialog);
|
2004-11-23 13:50:23 +00:00
|
|
|
if (i == -1)
|
|
|
|
{
|
|
|
|
/* no selection? let's select something for the user. this will re-enter */
|
2005-05-09 14:34:56 +00:00
|
|
|
lv_set_curr_select(dialog, i);
|
2004-11-23 13:50:23 +00:00
|
|
|
return;
|
|
|
|
}
|
2005-05-09 14:34:56 +00:00
|
|
|
|
|
|
|
item.mask = LVIF_PARAM;
|
|
|
|
item.iItem = i;
|
|
|
|
item.iSubItem = 0;
|
|
|
|
|
|
|
|
lv_get_item(dialog, &item);
|
|
|
|
current_drive = (struct drive *) item.lParam;
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
WINE_TRACE("Updating sheet for drive %c\n", current_drive->letter);
|
|
|
|
|
|
|
|
/* path */
|
2009-02-06 23:37:32 +00:00
|
|
|
WINE_TRACE("set path control text to '%s'\n", current_drive->unixpath);
|
|
|
|
path = strdupU2W(current_drive->unixpath);
|
|
|
|
set_textW(dialog, IDC_EDIT_PATH, path);
|
|
|
|
HeapFree(GetProcessHeap(), 0, path);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
/* drive type */
|
|
|
|
type = current_drive->type;
|
2012-01-20 11:42:33 +00:00
|
|
|
SendDlgItemMessageW(dialog, IDC_COMBO_TYPE, CB_RESETCONTENT, 0, 0);
|
2005-10-20 13:16:46 +00:00
|
|
|
|
2018-10-29 19:10:42 +00:00
|
|
|
for (i = 0; i < ARRAY_SIZE(type_pairs); i++)
|
2004-11-23 13:50:23 +00:00
|
|
|
{
|
2006-08-18 21:58:32 +00:00
|
|
|
WCHAR driveDesc[64];
|
2018-05-17 22:17:06 +00:00
|
|
|
LoadStringW(GetModuleHandleW(NULL), type_pairs[i].idDesc, driveDesc, ARRAY_SIZE(driveDesc));
|
2006-08-18 21:58:32 +00:00
|
|
|
SendDlgItemMessageW (dialog, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)driveDesc);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2005-10-20 13:16:46 +00:00
|
|
|
if (type_pairs[i].sCode == type)
|
|
|
|
{
|
|
|
|
selection = i;
|
2004-11-23 13:50:23 +00:00
|
|
|
}
|
2005-10-20 13:16:46 +00:00
|
|
|
}
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2005-10-20 13:16:46 +00:00
|
|
|
if (selection == -1) selection = DRIVE_TYPE_DEFAULT;
|
2012-01-20 11:42:33 +00:00
|
|
|
SendDlgItemMessageW(dialog, IDC_COMBO_TYPE, CB_SETCURSEL, selection, 0);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2008-04-21 18:29:34 +00:00
|
|
|
EnableWindow( GetDlgItem( dialog, IDC_BUTTON_REMOVE ), (current_drive->letter != 'C') );
|
|
|
|
EnableWindow( GetDlgItem( dialog, IDC_EDIT_PATH ), (current_drive->letter != 'C') );
|
|
|
|
EnableWindow( GetDlgItem( dialog, IDC_BUTTON_BROWSE_PATH ), (current_drive->letter != 'C') );
|
|
|
|
EnableWindow( GetDlgItem( dialog, IDC_COMBO_TYPE ), (current_drive->letter != 'C') );
|
|
|
|
|
2012-05-15 08:15:32 +00:00
|
|
|
/* removable media properties */
|
2008-10-17 12:11:56 +00:00
|
|
|
set_textW(dialog, IDC_EDIT_LABEL, current_drive->label ? current_drive->label : emptyW);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
/* set serial edit text */
|
2008-10-17 11:37:04 +00:00
|
|
|
sprintf( serial, "%X", current_drive->serial );
|
2004-11-23 13:50:23 +00:00
|
|
|
set_text(dialog, IDC_EDIT_SERIAL, serial);
|
|
|
|
|
2010-06-09 11:26:23 +00:00
|
|
|
set_text(dialog, IDC_EDIT_DEVICE, current_drive->device);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
if ((type == DRIVE_CDROM) || (type == DRIVE_REMOVABLE))
|
2010-06-09 11:26:23 +00:00
|
|
|
enable_labelserial_box(dialog, BOX_MODE_DEVICE);
|
2004-11-23 13:50:23 +00:00
|
|
|
else
|
|
|
|
enable_labelserial_box(dialog, BOX_MODE_NORMAL);
|
|
|
|
|
|
|
|
updating_ui = FALSE;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-06-02 15:11:32 +00:00
|
|
|
static void on_edit_changed(HWND dialog, WORD id)
|
2004-11-23 13:50:23 +00:00
|
|
|
{
|
|
|
|
if (updating_ui) return;
|
|
|
|
|
|
|
|
WINE_TRACE("edit id %d changed\n", id);
|
|
|
|
|
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case IDC_EDIT_LABEL:
|
|
|
|
{
|
2008-10-17 12:11:56 +00:00
|
|
|
WCHAR *label = get_textW(dialog, id);
|
2004-12-23 17:06:43 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, current_drive->label);
|
2008-10-17 12:11:56 +00:00
|
|
|
current_drive->label = label;
|
2008-10-23 10:15:43 +00:00
|
|
|
current_drive->modified = TRUE;
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2008-10-17 12:11:56 +00:00
|
|
|
WINE_TRACE("set label to %s\n", wine_dbgstr_w(current_drive->label));
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2005-10-29 10:29:47 +00:00
|
|
|
/* enable the apply button */
|
2012-01-20 11:42:33 +00:00
|
|
|
SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
|
2004-11-23 13:50:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case IDC_EDIT_PATH:
|
|
|
|
{
|
2009-02-06 23:37:32 +00:00
|
|
|
WCHAR *wpath;
|
2004-11-23 13:50:23 +00:00
|
|
|
char *path;
|
2009-02-06 23:37:32 +00:00
|
|
|
int lenW;
|
|
|
|
|
|
|
|
wpath = get_textW(dialog, id);
|
|
|
|
if( (lenW = WideCharToMultiByte(CP_UNIXCP, 0, wpath, -1, NULL, 0, NULL, NULL)) )
|
|
|
|
{
|
|
|
|
path = HeapAlloc(GetProcessHeap(), 0, lenW);
|
|
|
|
WideCharToMultiByte(CP_UNIXCP, 0, wpath, -1, path, lenW, NULL, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
path = NULL;
|
|
|
|
wpath = strdupU2W("drive_c");
|
|
|
|
}
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2004-12-23 17:06:43 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, current_drive->unixpath);
|
2004-11-23 13:50:23 +00:00
|
|
|
current_drive->unixpath = path ? path : strdupA("drive_c");
|
2008-10-23 10:15:43 +00:00
|
|
|
current_drive->modified = TRUE;
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
WINE_TRACE("set path to %s\n", current_drive->unixpath);
|
|
|
|
|
2005-10-29 10:29:47 +00:00
|
|
|
lv_set_item_text(dialog, lv_get_curr_select(dialog), 1,
|
2009-02-06 23:37:32 +00:00
|
|
|
wpath);
|
|
|
|
HeapFree(GetProcessHeap(), 0, wpath);
|
2005-10-29 10:29:47 +00:00
|
|
|
|
|
|
|
/* enable the apply button */
|
2012-01-20 11:42:33 +00:00
|
|
|
SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
|
2004-11-23 13:50:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case IDC_EDIT_SERIAL:
|
|
|
|
{
|
|
|
|
char *serial;
|
|
|
|
|
|
|
|
serial = get_text(dialog, id);
|
2008-12-16 09:29:35 +00:00
|
|
|
current_drive->serial = serial ? strtoul( serial, NULL, 16 ) : 0;
|
|
|
|
HeapFree(GetProcessHeap(), 0, serial);
|
2008-10-23 10:15:43 +00:00
|
|
|
current_drive->modified = TRUE;
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2008-12-16 09:29:35 +00:00
|
|
|
WINE_TRACE("set serial to %08X\n", current_drive->serial);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2005-10-29 10:29:47 +00:00
|
|
|
/* enable the apply button */
|
2012-01-20 11:42:33 +00:00
|
|
|
SendMessageW(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
|
2004-11-23 13:50:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case IDC_EDIT_DEVICE:
|
|
|
|
{
|
|
|
|
char *device = get_text(dialog, id);
|
|
|
|
/* TODO: handle device if/when it makes sense to do so.... */
|
2004-12-23 17:06:43 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, device);
|
2004-11-23 13:50:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-03 13:29:24 +00:00
|
|
|
BOOL browse_for_unix_folder(HWND dialog, WCHAR *pszPath)
|
2005-03-09 16:41:30 +00:00
|
|
|
{
|
|
|
|
static WCHAR wszUnixRootDisplayName[] =
|
|
|
|
{ ':',':','{','C','C','7','0','2','E','B','2','-','7','D','C','5','-','1','1','D','9','-',
|
2005-05-07 14:50:16 +00:00
|
|
|
'C','6','8','7','-','0','0','0','4','2','3','8','A','0','1','C','D','}', 0 };
|
2008-01-03 13:29:24 +00:00
|
|
|
WCHAR pszChoosePath[FILENAME_MAX];
|
|
|
|
BROWSEINFOW bi = {
|
2005-03-09 16:41:30 +00:00
|
|
|
dialog,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2005-05-07 14:50:16 +00:00
|
|
|
pszChoosePath,
|
2005-03-09 16:41:30 +00:00
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
IShellFolder *pDesktop;
|
|
|
|
LPITEMIDLIST pidlUnixRoot, pidlSelectedPath;
|
|
|
|
HRESULT hr;
|
2012-01-20 11:42:33 +00:00
|
|
|
|
|
|
|
LoadStringW(GetModuleHandleW(NULL), IDS_CHOOSE_PATH, pszChoosePath, FILENAME_MAX);
|
|
|
|
|
2005-03-09 16:41:30 +00:00
|
|
|
hr = SHGetDesktopFolder(&pDesktop);
|
2008-10-07 23:34:18 +00:00
|
|
|
if (FAILED(hr)) return FALSE;
|
2005-03-09 16:41:30 +00:00
|
|
|
|
2005-09-07 13:28:25 +00:00
|
|
|
hr = IShellFolder_ParseDisplayName(pDesktop, NULL, NULL, wszUnixRootDisplayName, NULL,
|
|
|
|
&pidlUnixRoot, NULL);
|
2008-10-07 23:34:18 +00:00
|
|
|
if (FAILED(hr)) {
|
2005-09-07 13:28:25 +00:00
|
|
|
IShellFolder_Release(pDesktop);
|
2006-02-14 12:09:30 +00:00
|
|
|
return FALSE;
|
2005-03-09 16:41:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bi.pidlRoot = pidlUnixRoot;
|
2008-01-03 13:29:24 +00:00
|
|
|
pidlSelectedPath = SHBrowseForFolderW(&bi);
|
2005-03-09 16:41:30 +00:00
|
|
|
SHFree(pidlUnixRoot);
|
|
|
|
|
|
|
|
if (pidlSelectedPath) {
|
|
|
|
STRRET strSelectedPath;
|
2008-01-03 13:29:24 +00:00
|
|
|
WCHAR *pszSelectedPath;
|
2005-03-09 16:41:30 +00:00
|
|
|
HRESULT hr;
|
|
|
|
|
2005-09-07 13:28:25 +00:00
|
|
|
hr = IShellFolder_GetDisplayNameOf(pDesktop, pidlSelectedPath, SHGDN_FORPARSING,
|
|
|
|
&strSelectedPath);
|
|
|
|
IShellFolder_Release(pDesktop);
|
2008-10-07 23:34:18 +00:00
|
|
|
if (FAILED(hr)) {
|
2005-03-09 16:41:30 +00:00
|
|
|
SHFree(pidlSelectedPath);
|
2006-02-14 12:09:30 +00:00
|
|
|
return FALSE;
|
2005-03-09 16:41:30 +00:00
|
|
|
}
|
|
|
|
|
2008-01-03 13:29:24 +00:00
|
|
|
hr = StrRetToStrW(&strSelectedPath, pidlSelectedPath, &pszSelectedPath);
|
2005-03-09 16:41:30 +00:00
|
|
|
SHFree(pidlSelectedPath);
|
2008-10-07 23:34:18 +00:00
|
|
|
if (FAILED(hr)) return FALSE;
|
2006-01-11 20:12:14 +00:00
|
|
|
|
2008-01-03 13:29:24 +00:00
|
|
|
lstrcpyW(pszPath, pszSelectedPath);
|
2005-03-09 16:41:30 +00:00
|
|
|
|
|
|
|
CoTaskMemFree(pszSelectedPath);
|
2006-02-14 12:09:30 +00:00
|
|
|
return TRUE;
|
2005-03-09 16:41:30 +00:00
|
|
|
}
|
2006-02-14 12:09:30 +00:00
|
|
|
return FALSE;
|
2005-03-09 16:41:30 +00:00
|
|
|
}
|
|
|
|
|
2005-05-09 14:34:56 +00:00
|
|
|
static void init_listview_columns(HWND dialog)
|
|
|
|
{
|
2006-08-18 21:58:32 +00:00
|
|
|
LVCOLUMNW listColumn;
|
2005-05-09 14:34:56 +00:00
|
|
|
RECT viewRect;
|
|
|
|
int width;
|
2006-08-18 21:58:32 +00:00
|
|
|
WCHAR column[64];
|
2005-05-09 14:34:56 +00:00
|
|
|
|
|
|
|
GetClientRect(GetDlgItem(dialog, IDC_LIST_DRIVES), &viewRect);
|
|
|
|
width = (viewRect.right - viewRect.left) / 6 - 5;
|
|
|
|
|
2018-05-17 22:17:06 +00:00
|
|
|
LoadStringW(GetModuleHandleW(NULL), IDS_COL_DRIVELETTER, column, ARRAY_SIZE(column));
|
2005-05-09 14:34:56 +00:00
|
|
|
listColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
|
2006-08-18 21:58:32 +00:00
|
|
|
listColumn.pszText = column;
|
|
|
|
listColumn.cchTextMax = lstrlenW (listColumn.pszText);
|
2005-05-09 14:34:56 +00:00
|
|
|
listColumn.cx = width;
|
|
|
|
|
2006-08-18 21:58:32 +00:00
|
|
|
SendDlgItemMessageW (dialog, IDC_LIST_DRIVES, LVM_INSERTCOLUMNW, 0, (LPARAM) &listColumn);
|
2005-05-09 14:34:56 +00:00
|
|
|
|
2018-05-17 22:17:06 +00:00
|
|
|
LoadStringW(GetModuleHandleW(NULL), IDS_COL_DRIVEMAPPING, column, ARRAY_SIZE(column));
|
2005-05-09 14:34:56 +00:00
|
|
|
listColumn.cx = viewRect.right - viewRect.left - width;
|
2006-08-18 21:58:32 +00:00
|
|
|
listColumn.pszText = column;
|
|
|
|
listColumn.cchTextMax = lstrlenW (listColumn.pszText);
|
2005-05-09 14:34:56 +00:00
|
|
|
|
2006-08-18 21:58:32 +00:00
|
|
|
SendDlgItemMessageW (dialog, IDC_LIST_DRIVES, LVM_INSERTCOLUMNW, 1, (LPARAM) &listColumn);
|
2005-05-09 14:34:56 +00:00
|
|
|
}
|
|
|
|
|
2005-05-18 09:48:47 +00:00
|
|
|
static void load_drive_options(HWND dialog)
|
|
|
|
{
|
2005-06-23 11:42:54 +00:00
|
|
|
if (!strcmp(get_reg_key(config_key, "", "ShowDotFiles", "N"), "Y"))
|
2005-05-18 09:48:47 +00:00
|
|
|
CheckDlgButton(dialog, IDC_SHOW_DOT_FILES, BST_CHECKED);
|
|
|
|
}
|
2005-05-09 14:34:56 +00:00
|
|
|
|
2004-11-23 13:50:23 +00:00
|
|
|
INT_PTR CALLBACK
|
|
|
|
DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
int item;
|
|
|
|
|
|
|
|
switch (msg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2005-05-09 14:34:56 +00:00
|
|
|
init_listview_columns(dialog);
|
2008-11-03 11:00:42 +00:00
|
|
|
if (!load_drives())
|
|
|
|
{
|
|
|
|
ShowWindow( GetDlgItem( dialog, IDC_STATIC_MOUNTMGR_ERROR ), SW_SHOW );
|
|
|
|
ShowWindow( GetDlgItem( dialog, IDC_LIST_DRIVES ), SW_HIDE );
|
|
|
|
ShowWindow( GetDlgItem( dialog, IDC_BUTTON_ADD ), SW_HIDE );
|
|
|
|
ShowWindow( GetDlgItem( dialog, IDC_BUTTON_REMOVE ), SW_HIDE );
|
|
|
|
ShowWindow( GetDlgItem( dialog, IDC_STATIC_PATH ), SW_HIDE );
|
|
|
|
ShowWindow( GetDlgItem( dialog, IDC_EDIT_PATH ), SW_HIDE );
|
|
|
|
ShowWindow( GetDlgItem( dialog, IDC_BUTTON_BROWSE_PATH ), SW_HIDE );
|
|
|
|
ShowWindow( GetDlgItem( dialog, IDC_COMBO_TYPE ), SW_HIDE );
|
|
|
|
ShowWindow( GetDlgItem( dialog, IDC_BUTTON_SHOW_HIDE_ADVANCED ), SW_HIDE );
|
|
|
|
set_advanced(dialog);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ShowWindow( GetDlgItem( dialog, IDC_STATIC_MOUNTMGR_ERROR ), SW_HIDE );
|
2005-05-18 09:48:47 +00:00
|
|
|
load_drive_options(dialog);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
if (!drives[2].in_use)
|
2006-08-18 21:58:32 +00:00
|
|
|
driveui_msgbox (dialog, IDS_NO_DRIVE_C, MB_OK | MB_ICONEXCLAMATION);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
fill_drives_list(dialog);
|
|
|
|
update_controls(dialog);
|
|
|
|
/* put in non-advanced mode by default */
|
|
|
|
set_advanced(dialog);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_SHOWWINDOW:
|
|
|
|
set_window_title(dialog);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
2005-05-18 09:48:47 +00:00
|
|
|
switch (HIWORD(wParam))
|
2004-11-23 13:50:23 +00:00
|
|
|
{
|
2005-05-18 09:48:47 +00:00
|
|
|
case EN_CHANGE:
|
|
|
|
on_edit_changed(dialog, LOWORD(wParam));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BN_CLICKED:
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDC_SHOW_DOT_FILES:
|
|
|
|
on_options_click(dialog);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2005-10-20 11:39:12 +00:00
|
|
|
|
|
|
|
case CBN_SELCHANGE:
|
2012-01-20 11:42:33 +00:00
|
|
|
SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0);
|
2005-10-20 11:39:12 +00:00
|
|
|
break;
|
2004-11-23 13:50:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDC_BUTTON_ADD:
|
|
|
|
if (HIWORD(wParam) != BN_CLICKED) break;
|
|
|
|
on_add_click(dialog);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_BUTTON_REMOVE:
|
|
|
|
if (HIWORD(wParam) != BN_CLICKED) break;
|
|
|
|
on_remove_click(dialog);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_BUTTON_EDIT:
|
|
|
|
if (HIWORD(wParam) != BN_CLICKED) break;
|
2012-01-20 11:42:33 +00:00
|
|
|
item = SendMessageW(GetDlgItem(dialog, IDC_LIST_DRIVES), LB_GETCURSEL, 0, 0);
|
|
|
|
SendMessageW(GetDlgItem(dialog, IDC_LIST_DRIVES), LB_GETITEMDATA, item, 0);
|
2004-11-23 13:50:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_BUTTON_SHOW_HIDE_ADVANCED:
|
|
|
|
advanced = !advanced;
|
|
|
|
set_advanced(dialog);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_BUTTON_BROWSE_PATH:
|
2006-02-14 12:09:30 +00:00
|
|
|
{
|
2008-01-03 13:29:24 +00:00
|
|
|
WCHAR szTargetPath[FILENAME_MAX];
|
2006-02-14 12:09:30 +00:00
|
|
|
if (browse_for_unix_folder(dialog, szTargetPath))
|
2008-01-03 13:29:24 +00:00
|
|
|
set_textW(dialog, IDC_EDIT_PATH, szTargetPath);
|
2004-11-23 13:50:23 +00:00
|
|
|
break;
|
2006-02-14 12:09:30 +00:00
|
|
|
}
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
case IDC_COMBO_TYPE:
|
|
|
|
{
|
|
|
|
int mode = BOX_MODE_NORMAL;
|
|
|
|
int selection;
|
|
|
|
|
|
|
|
if (HIWORD(wParam) != CBN_SELCHANGE) break;
|
|
|
|
|
2012-01-20 11:42:33 +00:00
|
|
|
selection = SendDlgItemMessageW(dialog, IDC_COMBO_TYPE, CB_GETCURSEL, 0, 0);
|
2004-11-23 13:50:23 +00:00
|
|
|
|
2005-10-20 13:16:46 +00:00
|
|
|
if (selection >= 0 &&
|
|
|
|
(type_pairs[selection].sCode == DRIVE_CDROM ||
|
|
|
|
type_pairs[selection].sCode == DRIVE_REMOVABLE))
|
2010-06-09 11:26:23 +00:00
|
|
|
mode = BOX_MODE_DEVICE;
|
|
|
|
else
|
|
|
|
mode = BOX_MODE_NORMAL;
|
2004-11-23 13:50:23 +00:00
|
|
|
|
|
|
|
enable_labelserial_box(dialog, mode);
|
|
|
|
|
|
|
|
current_drive->type = type_pairs[selection].sCode;
|
2008-10-23 10:15:43 +00:00
|
|
|
current_drive->modified = TRUE;
|
2004-11-23 13:50:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
switch (((LPNMHDR)lParam)->code)
|
|
|
|
{
|
|
|
|
case PSN_KILLACTIVE:
|
|
|
|
WINE_TRACE("PSN_KILLACTIVE\n");
|
2012-01-20 11:42:33 +00:00
|
|
|
SetWindowLongPtrW(dialog, DWLP_MSGRESULT, FALSE);
|
2004-11-23 13:50:23 +00:00
|
|
|
break;
|
|
|
|
case PSN_APPLY:
|
|
|
|
apply_drive_changes();
|
2012-01-20 11:42:33 +00:00
|
|
|
SetWindowLongPtrW(dialog, DWLP_MSGRESULT, PSNRET_NOERROR);
|
2004-11-23 13:50:23 +00:00
|
|
|
break;
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
break;
|
2005-10-19 19:21:48 +00:00
|
|
|
case LVN_ITEMCHANGED:
|
|
|
|
{
|
|
|
|
LPNMLISTVIEW lpnm = (LPNMLISTVIEW)lParam;
|
|
|
|
if (!(lpnm->uOldState & LVIS_SELECTED) &&
|
|
|
|
(lpnm->uNewState & LVIS_SELECTED))
|
2005-05-10 13:14:49 +00:00
|
|
|
update_controls(dialog);
|
|
|
|
break;
|
2005-10-19 19:21:48 +00:00
|
|
|
}
|
2005-05-10 13:14:49 +00:00
|
|
|
}
|
2004-11-23 13:50:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|