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
e41adf76
Commit
e41adf76
authored
Jun 13, 2007
by
Alexander Nicolaysen Sørnes
Committed by
Alexandre Julliard
Jun 14, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wordpad: Use Unicode functions in more places.
parent
8e362cb6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
50 deletions
+57
-50
wordpad.c
programs/wordpad/wordpad.c
+57
-50
No files found.
programs/wordpad/wordpad.c
View file @
e41adf76
...
...
@@ -377,18 +377,20 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
TBADDBITMAP
ab
;
int
nStdBitmaps
=
0
;
REBARINFO
rbi
;
REBARBANDINFO
rbb
;
REBARBANDINFOW
rbb
;
static
const
WCHAR
wszRichEditDll
[]
=
{
'R'
,
'I'
,
'C'
,
'H'
,
'E'
,
'D'
,
'2'
,
'0'
,
'.'
,
'D'
,
'L'
,
'L'
,
'\0'
};
static
const
WCHAR
wszRichEditText
[]
=
{
'R'
,
'i'
,
'c'
,
'h'
,
'E'
,
'd'
,
'i'
,
't'
,
' '
,
't'
,
'e'
,
'x'
,
't'
,
'\0'
};
CreateStatusWindow
(
CCS_NODIVIDER
|
WS_CHILD
|
WS_VISIBLE
,
"RichEdit text"
,
hWnd
,
IDC_STATUSBAR
);
CreateStatusWindow
W
(
CCS_NODIVIDER
|
WS_CHILD
|
WS_VISIBLE
,
wszRichEditText
,
hWnd
,
IDC_STATUSBAR
);
hReBarWnd
=
CreateWindowEx
(
WS_EX_TOOLWINDOW
,
REBARCLASSNAME
,
NULL
,
hReBarWnd
=
CreateWindowEx
W
(
WS_EX_TOOLWINDOW
,
REBARCLASSNAMEW
,
NULL
,
CCS_NODIVIDER
|
WS_CHILD
|
WS_VISIBLE
|
WS_CLIPSIBLINGS
|
WS_CLIPCHILDREN
|
RBS_VARHEIGHT
|
CCS_TOP
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
0
,
0
,
hWnd
,
(
HMENU
)
IDC_REBAR
,
hInstance
,
NULL
);
rbi
.
cbSize
=
sizeof
(
rbi
);
rbi
.
fMask
=
0
;
rbi
.
himl
=
NULL
;
if
(
!
SendMessage
(
hReBarWnd
,
RB_SETBARINFO
,
0
,
(
LPARAM
)
&
rbi
))
if
(
!
SendMessage
W
(
hReBarWnd
,
RB_SETBARINFO
,
0
,
(
LPARAM
)
&
rbi
))
return
-
1
;
hToolBarWnd
=
CreateToolbarEx
(
hReBarWnd
,
CCS_NOPARENTALIGN
|
CCS_NOMOVEY
|
WS_VISIBLE
|
WS_CHILD
|
TBSTYLE_TOOLTIPS
|
TBSTYLE_BUTTON
,
...
...
@@ -416,8 +418,7 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
AddButton
(
hToolBarWnd
,
nStdBitmaps
+
STD_UNDO
,
ID_EDIT_UNDO
);
AddButton
(
hToolBarWnd
,
nStdBitmaps
+
STD_REDOW
,
ID_EDIT_REDO
);
SendMessage
(
hToolBarWnd
,
TB_ADDSTRING
,
0
,
(
LPARAM
)
"Exit
\0
"
);
SendMessage
(
hToolBarWnd
,
TB_AUTOSIZE
,
0
,
0
);
SendMessageW
(
hToolBarWnd
,
TB_AUTOSIZE
,
0
,
0
);
rbb
.
cbSize
=
sizeof
(
rbb
);
rbb
.
fMask
=
RBBIM_SIZE
|
RBBIM_CHILDSIZE
|
RBBIM_CHILD
|
RBBIM_STYLE
;
...
...
@@ -425,7 +426,7 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
rbb
.
cx
=
0
;
rbb
.
hwndChild
=
hToolBarWnd
;
rbb
.
cxMinChild
=
0
;
rbb
.
cyChild
=
rbb
.
cyMinChild
=
HIWORD
(
SendMessage
(
hToolBarWnd
,
TB_GETBUTTONSIZE
,
0
,
0
));
rbb
.
cyChild
=
rbb
.
cyMinChild
=
HIWORD
(
SendMessage
W
(
hToolBarWnd
,
TB_GETBUTTONSIZE
,
0
,
0
));
SendMessageW
(
hReBarWnd
,
RB_INSERTBAND
,
BANDID_TOOLBAR
,
(
LPARAM
)
&
rbb
);
...
...
@@ -451,7 +452,7 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
SendMessageW
(
hReBarWnd
,
RB_INSERTBAND
,
BANDID_FORMATBAR
,
(
LPARAM
)
&
rbb
);
hDLL
=
LoadLibrary
(
"RICHED20.DLL"
);
hDLL
=
LoadLibrary
W
(
wszRichEditDll
);
assert
(
hDLL
);
hEditorWnd
=
CreateWindowExW
(
WS_EX_CLIENTEDGE
,
wszRichEditClass
,
NULL
,
...
...
@@ -466,7 +467,7 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
assert
(
hEditorWnd
);
SetFocus
(
hEditorWnd
);
SendMessage
(
hEditorWnd
,
EM_SETEVENTMASK
,
0
,
ENM_SELCHANGE
);
SendMessage
W
(
hEditorWnd
,
EM_SETEVENTMASK
,
0
,
ENM_SELCHANGE
);
DoDefaultFont
();
...
...
@@ -491,15 +492,15 @@ static LRESULT OnUser( HWND hWnd, WPARAM wParam, LPARAM lParam)
ZeroMemory
(
&
pf
,
sizeof
(
pf
));
pf
.
cbSize
=
sizeof
(
pf
);
SendMessage
(
hwndEditor
,
EM_GETCHARFORMAT
,
TRUE
,
(
LPARAM
)
&
fmt
);
SendMessage
W
(
hwndEditor
,
EM_GETCHARFORMAT
,
TRUE
,
(
LPARAM
)
&
fmt
);
SendMessage
(
hwndEditor
,
EM_GETSEL
,
(
WPARAM
)
&
from
,
(
LPARAM
)
&
to
);
SendMessage
(
hwndToolBar
,
TB_ENABLEBUTTON
,
ID_EDIT_UNDO
,
SendMessage
(
hwndEditor
,
EM_CANUNDO
,
0
,
0
));
SendMessage
(
hwndToolBar
,
TB_ENABLEBUTTON
,
ID_EDIT_REDO
,
SendMessage
(
hwndEditor
,
EM_CANREDO
,
0
,
0
));
SendMessage
(
hwndToolBar
,
TB_ENABLEBUTTON
,
ID_EDIT_CUT
,
from
==
to
?
0
:
1
);
SendMessage
(
hwndToolBar
,
TB_ENABLEBUTTON
,
ID_EDIT_COPY
,
from
==
to
?
0
:
1
);
SendMessage
W
(
hwndEditor
,
EM_GETSEL
,
(
WPARAM
)
&
from
,
(
LPARAM
)
&
to
);
SendMessage
W
(
hwndToolBar
,
TB_ENABLEBUTTON
,
ID_EDIT_UNDO
,
SendMessage
W
(
hwndEditor
,
EM_CANUNDO
,
0
,
0
));
SendMessage
W
(
hwndToolBar
,
TB_ENABLEBUTTON
,
ID_EDIT_REDO
,
SendMessage
W
(
hwndEditor
,
EM_CANREDO
,
0
,
0
));
SendMessage
W
(
hwndToolBar
,
TB_ENABLEBUTTON
,
ID_EDIT_CUT
,
from
==
to
?
0
:
1
);
SendMessage
W
(
hwndToolBar
,
TB_ENABLEBUTTON
,
ID_EDIT_COPY
,
from
==
to
?
0
:
1
);
SendMessageW
(
hwndFormatBar
,
TB_CHECKBUTTON
,
ID_FORMAT_BOLD
,
(
fmt
.
dwMask
&
CFM_BOLD
)
&&
(
fmt
.
dwEffects
&
CFE_BOLD
));
...
...
@@ -553,13 +554,13 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
switch
(
LOWORD
(
wParam
))
{
case
ID_FILE_EXIT
:
PostMessage
(
hWnd
,
WM_CLOSE
,
0
,
0
);
PostMessage
W
(
hWnd
,
WM_CLOSE
,
0
,
0
);
break
;
case
ID_FILE_NEW
:
SetWindowTextA
(
hwndEditor
,
""
);
set_caption
(
NULL
);
wszFileName
[
0
]
=
'\0'
;
SetWindowTextW
(
hwndEditor
,
wszFileName
);
/* FIXME: set default format too */
break
;
...
...
@@ -582,7 +583,11 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
case
ID_PRINT
:
case
ID_PREVIEW
:
case
ID_FIND
:
MessageBox
(
hWnd
,
"Not implemented"
,
"WordPad"
,
MB_OK
);
{
static
const
WCHAR
wszNotImplemented
[]
=
{
'N'
,
'o'
,
't'
,
' '
,
'i'
,
'm'
,
'p'
,
'l'
,
'e'
,
'm'
,
'e'
,
'n'
,
't'
,
'e'
,
'd'
,
'\0'
};
MessageBoxW
(
hWnd
,
wszNotImplemented
,
wszAppTitle
,
MB_OK
);
}
break
;
case
ID_FORMAT_BOLD
:
...
...
@@ -596,36 +601,36 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
ZeroMemory
(
&
fmt
,
sizeof
(
fmt
));
fmt
.
cbSize
=
sizeof
(
fmt
);
SendMessage
(
hwndEditor
,
EM_GETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
fmt
);
SendMessage
W
(
hwndEditor
,
EM_GETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
fmt
);
if
(
!
(
fmt
.
dwMask
&
mask
))
fmt
.
dwEffects
|=
mask
;
else
fmt
.
dwEffects
^=
mask
;
fmt
.
dwMask
=
mask
;
SendMessage
(
hwndEditor
,
EM_SETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
fmt
);
SendMessage
W
(
hwndEditor
,
EM_SETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
fmt
);
break
;
}
case
ID_EDIT_CUT
:
PostMessage
(
hwndEditor
,
WM_CUT
,
0
,
0
);
PostMessage
W
(
hwndEditor
,
WM_CUT
,
0
,
0
);
break
;
case
ID_EDIT_COPY
:
PostMessage
(
hwndEditor
,
WM_COPY
,
0
,
0
);
PostMessage
W
(
hwndEditor
,
WM_COPY
,
0
,
0
);
break
;
case
ID_EDIT_PASTE
:
PostMessage
(
hwndEditor
,
WM_PASTE
,
0
,
0
);
PostMessage
W
(
hwndEditor
,
WM_PASTE
,
0
,
0
);
break
;
case
ID_EDIT_CLEAR
:
PostMessage
(
hwndEditor
,
WM_CLEAR
,
0
,
0
);
PostMessage
W
(
hwndEditor
,
WM_CLEAR
,
0
,
0
);
break
;
case
ID_EDIT_SELECTALL
:
{
CHARRANGE
range
=
{
0
,
-
1
};
SendMessage
(
hwndEditor
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
range
);
SendMessage
W
(
hwndEditor
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
range
);
/* SendMessage(hwndEditor, EM_SETSEL, 0, -1); */
return
0
;
}
...
...
@@ -660,7 +665,7 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
ZeroMemory
(
&
cf
,
sizeof
(
cf
));
cf
.
cbSize
=
sizeof
(
cf
);
cf
.
dwMask
=
0
;
i
=
SendMessage
(
hwndEditor
,
EM_GETCHARFORMAT
,
i
=
SendMessage
W
(
hwndEditor
,
EM_GETCHARFORMAT
,
LOWORD
(
wParam
)
==
ID_EDIT_CHARFORMAT
,
(
LPARAM
)
&
cf
);
return
0
;
}
...
...
@@ -670,7 +675,7 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
PARAFORMAT2
pf
;
ZeroMemory
(
&
pf
,
sizeof
(
pf
));
pf
.
cbSize
=
sizeof
(
pf
);
SendMessage
(
hwndEditor
,
EM_GETPARAFORMAT
,
0
,
(
LPARAM
)
&
pf
);
SendMessage
W
(
hwndEditor
,
EM_GETPARAFORMAT
,
0
,
(
LPARAM
)
&
pf
);
return
0
;
}
...
...
@@ -695,25 +700,25 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
{
long
nStyle
=
GetWindowLong
(
hwndEditor
,
GWL_STYLE
);
if
(
nStyle
&
ES_READONLY
)
SendMessage
(
hwndEditor
,
EM_SETREADONLY
,
0
,
0
);
SendMessage
W
(
hwndEditor
,
EM_SETREADONLY
,
0
,
0
);
else
SendMessage
(
hwndEditor
,
EM_SETREADONLY
,
1
,
0
);
SendMessage
W
(
hwndEditor
,
EM_SETREADONLY
,
1
,
0
);
return
0
;
}
case
ID_EDIT_MODIFIED
:
if
(
SendMessage
(
hwndEditor
,
EM_GETMODIFY
,
0
,
0
))
SendMessage
(
hwndEditor
,
EM_SETMODIFY
,
0
,
0
);
if
(
SendMessage
W
(
hwndEditor
,
EM_GETMODIFY
,
0
,
0
))
SendMessage
W
(
hwndEditor
,
EM_SETMODIFY
,
0
,
0
);
else
SendMessage
(
hwndEditor
,
EM_SETMODIFY
,
1
,
0
);
SendMessage
W
(
hwndEditor
,
EM_SETMODIFY
,
1
,
0
);
return
0
;
case
ID_EDIT_UNDO
:
SendMessage
(
hwndEditor
,
EM_UNDO
,
0
,
0
);
SendMessage
W
(
hwndEditor
,
EM_UNDO
,
0
,
0
);
return
0
;
case
ID_EDIT_REDO
:
SendMessage
(
hwndEditor
,
EM_REDO
,
0
,
0
);
SendMessage
W
(
hwndEditor
,
EM_REDO
,
0
,
0
);
return
0
;
case
ID_ALIGN_LEFT
:
...
...
@@ -729,16 +734,16 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
case
ID_ALIGN_CENTER
:
pf
.
wAlignment
=
PFA_CENTER
;
break
;
case
ID_ALIGN_RIGHT
:
pf
.
wAlignment
=
PFA_RIGHT
;
break
;
}
SendMessage
(
hwndEditor
,
EM_SETPARAFORMAT
,
0
,
(
LPARAM
)
&
pf
);
SendMessage
W
(
hwndEditor
,
EM_SETPARAFORMAT
,
0
,
(
LPARAM
)
&
pf
);
break
;
}
case
ID_BACK_1
:
SendMessage
(
hwndEditor
,
EM_SETBKGNDCOLOR
,
1
,
0
);
SendMessage
W
(
hwndEditor
,
EM_SETBKGNDCOLOR
,
1
,
0
);
break
;
case
ID_BACK_2
:
SendMessage
(
hwndEditor
,
EM_SETBKGNDCOLOR
,
0
,
RGB
(
255
,
255
,
192
));
SendMessage
W
(
hwndEditor
,
EM_SETBKGNDCOLOR
,
0
,
RGB
(
255
,
255
,
192
));
break
;
case
ID_TOGGLE_TOOLBAR
:
...
...
@@ -757,7 +762,7 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
break
;
default:
SendMessage
(
hwndEditor
,
WM_COMMAND
,
wParam
,
lParam
);
SendMessage
W
(
hwndEditor
,
WM_COMMAND
,
wParam
,
lParam
);
break
;
}
return
0
;
...
...
@@ -774,7 +779,7 @@ static LRESULT OnInitPopupMenu( HWND hWnd, WPARAM wParam, LPARAM lParam )
REBARBANDINFOW
rbbinfo
;
pf
.
cbSize
=
sizeof
(
PARAFORMAT
);
SendMessage
(
hwndEditor
,
EM_GETPARAFORMAT
,
0
,
(
LPARAM
)
&
pf
);
SendMessage
W
(
hwndEditor
,
EM_GETPARAFORMAT
,
0
,
(
LPARAM
)
&
pf
);
CheckMenuItem
(
hMenu
,
ID_EDIT_READONLY
,
MF_BYCOMMAND
|
(
GetWindowLong
(
hwndEditor
,
GWL_STYLE
)
&
ES_READONLY
?
MF_CHECKED
:
MF_UNCHECKED
));
CheckMenuItem
(
hMenu
,
ID_EDIT_MODIFIED
,
...
...
@@ -824,7 +829,7 @@ static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam )
if
(
hwndStatusBar
)
{
SendMessage
(
hwndStatusBar
,
WM_SIZE
,
0
,
0
);
SendMessage
W
(
hwndStatusBar
,
WM_SIZE
,
0
,
0
);
if
(
IsWindowVisible
(
hwndStatusBar
))
{
GetClientRect
(
hwndStatusBar
,
&
rc
);
...
...
@@ -839,8 +844,8 @@ static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam )
rc
.
left
=
rc
.
top
=
0
;
rc
.
right
=
LOWORD
(
lParam
);
rc
.
bottom
=
HIWORD
(
lParam
);
SendMessage
(
hwndToolBar
,
TB_AUTOSIZE
,
0
,
0
);
SendMessage
(
hwndReBar
,
RB_SIZETORECT
,
0
,
(
LPARAM
)
&
rc
);
SendMessage
W
(
hwndToolBar
,
TB_AUTOSIZE
,
0
,
0
);
SendMessage
W
(
hwndReBar
,
RB_SIZETORECT
,
0
,
(
LPARAM
)
&
rc
);
GetClientRect
(
hwndReBar
,
&
rc
);
MoveWindow
(
hwndReBar
,
0
,
0
,
LOWORD
(
lParam
),
rc
.
right
,
FALSE
);
}
...
...
@@ -922,10 +927,12 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hOldInstance, LPSTR szCmdPar
HACCEL
hAccel
;
WNDCLASSW
wc
;
MSG
msg
;
static
const
WCHAR
wszAccelTable
[]
=
{
'M'
,
'A'
,
'I'
,
'N'
,
'A'
,
'C'
,
'C'
,
'E'
,
'L'
,
'T'
,
'A'
,
'B'
,
'L'
,
'E'
,
'\0'
};
InitCommonControlsEx
(
&
classes
);
hAccel
=
LoadAccelerators
(
hInstance
,
"MAINACCELTABLE"
);
hAccel
=
LoadAccelerators
W
(
hInstance
,
wszAccelTable
);
wc
.
style
=
CS_HREDRAW
|
CS_VREDRAW
;
wc
.
lpfnWndProc
=
WndProc
;
...
...
@@ -945,14 +952,14 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hOldInstance, LPSTR szCmdPar
HandleCommandLine
(
GetCommandLineW
());
while
(
GetMessage
(
&
msg
,
0
,
0
,
0
))
while
(
GetMessage
W
(
&
msg
,
0
,
0
,
0
))
{
if
(
TranslateAccelerator
(
hMainWnd
,
hAccel
,
&
msg
))
if
(
TranslateAccelerator
W
(
hMainWnd
,
hAccel
,
&
msg
))
continue
;
TranslateMessage
(
&
msg
);
DispatchMessage
(
&
msg
);
if
(
!
PeekMessage
(
&
msg
,
0
,
0
,
0
,
PM_NOREMOVE
))
SendMessage
(
hMainWnd
,
WM_USER
,
0
,
0
);
DispatchMessage
W
(
&
msg
);
if
(
!
PeekMessage
W
(
&
msg
,
0
,
0
,
0
,
PM_NOREMOVE
))
SendMessage
W
(
hMainWnd
,
WM_USER
,
0
,
0
);
}
return
0
;
...
...
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