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

This commit is contained in:
Jacek Caban 2007-06-10 11:44:38 +02:00 committed by Alexandre Julliard
parent 80b65d3e35
commit 52accda0fa
3 changed files with 28 additions and 5 deletions

View File

@ -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,
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,
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);
set_ns_fontname(This->nscontainer, stra);
mshtml_free(stra); mshtml_free(stra);
do_ns_command(This->nscontainer, NSCMD_FONTFACE, nsparam); update_doc(This, UPDATE_UI);
nsICommandParams_Release(nsparam);
} }
if(out) { if(out) {
@ -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[] = {
{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");
}

View File

@ -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*);

View File

@ -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;