Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
36dd205f
Commit
36dd205f
authored
Aug 16, 2006
by
Frank Richter
Committed by
Alexandre Julliard
Aug 16, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecfg: appdefaults: Use more strings from resources, unicode.
parent
722ee099
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
28 deletions
+66
-28
appdefaults.c
programs/winecfg/appdefaults.c
+56
-28
resource.h
programs/winecfg/resource.h
+4
-0
winecfg.h
programs/winecfg/winecfg.h
+6
-0
No files found.
programs/winecfg/appdefaults.c
View file @
36dd205f
...
...
@@ -109,7 +109,12 @@ init_comboboxes (HWND dialog)
/* add the default entries (automatic) which correspond to no setting */
if
(
current_app
)
SendDlgItemMessage
(
dialog
,
IDC_WINVER
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
"Use global settings"
);
{
WCHAR
str
[
256
];
LoadStringW
(
GetModuleHandle
(
NULL
),
IDS_USE_GLOBAL_SETTINGS
,
str
,
sizeof
(
str
)
/
sizeof
(
str
[
0
]));
SendDlgItemMessageW
(
dialog
,
IDC_WINVER
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
str
);
}
for
(
i
=
0
;
i
<
NB_VERSIONS
;
i
++
)
{
...
...
@@ -118,19 +123,19 @@ init_comboboxes (HWND dialog)
}
}
static
void
add_listview_item
(
HWND
listview
,
const
char
*
text
,
void
*
association
)
static
void
add_listview_item
(
HWND
listview
,
const
WCHAR
*
text
,
void
*
association
)
{
LVITEM
item
;
LVITEM
W
item
;
ZeroMemory
(
&
item
,
sizeof
(
LVITEM
));
item
.
mask
=
LVIF_TEXT
|
LVIF_PARAM
;
item
.
pszText
=
(
char
*
)
text
;
item
.
cchTextMax
=
strlen
(
text
);
item
.
pszText
=
(
WCHAR
*
)
text
;
item
.
cchTextMax
=
lstrlenW
(
text
);
item
.
lParam
=
(
LPARAM
)
association
;
item
.
iItem
=
ListView_GetItemCount
(
listview
);
SendMessage
(
listview
,
LVM_INSERTITEM
,
0
,
(
LPARAM
)
&
item
);
SendMessage
(
listview
,
LVM_INSERTITEM
W
,
0
,
(
LPARAM
)
&
item
);
}
/* Called when the application is initialized (cannot reinit!) */
...
...
@@ -140,7 +145,7 @@ static void init_appsheet(HWND dialog)
HKEY
key
;
int
i
;
DWORD
size
;
char
appname
[
1024
];
WCHAR
appname
[
1024
];
WINE_TRACE
(
"()
\n
"
);
...
...
@@ -148,19 +153,19 @@ static void init_appsheet(HWND dialog)
/* we use the lparam field of the item so we can alter the presentation later and not change code
* for instance, to use the tile view or to display the EXEs embedded 'display name' */
add_listview_item
(
listview
,
"Default Settings"
,
NULL
);
add_listview_item
(
listview
,
load_string
(
IDS_DEFAULT_SETTINGS
)
,
NULL
);
/* because this list is only populated once, it's safe to bypass the settings list here */
if
(
RegOpenKey
(
config_key
,
"AppDefaults"
,
&
key
)
==
ERROR_SUCCESS
)
{
i
=
0
;
size
=
sizeof
(
appname
);
while
(
RegEnumKeyEx
(
key
,
i
,
appname
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
)
==
ERROR_SUCCESS
)
size
=
sizeof
(
appname
)
/
sizeof
(
appname
[
0
])
;
while
(
RegEnumKeyEx
W
(
key
,
i
,
appname
,
&
size
,
NULL
,
NULL
,
NULL
,
NULL
)
==
ERROR_SUCCESS
)
{
add_listview_item
(
listview
,
appname
,
strdup
A
(
appname
));
add_listview_item
(
listview
,
appname
,
strdup
W
(
appname
));
i
++
;
size
=
sizeof
(
appname
);
size
=
sizeof
(
appname
)
/
sizeof
(
appname
[
0
])
;
}
RegCloseKey
(
key
);
...
...
@@ -240,47 +245,63 @@ static void on_selection_change(HWND dialog, HWND listview)
set_window_title
(
dialog
);
}
static
BOOL
list_contains_file
(
HWND
listview
,
char
*
filename
)
static
BOOL
list_contains_file
(
HWND
listview
,
WCHAR
*
filename
)
{
LVFINDINFO
find_info
=
{
LVFI_STRING
,
filename
,
0
,
{
0
,
0
},
0
};
LVFINDINFO
W
find_info
=
{
LVFI_STRING
,
filename
,
0
,
{
0
,
0
},
0
};
int
index
;
index
=
ListView_FindItem
(
listview
,
-
1
,
&
find_info
);
index
=
ListView_FindItem
W
(
listview
,
-
1
,
&
find_info
);
return
(
index
!=
-
1
);
}
static
void
on_add_app_click
(
HWND
dialog
)
{
char
filetitle
[
MAX_PATH
];
char
file
[
MAX_PATH
];
OPENFILENAME
ofn
=
{
sizeof
(
OPENFILENAME
),
0
,
/*hInst*/
0
,
"Wine Programs (*.exe,*.exe.so)
\0
*.exe;*.exe.so
\0
"
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
"c:
\\
"
,
"Select a Windows executable file"
,
WCHAR
filetitle
[
MAX_PATH
];
WCHAR
file
[
MAX_PATH
];
WCHAR
programsFilter
[
100
];
WCHAR
selectExecutableStr
[
100
];
static
const
WCHAR
pathC
[]
=
{
'c'
,
':'
,
'\\'
,
0
};
OPENFILENAMEW
ofn
=
{
sizeof
(
OPENFILENAMEW
),
0
,
/*hInst*/
0
,
0
,
NULL
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
pathC
,
0
,
OFN_SHOWHELP
|
OFN_HIDEREADONLY
,
0
,
0
,
NULL
,
0
,
NULL
};
LoadStringW
(
GetModuleHandle
(
NULL
),
IDS_SELECT_EXECUTABLE
,
selectExecutableStr
,
sizeof
(
selectExecutableStr
)
/
sizeof
(
selectExecutableStr
[
0
]));
LoadStringW
(
GetModuleHandle
(
NULL
),
IDS_EXECUTABLE_FILTER
,
programsFilter
,
sizeof
(
programsFilter
)
/
sizeof
(
programsFilter
[
0
]));
ofn
.
lpstrTitle
=
selectExecutableStr
;
ofn
.
lpstrFilter
=
programsFilter
;
ofn
.
lpstrFileTitle
=
filetitle
;
ofn
.
lpstrFileTitle
[
0
]
=
'\0'
;
ofn
.
nMaxFileTitle
=
sizeof
(
filetitle
);
ofn
.
nMaxFileTitle
=
sizeof
(
filetitle
)
/
sizeof
(
filetitle
[
0
])
;
ofn
.
lpstrFile
=
file
;
ofn
.
lpstrFile
[
0
]
=
'\0'
;
ofn
.
nMaxFile
=
sizeof
(
file
);
ofn
.
nMaxFile
=
sizeof
(
file
)
/
sizeof
(
file
[
0
])
;
if
(
GetOpenFileName
(
&
ofn
))
if
(
GetOpenFileName
W
(
&
ofn
))
{
HWND
listview
=
GetDlgItem
(
dialog
,
IDC_APP_LISTVIEW
);
int
count
=
ListView_GetItemCount
(
listview
);
char
*
new_app
;
WCHAR
*
new_app
;
char
*
new_appA
;
DWORD
new_appA_len
;
new_app
=
strdup
A
(
filetitle
);
new_app
=
strdup
W
(
filetitle
);
if
(
list_contains_file
(
listview
,
new_app
))
return
;
WINE_TRACE
(
"adding %s
\n
"
,
new_app
);
WINE_TRACE
(
"adding %s
\n
"
,
wine_dbgstr_w
(
new_app
));
new_appA_len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
new_app
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
new_appA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
new_appA_len
);
WideCharToMultiByte
(
CP_ACP
,
0
,
new_app
,
-
1
,
new_appA
,
new_appA_len
,
NULL
,
NULL
);
add_listview_item
(
listview
,
new_app
,
new_app
);
add_listview_item
(
listview
,
new_app
,
new_app
A
);
ListView_SetItemState
(
listview
,
count
,
LVIS_SELECTED
|
LVIS_FOCUSED
,
LVIS_SELECTED
|
LVIS_FOCUSED
);
...
...
@@ -294,6 +315,10 @@ static void on_remove_app_click(HWND dialog)
HWND
listview
=
GetDlgItem
(
dialog
,
IDC_APP_LISTVIEW
);
int
selection
=
get_listview_selection
(
listview
);
char
*
section
=
keypath
(
""
);
/* AppDefaults\\whatever.exe\\ */
LVITEMW
item
;
item
.
iItem
=
selection
;
item
.
mask
=
LVIF_PARAM
|
LVIF_TEXT
;
WINE_TRACE
(
"selection=%d, section=%s
\n
"
,
selection
,
section
);
...
...
@@ -301,6 +326,9 @@ static void on_remove_app_click(HWND dialog)
section
[
strlen
(
section
)]
=
'\0'
;
/* remove last backslash */
set_reg_key
(
config_key
,
section
,
NULL
,
NULL
);
/* delete the section */
SendMessage
(
listview
,
LVM_GETITEMW
,
0
,
(
LPARAM
)
&
item
);
HeapFree
(
GetProcessHeap
(),
0
,
item
.
pszText
);
HeapFree
(
GetProcessHeap
(),
0
,
(
void
*
)
item
.
lParam
);
SendMessage
(
listview
,
LVM_DELETEITEM
,
selection
,
0
);
ListView_SetItemState
(
listview
,
selection
-
1
,
LVIS_SELECTED
|
LVIS_FOCUSED
,
LVIS_SELECTED
|
LVIS_FOCUSED
);
...
...
programs/winecfg/resource.h
View file @
36dd205f
...
...
@@ -86,6 +86,10 @@
#define IDS_DLL_NATIVE_BUILTIN 8014
#define IDS_DLL_BUILTIN_NATIVE 8015
#define IDS_DLL_DISABLED 8016
#define IDS_DEFAULT_SETTINGS 8017
#define IDS_EXECUTABLE_FILTER 8018
#define IDS_USE_GLOBAL_SETTINGS 8019
#define IDS_SELECT_EXECUTABLE 8020
/* drive editing */
#define IDC_LIST_DRIVES 1042
...
...
programs/winecfg/winecfg.h
View file @
36dd205f
...
...
@@ -121,6 +121,12 @@ static inline char *strdupA(const char *s)
return
strcpy
(
r
,
s
);
}
static
inline
WCHAR
*
strdupW
(
const
WCHAR
*
s
)
{
WCHAR
*
r
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
s
)
+
1
)
*
sizeof
(
WCHAR
));
return
lstrcpyW
(
r
,
s
);
}
static
inline
char
*
get_text
(
HWND
dialog
,
WORD
id
)
{
HWND
item
=
GetDlgItem
(
dialog
,
id
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment