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
2e12e7e4
Commit
2e12e7e4
authored
Jun 10, 2007
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 11, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Move edit command queries to the command table.
parent
ca82a1eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
109 deletions
+88
-109
editor.c
dlls/mshtml/editor.c
+88
-15
olecmd.c
dlls/mshtml/olecmd.c
+0
-94
No files found.
dlls/mshtml/editor.c
View file @
2e12e7e4
...
...
@@ -50,6 +50,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define NSCMD_UNDERLINE "cmd_underline"
#define NSSTATE_ATTRIBUTE "state_attribute"
#define NSSTATE_ALL "state_all"
#define NSALIGN_CENTER "center"
#define NSALIGN_LEFT "left"
...
...
@@ -122,6 +123,26 @@ static nsresult get_ns_command_state(NSContainer *This, const char *cmd, nsIComm
return
nsres
;
}
static
DWORD
query_ns_edit_status
(
HTMLDocument
*
This
,
const
char
*
nscmd
)
{
nsICommandParams
*
nsparam
;
PRBool
b
=
FALSE
;
if
(
This
->
usermode
!=
EDITMODE
||
This
->
readystate
<
READYSTATE_INTERACTIVE
)
return
OLECMDF_SUPPORTED
;
if
(
This
->
nscontainer
&&
nscmd
)
{
nsparam
=
create_nscommand_params
();
get_ns_command_state
(
This
->
nscontainer
,
nscmd
,
nsparam
);
nsICommandParams_GetBooleanValue
(
nsparam
,
NSSTATE_ALL
,
&
b
);
nsICommandParams_Release
(
nsparam
);
}
return
OLECMDF_SUPPORTED
|
OLECMDF_ENABLED
|
(
b
?
OLECMDF_LATCHED
:
0
);
}
static
void
set_ns_align
(
HTMLDocument
*
This
,
const
char
*
align_str
)
{
nsICommandParams
*
nsparam
;
...
...
@@ -847,21 +868,73 @@ static HRESULT exec_composesettings(HTMLDocument *This, DWORD cmdexecopt, VARIAN
return
S_OK
;
}
static
HRESULT
query_edit_status
(
HTMLDocument
*
This
,
OLECMD
*
cmd
)
{
switch
(
cmd
->
cmdID
)
{
case
IDM_FONTNAME
:
TRACE
(
"CGID_MSHTML: IDM_FONTNAME
\n
"
);
cmd
->
cmdf
=
query_ns_edit_status
(
This
,
NULL
);
break
;
case
IDM_FONTSIZE
:
TRACE
(
"CGID_MSHTML: IDM_FONTSIZE
\n
"
);
cmd
->
cmdf
=
query_ns_edit_status
(
This
,
NULL
);
break
;
case
IDM_BOLD
:
TRACE
(
"CGID_MSHTML: IDM_BOLD
\n
"
);
cmd
->
cmdf
=
query_ns_edit_status
(
This
,
NSCMD_BOLD
);
break
;
case
IDM_FORECOLOR
:
TRACE
(
"CGID_MSHTML: IDM_FORECOLOR
\n
"
);
cmd
->
cmdf
=
query_ns_edit_status
(
This
,
NULL
);
break
;
case
IDM_ITALIC
:
TRACE
(
"CGID_MSHTML: IDM_ITALIC
\n
"
);
cmd
->
cmdf
=
query_ns_edit_status
(
This
,
NSCMD_ITALIC
);
break
;
case
IDM_UNDERLINE
:
TRACE
(
"CGID_MSHTML: IDM_UNDERLINE
\n
"
);
cmd
->
cmdf
=
query_ns_edit_status
(
This
,
NSCMD_UNDERLINE
);
break
;
case
IDM_HORIZONTALLINE
:
TRACE
(
"CGID_MSHTML: IDM_HORIZONTALLINE
\n
"
);
cmd
->
cmdf
=
query_ns_edit_status
(
This
,
NULL
);
break
;
case
IDM_ORDERLIST
:
TRACE
(
"CGID_MSHTML: IDM_ORDERLIST
\n
"
);
cmd
->
cmdf
=
query_ns_edit_status
(
This
,
NSCMD_OL
);
break
;
case
IDM_UNORDERLIST
:
TRACE
(
"CGID_MSHTML: IDM_HORIZONTALLINE
\n
"
);
cmd
->
cmdf
=
query_ns_edit_status
(
This
,
NSCMD_UL
);
break
;
case
IDM_INDENT
:
TRACE
(
"CGID_MSHTML: IDM_INDENT
\n
"
);
cmd
->
cmdf
=
query_ns_edit_status
(
This
,
NULL
);
break
;
case
IDM_OUTDENT
:
TRACE
(
"CGID_MSHTML: IDM_OUTDENT
\n
"
);
cmd
->
cmdf
=
query_ns_edit_status
(
This
,
NULL
);
break
;
}
return
S_OK
;
}
const
cmdtable_t
editmode_cmds
[]
=
{
{
IDM_FONTNAME
,
NULL
,
exec_fontname
},
{
IDM_FONTSIZE
,
NULL
,
exec_fontsize
},
{
IDM_FORECOLOR
,
NULL
,
exec_forecolor
},
{
IDM_BOLD
,
NULL
,
exec_bold
},
{
IDM_ITALIC
,
NULL
,
exec_italic
},
{
IDM_JUSTIFYCENTER
,
query_justify
,
exec_justifycenter
},
{
IDM_JUSTIFYRIGHT
,
query_justify
,
exec_justifyright
},
{
IDM_JUSTIFYLEFT
,
query_justify
,
exec_justifyleft
},
{
IDM_UNDERLINE
,
NULL
,
exec_underline
},
{
IDM_HORIZONTALLINE
,
NULL
,
exec_horizontalline
},
{
IDM_ORDERLIST
,
NULL
,
exec_orderlist
},
{
IDM_UNORDERLIST
,
NULL
,
exec_unorderlist
},
{
IDM_INDENT
,
NULL
,
exec_indent
},
{
IDM_OUTDENT
,
NULL
,
exec_outdent
},
{
IDM_COMPOSESETTINGS
,
NULL
,
exec_composesettings
},
{
IDM_FONTNAME
,
query_edit_status
,
exec_fontname
},
{
IDM_FONTSIZE
,
query_edit_status
,
exec_fontsize
},
{
IDM_FORECOLOR
,
query_edit_status
,
exec_forecolor
},
{
IDM_BOLD
,
query_edit_status
,
exec_bold
},
{
IDM_ITALIC
,
query_edit_status
,
exec_italic
},
{
IDM_JUSTIFYCENTER
,
query_justify
,
exec_justifycenter
},
{
IDM_JUSTIFYRIGHT
,
query_justify
,
exec_justifyright
},
{
IDM_JUSTIFYLEFT
,
query_justify
,
exec_justifyleft
},
{
IDM_UNDERLINE
,
query_edit_status
,
exec_underline
},
{
IDM_HORIZONTALLINE
,
query_edit_status
,
exec_horizontalline
},
{
IDM_ORDERLIST
,
query_edit_status
,
exec_orderlist
},
{
IDM_UNORDERLIST
,
query_edit_status
,
exec_unorderlist
},
{
IDM_INDENT
,
query_edit_status
,
exec_indent
},
{
IDM_OUTDENT
,
query_edit_status
,
exec_outdent
},
{
IDM_COMPOSESETTINGS
,
NULL
,
exec_composesettings
},
{
0
,
NULL
,
NULL
}
};
dlls/mshtml/olecmd.c
View file @
2e12e7e4
...
...
@@ -52,7 +52,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define NSCMD_OL "cmd_ol"
#define NSSTATE_ATTRIBUTE "state_attribute"
#define NSSTATE_ALL "state_all"
#define NSALIGN_CENTER "center"
#define NSALIGN_LEFT "left"
...
...
@@ -461,55 +460,6 @@ static HRESULT exec_get_print_template(HTMLDocument *This, DWORD nCmdexecopt, VA
return
E_NOTIMPL
;
}
static
nsresult
get_ns_command_state
(
NSContainer
*
This
,
const
char
*
cmd
,
nsICommandParams
*
nsparam
)
{
nsICommandManager
*
cmdmgr
;
nsIInterfaceRequestor
*
iface_req
;
nsresult
nsres
;
nsres
=
nsIWebBrowser_QueryInterface
(
This
->
webbrowser
,
&
IID_nsIInterfaceRequestor
,
(
void
**
)
&
iface_req
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Could not get nsIInterfaceRequestor: %08x
\n
"
,
nsres
);
return
nsres
;
}
nsres
=
nsIInterfaceRequestor_GetInterface
(
iface_req
,
&
IID_nsICommandManager
,
(
void
**
)
&
cmdmgr
);
nsIInterfaceRequestor_Release
(
iface_req
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Could not get nsICommandManager: %08x
\n
"
,
nsres
);
return
nsres
;
}
nsres
=
nsICommandManager_GetCommandState
(
cmdmgr
,
cmd
,
NULL
,
nsparam
);
if
(
NS_FAILED
(
nsres
))
ERR
(
"GetCommandState(%s) failed: %08x
\n
"
,
debugstr_a
(
cmd
),
nsres
);
nsICommandManager_Release
(
cmdmgr
);
return
nsres
;
}
static
DWORD
query_edit_status
(
HTMLDocument
*
This
,
const
char
*
nscmd
)
{
nsICommandParams
*
nsparam
;
PRBool
b
=
FALSE
;
if
(
This
->
usermode
!=
EDITMODE
||
This
->
readystate
<
READYSTATE_INTERACTIVE
)
return
OLECMDF_SUPPORTED
;
if
(
This
->
nscontainer
&&
nscmd
)
{
nsparam
=
create_nscommand_params
();
get_ns_command_state
(
This
->
nscontainer
,
nscmd
,
nsparam
);
nsICommandParams_GetBooleanValue
(
nsparam
,
NSSTATE_ALL
,
&
b
);
nsICommandParams_Release
(
nsparam
);
}
return
OLECMDF_SUPPORTED
|
OLECMDF_ENABLED
|
(
b
?
OLECMDF_LATCHED
:
0
);
}
static
HRESULT
query_mshtml_copy
(
HTMLDocument
*
This
,
OLECMD
*
cmd
)
{
FIXME
(
"(%p)
\n
"
,
This
);
...
...
@@ -817,54 +767,10 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con
continue
;
switch
(
prgCmds
[
i
].
cmdID
)
{
case
IDM_FONTNAME
:
TRACE
(
"CGID_MSHTML: IDM_FONTNAME
\n
"
);
prgCmds
[
i
].
cmdf
=
query_edit_status
(
This
,
NULL
);
break
;
case
IDM_FONTSIZE
:
TRACE
(
"CGID_MSHTML: IDM_FONTSIZE
\n
"
);
prgCmds
[
i
].
cmdf
=
query_edit_status
(
This
,
NULL
);
break
;
case
IDM_PRINT
:
FIXME
(
"CGID_MSHTML: IDM_PRINT
\n
"
);
prgCmds
[
i
].
cmdf
=
OLECMDF_SUPPORTED
|
OLECMDF_ENABLED
;
break
;
case
IDM_BOLD
:
TRACE
(
"CGID_MSHTML: IDM_BOLD
\n
"
);
prgCmds
[
i
].
cmdf
=
query_edit_status
(
This
,
NSCMD_BOLD
);
break
;
case
IDM_FORECOLOR
:
TRACE
(
"CGID_MSHTML: IDM_FORECOLOR
\n
"
);
prgCmds
[
i
].
cmdf
=
query_edit_status
(
This
,
NULL
);
break
;
case
IDM_ITALIC
:
TRACE
(
"CGID_MSHTML: IDM_ITALIC
\n
"
);
prgCmds
[
i
].
cmdf
=
query_edit_status
(
This
,
NSCMD_ITALIC
);
break
;
case
IDM_UNDERLINE
:
TRACE
(
"CGID_MSHTML: IDM_UNDERLINE
\n
"
);
prgCmds
[
i
].
cmdf
=
query_edit_status
(
This
,
NSCMD_UNDERLINE
);
break
;
case
IDM_HORIZONTALLINE
:
TRACE
(
"CGID_MSHTML: IDM_HORIZONTALLINE
\n
"
);
prgCmds
[
i
].
cmdf
=
query_edit_status
(
This
,
NULL
);
break
;
case
IDM_ORDERLIST
:
TRACE
(
"CGID_MSHTML: IDM_ORDERLIST
\n
"
);
prgCmds
[
i
].
cmdf
=
query_edit_status
(
This
,
NSCMD_OL
);
break
;
case
IDM_UNORDERLIST
:
TRACE
(
"CGID_MSHTML: IDM_HORIZONTALLINE
\n
"
);
prgCmds
[
i
].
cmdf
=
query_edit_status
(
This
,
NSCMD_UL
);
break
;
case
IDM_INDENT
:
TRACE
(
"CGID_MSHTML: IDM_INDENT
\n
"
);
prgCmds
[
i
].
cmdf
=
query_edit_status
(
This
,
NULL
);
break
;
case
IDM_OUTDENT
:
TRACE
(
"CGID_MSHTML: IDM_OUTDENT
\n
"
);
prgCmds
[
i
].
cmdf
=
query_edit_status
(
This
,
NULL
);
break
;
case
IDM_BLOCKDIRLTR
:
FIXME
(
"CGID_MSHTML: IDM_BLOCKDIRLTR
\n
"
);
prgCmds
[
i
].
cmdf
=
OLECMDF_SUPPORTED
|
OLECMDF_ENABLED
;
...
...
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