Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
42d6fe6b
Commit
42d6fe6b
authored
Feb 20, 2006
by
Jason Green
Committed by
Alexandre Julliard
Feb 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winefile: Add the ability to save window position to the registry.
parent
044a6f81
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
11 deletions
+104
-11
En.rc
programs/winefile/En.rc
+1
-1
resource.h
programs/winefile/resource.h
+1
-0
winefile.c
programs/winefile/winefile.c
+93
-9
winefile.h
programs/winefile/winefile.h
+9
-1
No files found.
programs/winefile/En.rc
View file @
42d6fe6b
...
@@ -113,7 +113,7 @@ IDM_WINEFILE MENU FIXED IMPURE
...
@@ -113,7 +113,7 @@ IDM_WINEFILE MENU FIXED IMPURE
#endif
#endif
MENUITEM SEPARATOR
MENUITEM SEPARATOR
MENUITEM "&Minimize on run", 504
MENUITEM "&Minimize on run", 504
MENUITEM "&Save settings on exit",
511
MENUITEM "&Save settings on exit",
ID_VIEW_SAVESETTINGS
}
}
...
...
programs/winefile/resource.h
View file @
42d6fe6b
...
@@ -63,6 +63,7 @@
...
@@ -63,6 +63,7 @@
#define ID_VIEW_TOOL_BAR 508
#define ID_VIEW_TOOL_BAR 508
#define ID_VIEW_DRIVE_BAR 507
#define ID_VIEW_DRIVE_BAR 507
#define ID_VIEW_STATUSBAR 503
#define ID_VIEW_STATUSBAR 503
#define ID_VIEW_SAVESETTINGS 511
#define ID_ABOUT 1803
#define ID_ABOUT 1803
#define ID_REFRESH 1704
#define ID_REFRESH 1704
...
...
programs/winefile/winefile.c
View file @
42d6fe6b
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
* Winefile
* Winefile
*
*
* Copyright 2000, 2003, 2004, 2005 Martin Fuchs
* Copyright 2000, 2003, 2004, 2005 Martin Fuchs
* Copyright 2006 Jason Green
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
@@ -58,6 +59,13 @@
...
@@ -58,6 +59,13 @@
#define DEFAULT_SPLIT_POS 200
#define DEFAULT_SPLIT_POS 200
#endif
#endif
static
const
WCHAR
registry_key
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'F'
,
'i'
,
'l'
,
'e'
,
'\0'
};
static
const
WCHAR
reg_start_x
[]
=
{
's'
,
't'
,
'a'
,
'r'
,
't'
,
'X'
,
'\0'
};
static
const
WCHAR
reg_start_y
[]
=
{
's'
,
't'
,
'a'
,
'r'
,
't'
,
'Y'
,
'\0'
};
static
const
WCHAR
reg_width
[]
=
{
'w'
,
'i'
,
'd'
,
't'
,
'h'
,
'\0'
};
static
const
WCHAR
reg_height
[]
=
{
'h'
,
'e'
,
'i'
,
'g'
,
'h'
,
't'
,
'\0'
};
enum
ENTRY_TYPE
{
enum
ENTRY_TYPE
{
ET_WINDOWS
,
ET_WINDOWS
,
...
@@ -1569,6 +1577,75 @@ static void get_path(Entry* dir, PTSTR path)
...
@@ -1569,6 +1577,75 @@ static void get_path(Entry* dir, PTSTR path)
}
}
}
}
static
windowOptions
load_registry_settings
(
void
)
{
DWORD
size
;
DWORD
type
;
HKEY
hKey
;
windowOptions
opts
;
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
registry_key
,
0
,
KEY_QUERY_VALUE
,
&
hKey
);
size
=
sizeof
(
DWORD
);
if
(
RegQueryValueEx
(
hKey
,
reg_start_x
,
NULL
,
&
type
,
(
LPBYTE
)
&
opts
.
start_x
,
&
size
)
!=
ERROR_SUCCESS
)
opts
.
start_x
=
CW_USEDEFAULT
;
if
(
RegQueryValueEx
(
hKey
,
reg_start_y
,
NULL
,
&
type
,
(
LPBYTE
)
&
opts
.
start_y
,
&
size
)
!=
ERROR_SUCCESS
)
opts
.
start_y
=
CW_USEDEFAULT
;
if
(
RegQueryValueEx
(
hKey
,
reg_width
,
NULL
,
&
type
,
(
LPBYTE
)
&
opts
.
width
,
&
size
)
!=
ERROR_SUCCESS
)
opts
.
width
=
CW_USEDEFAULT
;
if
(
RegQueryValueEx
(
hKey
,
reg_height
,
NULL
,
&
type
,
(
LPBYTE
)
&
opts
.
height
,
&
size
)
!=
ERROR_SUCCESS
)
opts
.
height
=
CW_USEDEFAULT
;
RegCloseKey
(
hKey
);
return
opts
;
}
static
void
save_registry_settings
(
void
)
{
WINDOWINFO
wi
;
HKEY
hKey
;
INT
width
,
height
;
wi
.
cbSize
=
sizeof
(
WINDOWINFO
);
GetWindowInfo
(
Globals
.
hMainWnd
,
&
wi
);
width
=
wi
.
rcWindow
.
right
-
wi
.
rcWindow
.
left
;
height
=
wi
.
rcWindow
.
bottom
-
wi
.
rcWindow
.
top
;
if
(
RegOpenKeyEx
(
HKEY_CURRENT_USER
,
registry_key
,
0
,
KEY_SET_VALUE
,
&
hKey
)
!=
ERROR_SUCCESS
)
{
/* Unable to save registry settings - try to create key */
if
(
RegCreateKeyEx
(
HKEY_CURRENT_USER
,
registry_key
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_SET_VALUE
,
NULL
,
&
hKey
,
NULL
)
!=
ERROR_SUCCESS
)
{
/* FIXME: Cannot create key */
return
;
}
}
/* Save all of the settings */
RegSetValueEx
(
hKey
,
reg_start_x
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
wi
.
rcWindow
.
left
,
sizeof
(
DWORD
)
);
RegSetValueEx
(
hKey
,
reg_start_y
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
wi
.
rcWindow
.
top
,
sizeof
(
DWORD
)
);
RegSetValueEx
(
hKey
,
reg_width
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
width
,
sizeof
(
DWORD
)
);
RegSetValueEx
(
hKey
,
reg_height
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
height
,
sizeof
(
DWORD
)
);
/* TODO: Save more settings here (List vs. Detailed View, etc.) */
RegCloseKey
(
hKey
);
}
static
void
resize_frame_rect
(
HWND
hwnd
,
PRECT
prect
)
static
void
resize_frame_rect
(
HWND
hwnd
,
PRECT
prect
)
{
{
...
@@ -2150,6 +2227,9 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
...
@@ -2150,6 +2227,9 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
switch
(
nmsg
)
{
switch
(
nmsg
)
{
case
WM_CLOSE
:
case
WM_CLOSE
:
if
(
Globals
.
saveSettings
==
TRUE
)
save_registry_settings
();
DestroyWindow
(
hwnd
);
DestroyWindow
(
hwnd
);
/* clear handle variables */
/* clear handle variables */
...
@@ -2305,6 +2385,12 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
...
@@ -2305,6 +2385,12 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
toggle_child
(
hwnd
,
cmd
,
Globals
.
hstatusbar
);
toggle_child
(
hwnd
,
cmd
,
Globals
.
hstatusbar
);
break
;
break
;
case
ID_VIEW_SAVESETTINGS
:
Globals
.
saveSettings
=
!
Globals
.
saveSettings
;
CheckMenuItem
(
Globals
.
hMenuOptions
,
ID_VIEW_SAVESETTINGS
,
Globals
.
saveSettings
==
TRUE
?
MF_CHECKED
:
MF_UNCHECKED
);
break
;
case
ID_EXECUTE
:
{
case
ID_EXECUTE
:
{
struct
ExecuteDialog
dlg
;
struct
ExecuteDialog
dlg
;
...
@@ -4678,12 +4764,14 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
...
@@ -4678,12 +4764,14 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
TCHAR
buffer
[
MAX_PATH
],
b1
[
BUFFER_LEN
];
TCHAR
buffer
[
MAX_PATH
],
b1
[
BUFFER_LEN
];
ChildWnd
*
child
;
ChildWnd
*
child
;
HMENU
hMenuFrame
,
hMenuWindow
;
HMENU
hMenuFrame
,
hMenuWindow
;
windowOptions
opts
;
CLIENTCREATESTRUCT
ccs
;
CLIENTCREATESTRUCT
ccs
;
if
(
Globals
.
hMainWnd
)
if
(
Globals
.
hMainWnd
)
return
;
return
;
opts
=
load_registry_settings
();
hMenuFrame
=
LoadMenu
(
Globals
.
hInstance
,
MAKEINTRESOURCE
(
IDM_WINEFILE
));
hMenuFrame
=
LoadMenu
(
Globals
.
hInstance
,
MAKEINTRESOURCE
(
IDM_WINEFILE
));
hMenuWindow
=
GetSubMenu
(
hMenuFrame
,
GetMenuItemCount
(
hMenuFrame
)
-
2
);
hMenuWindow
=
GetSubMenu
(
hMenuFrame
,
GetMenuItemCount
(
hMenuFrame
)
-
2
);
...
@@ -4697,7 +4785,7 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
...
@@ -4697,7 +4785,7 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
/* create main window */
/* create main window */
Globals
.
hMainWnd
=
CreateWindowEx
(
0
,
(
LPCTSTR
)(
int
)
Globals
.
hframeClass
,
RS
(
b1
,
IDS_WINE_FILE
),
WS_OVERLAPPEDWINDOW
,
Globals
.
hMainWnd
=
CreateWindowEx
(
0
,
(
LPCTSTR
)(
int
)
Globals
.
hframeClass
,
RS
(
b1
,
IDS_WINE_FILE
),
WS_OVERLAPPEDWINDOW
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
opts
.
start_x
,
opts
.
start_y
,
opts
.
width
,
opts
.
height
,
hwndParent
,
Globals
.
hMenuFrame
,
Globals
.
hInstance
,
0
/*lpParam*/
);
hwndParent
,
Globals
.
hMenuFrame
,
Globals
.
hInstance
,
0
/*lpParam*/
);
...
@@ -4705,9 +4793,9 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
...
@@ -4705,9 +4793,9 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
WS_CHILD
|
WS_CLIPCHILDREN
|
WS_VSCROLL
|
WS_HSCROLL
|
WS_VISIBLE
|
WS_BORDER
,
WS_CHILD
|
WS_CLIPCHILDREN
|
WS_VSCROLL
|
WS_HSCROLL
|
WS_VISIBLE
|
WS_BORDER
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
Globals
.
hMainWnd
,
0
,
Globals
.
hInstance
,
&
ccs
);
Globals
.
hMainWnd
,
0
,
Globals
.
hInstance
,
&
ccs
);
CheckMenuItem
(
Globals
.
hMenuOptions
,
ID_VIEW_DRIVE_BAR
,
MF_BYCOMMAND
|
MF_CHECKED
);
CheckMenuItem
(
Globals
.
hMenuOptions
,
ID_VIEW_DRIVE_BAR
,
MF_BYCOMMAND
|
MF_CHECKED
);
CheckMenuItem
(
Globals
.
hMenuOptions
,
ID_VIEW_SAVESETTINGS
,
MF_BYCOMMAND
);
create_drive_bar
();
create_drive_bar
();
...
@@ -4737,7 +4825,7 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
...
@@ -4737,7 +4825,7 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_BORDER|CCS_NODIVIDER, 0,0,0,0,
WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_BORDER|CCS_NODIVIDER, 0,0,0,0,
Globals.hMainWnd, (HMENU)IDW_STATUSBAR, hinstance, 0);*/
Globals.hMainWnd, (HMENU)IDW_STATUSBAR, hinstance, 0);*/
/*TODO: read paths
and window placements
from registry */
/*TODO: read paths from registry */
if
(
!
path
||
!*
path
)
{
if
(
!
path
||
!*
path
)
{
GetCurrentDirectory
(
MAX_PATH
,
buffer
);
GetCurrentDirectory
(
MAX_PATH
,
buffer
);
...
@@ -4849,13 +4937,9 @@ static int find_window_class(LPCTSTR classname)
...
@@ -4849,13 +4937,9 @@ static int find_window_class(LPCTSTR classname)
static
int
winefile_main
(
HINSTANCE
hinstance
,
int
cmdshow
,
LPCTSTR
path
)
static
int
winefile_main
(
HINSTANCE
hinstance
,
int
cmdshow
,
LPCTSTR
path
)
{
{
MSG
msg
;
MSG
msg
;
InitInstance
(
hinstance
);
InitInstance
(
hinstance
);
if
(
cmdshow
==
SW_SHOWNORMAL
)
/*TODO: read window placement from registry */
cmdshow
=
SW_MAXIMIZE
;
show_frame
(
0
,
cmdshow
,
path
);
show_frame
(
0
,
cmdshow
,
path
);
while
(
GetMessage
(
&
msg
,
0
,
0
,
0
))
{
while
(
GetMessage
(
&
msg
,
0
,
0
,
0
))
{
...
...
programs/winefile/winefile.h
View file @
42d6fe6b
...
@@ -107,6 +107,13 @@ enum IMAGE {
...
@@ -107,6 +107,13 @@ enum IMAGE {
#define FRM_CALC_CLIENT 0xBF83
#define FRM_CALC_CLIENT 0xBF83
#define Frame_CalcFrameClient(hwnd, prt) ((BOOL)SNDMSG(hwnd, FRM_CALC_CLIENT, 0, (LPARAM)(PRECT)prt))
#define Frame_CalcFrameClient(hwnd, prt) ((BOOL)SNDMSG(hwnd, FRM_CALC_CLIENT, 0, (LPARAM)(PRECT)prt))
typedef
struct
{
int
start_x
;
int
start_y
;
int
width
;
int
height
;
}
windowOptions
;
typedef
struct
typedef
struct
{
{
...
@@ -132,7 +139,8 @@ typedef struct
...
@@ -132,7 +139,8 @@ typedef struct
TCHAR
drives
[
BUFFER_LEN
];
TCHAR
drives
[
BUFFER_LEN
];
BOOL
prescan_node
;
/*TODO*/
BOOL
prescan_node
;
/*TODO*/
BOOL
saveSettings
;
#ifdef _SHELL_FOLDERS
#ifdef _SHELL_FOLDERS
IShellFolder
*
iDesktop
;
IShellFolder
*
iDesktop
;
IMalloc
*
iMalloc
;
IMalloc
*
iMalloc
;
...
...
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