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
7aa2e616
Commit
7aa2e616
authored
Feb 25, 2007
by
Alexander Nicolaysen Sørnes
Committed by
Alexandre Julliard
Feb 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wordpad: Add open file dialogue.
parent
194c3f25
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
1 deletion
+93
-1
En.rc
programs/wordpad/En.rc
+7
-0
No.rc
programs/wordpad/No.rc
+7
-0
resource.h
programs/wordpad/resource.h
+4
-0
wordpad.c
programs/wordpad/wordpad.c
+75
-1
No files found.
programs/wordpad/En.rc
View file @
7aa2e616
...
@@ -66,3 +66,10 @@ BEGIN
...
@@ -66,3 +66,10 @@ BEGIN
END
END
END
END
END
END
STRINGTABLE DISCARDABLE
BEGIN
STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)"
STRING_TEXT_FILES_TXT, "Text files (*.txt)"
STRING_ALL_FILES, "All documents (*.*)"
END
programs/wordpad/No.rc
View file @
7aa2e616
...
@@ -66,3 +66,10 @@ BEGIN
...
@@ -66,3 +66,10 @@ BEGIN
END
END
END
END
END
END
STRINGTABLE DISCARDABLE
BEGIN
STRING_RICHTEXT_FILES_RTF, "Rikt tekstformat (*.rtf)"
STRING_TEXT_FILES_TXT, "Tekstfiler (*.txt)"
STRING_ALL_FILES, "Alle filer (*.*)"
END
programs/wordpad/resource.h
View file @
7aa2e616
...
@@ -59,3 +59,7 @@
...
@@ -59,3 +59,7 @@
#define IDC_COMBO 2004
#define IDC_COMBO 2004
#define IDB_TOOLBAR 100
#define IDB_TOOLBAR 100
#define STRING_ALL_FILES 1400
#define STRING_TEXT_FILES_TXT 1401
#define STRING_RICHTEXT_FILES_RTF 1402
programs/wordpad/wordpad.c
View file @
7aa2e616
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
#define WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#define _WIN32_IE 0x0400
#define _WIN32_IE 0x0400
#define MAX_STRING_LEN 255
#include <stdarg.h>
#include <stdarg.h>
#include <ctype.h>
#include <ctype.h>
#include <stdio.h>
#include <stdio.h>
...
@@ -29,10 +31,10 @@
...
@@ -29,10 +31,10 @@
#include <windows.h>
#include <windows.h>
#include <richedit.h>
#include <richedit.h>
#include <commctrl.h>
#include <commctrl.h>
#include <commdlg.h>
#include "resource.h"
#include "resource.h"
/* use LoadString */
/* use LoadString */
static
const
WCHAR
xszAppTitle
[]
=
{
'W'
,
'i'
,
'n'
,
'e'
,
' '
,
'W'
,
'o'
,
'r'
,
'd'
,
'p'
,
'a'
,
'd'
,
0
};
static
const
WCHAR
xszAppTitle
[]
=
{
'W'
,
'i'
,
'n'
,
'e'
,
' '
,
'W'
,
'o'
,
'r'
,
'd'
,
'p'
,
'a'
,
'd'
,
0
};
static
const
WCHAR
xszMainMenu
[]
=
{
'M'
,
'A'
,
'I'
,
'N'
,
'M'
,
'E'
,
'N'
,
'U'
,
0
};
static
const
WCHAR
xszMainMenu
[]
=
{
'M'
,
'A'
,
'I'
,
'N'
,
'M'
,
'E'
,
'N'
,
'U'
,
0
};
...
@@ -44,6 +46,32 @@ static const WCHAR wszAppTitle[] = {'W','i','n','e',' ','W','o','r','d','p','a',
...
@@ -44,6 +46,32 @@ static const WCHAR wszAppTitle[] = {'W','i','n','e',' ','W','o','r','d','p','a',
static
HWND
hMainWnd
;
static
HWND
hMainWnd
;
static
HWND
hEditorWnd
;
static
HWND
hEditorWnd
;
static
char
szFilter
[
MAX_STRING_LEN
];
/* Load string resources */
static
void
DoLoadStrings
()
{
LPSTR
p
=
szFilter
;
char
files_rtf
[]
=
"*.rtf"
;
char
files_txt
[]
=
"*.txt"
;
char
files_all
[]
=
"*.*"
;
HINSTANCE
hInstance
=
(
HINSTANCE
)
GetWindowLongPtr
(
hMainWnd
,
GWLP_HINSTANCE
);
LoadString
(
hInstance
,
STRING_RICHTEXT_FILES_RTF
,
p
,
MAX_STRING_LEN
);
p
+=
strlen
(
p
)
+
1
;
lstrcpy
(
p
,
files_rtf
);
p
+=
strlen
(
p
)
+
1
;
LoadString
(
hInstance
,
STRING_TEXT_FILES_TXT
,
p
,
MAX_STRING_LEN
);
p
+=
strlen
(
p
)
+
1
;
lstrcpy
(
p
,
files_txt
);
p
+=
strlen
(
p
)
+
1
;
LoadString
(
hInstance
,
STRING_ALL_FILES
,
p
,
MAX_STRING_LEN
);
p
+=
strlen
(
p
)
+
1
;
lstrcpy
(
p
,
files_all
);
p
+=
strlen
(
p
)
+
1
;
*
p
=
'\0'
;
}
static
void
AddButton
(
HWND
hwndToolBar
,
int
nImage
,
int
nCommand
)
static
void
AddButton
(
HWND
hwndToolBar
,
int
nImage
,
int
nCommand
)
{
{
TBBUTTON
button
;
TBBUTTON
button
;
...
@@ -94,6 +122,10 @@ static void DoOpenFile(LPCWSTR szFileName)
...
@@ -94,6 +122,10 @@ static void DoOpenFile(LPCWSTR szFileName)
DWORD
dwNumRead
;
DWORD
dwNumRead
;
EDITSTREAM
es
;
EDITSTREAM
es
;
char
szCaption
[
MAX_PATH
];
char
szAppTitle
[
sizeof
(
wszAppTitle
)];
char
szSeparator
[]
=
" - "
;
hFile
=
CreateFileW
(
szFileName
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
hFile
=
CreateFileW
(
szFileName
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
if
(
hFile
==
INVALID_HANDLE_VALUE
)
...
@@ -133,6 +165,42 @@ static void DoOpenFile(LPCWSTR szFileName)
...
@@ -133,6 +165,42 @@ static void DoOpenFile(LPCWSTR szFileName)
HeapFree
(
GetProcessHeap
(),
0
,
pTemp
);
HeapFree
(
GetProcessHeap
(),
0
,
pTemp
);
SetFocus
(
hEditorWnd
);
SetFocus
(
hEditorWnd
);
WideCharToMultiByte
(
CP_ACP
,
0
,
wszAppTitle
,
-
1
,
szAppTitle
,
sizeof
(
wszAppTitle
),
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
szFileName
,
-
1
,
szCaption
,
MAX_PATH
,
NULL
,
NULL
);
lstrcat
(
szCaption
,
szSeparator
);
lstrcat
(
szCaption
,
szAppTitle
);
SetWindowText
(
hMainWnd
,
szCaption
);
}
static
void
DialogOpenFile
()
{
OPENFILENAME
ofn
;
char
szFile
[
MAX_PATH
]
=
""
;
char
szDefExt
[]
=
"rtf"
;
ZeroMemory
(
&
ofn
,
sizeof
(
ofn
));
ofn
.
lStructSize
=
sizeof
(
ofn
);
ofn
.
Flags
=
OFN_HIDEREADONLY
|
OFN_FILEMUSTEXIST
|
OFN_PATHMUSTEXIST
;
ofn
.
hwndOwner
=
hMainWnd
;
ofn
.
lpstrFilter
=
szFilter
;
ofn
.
lpstrFile
=
szFile
;
ofn
.
nMaxFile
=
MAX_PATH
;
ofn
.
lpstrDefExt
=
szDefExt
;
if
(
GetOpenFileName
(
&
ofn
))
{
WCHAR
szOpenFile
[
MAX_PATH
];
MultiByteToWideChar
(
CP_ACP
,
0
,
ofn
.
lpstrFile
,
MAX_PATH
,
szOpenFile
,
sizeof
(
szOpenFile
)
/
sizeof
(
szOpenFile
[
0
]));
DoOpenFile
(
szOpenFile
);
}
}
}
static
void
HandleCommandLine
(
LPWSTR
cmdline
)
static
void
HandleCommandLine
(
LPWSTR
cmdline
)
...
@@ -263,6 +331,9 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
...
@@ -263,6 +331,9 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
SetFocus
(
hEditorWnd
);
SetFocus
(
hEditorWnd
);
SendMessage
(
hEditorWnd
,
EM_SETEVENTMASK
,
0
,
ENM_SELCHANGE
);
SendMessage
(
hEditorWnd
,
EM_SETEVENTMASK
,
0
,
ENM_SELCHANGE
);
DoLoadStrings
();
return
0
;
return
0
;
}
}
...
@@ -337,6 +408,9 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
...
@@ -337,6 +408,9 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
break
;
break
;
case
ID_FILE_OPEN
:
case
ID_FILE_OPEN
:
DialogOpenFile
();
break
;
case
ID_FILE_SAVE
:
case
ID_FILE_SAVE
:
case
ID_PRINT
:
case
ID_PRINT
:
case
ID_PREVIEW
:
case
ID_PREVIEW
:
...
...
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