Commit 52accda0 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Set default fontname to 'Times New Roman'.

parent 80b65d3e
...@@ -572,6 +572,15 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event) ...@@ -572,6 +572,15 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *event)
nsIDOMKeyEvent_Release(key_event); nsIDOMKeyEvent_Release(key_event);
} }
static void set_ns_fontname(NSContainer *This, const char *fontname)
{
nsICommandParams *nsparam = create_nscommand_params();
nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, fontname);
do_ns_command(This, NSCMD_FONTFACE, nsparam);
nsICommandParams_Release(nsparam);
}
static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out) static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
{ {
TRACE("(%p)->(%p %p)\n", This, in, out); TRACE("(%p)->(%p %p)\n", This, in, out);
...@@ -580,7 +589,6 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, ...@@ -580,7 +589,6 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
return E_FAIL; return E_FAIL;
if(in) { if(in) {
nsICommandParams *nsparam = create_nscommand_params();
char *stra; char *stra;
DWORD len; DWORD len;
...@@ -589,15 +597,17 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, ...@@ -589,15 +597,17 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
return E_INVALIDARG; return E_INVALIDARG;
} }
TRACE("%s\n", debugstr_w(V_BSTR(in)));
len = WideCharToMultiByte(CP_ACP, 0, V_BSTR(in), -1, NULL, 0, NULL, NULL); len = WideCharToMultiByte(CP_ACP, 0, V_BSTR(in), -1, NULL, 0, NULL, NULL);
stra = mshtml_alloc(len); stra = mshtml_alloc(len);
WideCharToMultiByte(CP_ACP, 0, V_BSTR(in), -1, stra, -1, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, V_BSTR(in), -1, stra, -1, NULL, NULL);
nsICommandParams_SetCStringValue(nsparam, NSSTATE_ATTRIBUTE, stra);
mshtml_free(stra);
do_ns_command(This->nscontainer, NSCMD_FONTFACE, nsparam); set_ns_fontname(This->nscontainer, stra);
nsICommandParams_Release(nsparam); mshtml_free(stra);
update_doc(This, UPDATE_UI);
} }
if(out) { if(out) {
...@@ -621,6 +631,7 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, ...@@ -621,6 +631,7 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
MultiByteToWideChar(CP_ACP, 0, stra, -1, strw, -1); MultiByteToWideChar(CP_ACP, 0, stra, -1, strw, -1);
nsfree(stra); nsfree(stra);
V_VT(out) = VT_BSTR;
V_BSTR(out) = SysAllocString(strw); V_BSTR(out) = SysAllocString(strw);
mshtml_free(strw); mshtml_free(strw);
} }
...@@ -937,3 +948,11 @@ const cmdtable_t editmode_cmds[] = { ...@@ -937,3 +948,11 @@ const cmdtable_t editmode_cmds[] = {
{IDM_COMPOSESETTINGS, NULL, exec_composesettings}, {IDM_COMPOSESETTINGS, NULL, exec_composesettings},
{0,NULL,NULL} {0,NULL,NULL}
}; };
void init_editor(HTMLDocument *This)
{
if(!This->nscontainer)
return;
set_ns_fontname(This->nscontainer, "Times New Roman");
}
...@@ -391,6 +391,7 @@ void update_doc(HTMLDocument *This, DWORD flags); ...@@ -391,6 +391,7 @@ void update_doc(HTMLDocument *This, DWORD flags);
void update_title(HTMLDocument*); void update_title(HTMLDocument*);
/* editor */ /* editor */
void init_editor(HTMLDocument*);
void set_ns_editmode(NSContainer*); void set_ns_editmode(NSContainer*);
void handle_edit_event(HTMLDocument*,nsIDOMEvent*); void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
......
...@@ -132,6 +132,9 @@ static void set_parsecomplete(HTMLDocument *doc) ...@@ -132,6 +132,9 @@ static void set_parsecomplete(HTMLDocument *doc)
TRACE("(%p)\n", doc); TRACE("(%p)\n", doc);
if(doc->usermode == EDITMODE)
init_editor(doc);
call_property_onchanged(doc->cp_propnotif, 1005); call_property_onchanged(doc->cp_propnotif, 1005);
doc->readystate = READYSTATE_INTERACTIVE; doc->readystate = READYSTATE_INTERACTIVE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment