Jacek Caban : mshtml: Set default fontname to 'Times New Roman'.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 11 08:46:39 CDT 2007
Module: wine
Branch: master
Commit: 52accda0fa1128b78260e37e7e924861a3586060
URL: http://source.winehq.org/git/wine.git/?a=commit;h=52accda0fa1128b78260e37e7e924861a3586060
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sun Jun 10 11:44:38 2007 +0200
mshtml: Set default fontname to 'Times New Roman'.
---
dlls/mshtml/editor.c | 29 ++++++++++++++++++++++++-----
dlls/mshtml/mshtml_private.h | 1 +
dlls/mshtml/task.c | 3 +++
3 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c
index 7bebe3d..9ac1cd5 100644
--- a/dlls/mshtml/editor.c
+++ b/dlls/mshtml/editor.c
@@ -572,6 +572,15 @@ void handle_edit_event(HTMLDocument *This, nsIDOMEvent *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)
{
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;
if(in) {
- nsICommandParams *nsparam = create_nscommand_params();
char *stra;
DWORD len;
@@ -589,15 +597,17 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
return E_INVALIDARG;
}
+ TRACE("%s\n", debugstr_w(V_BSTR(in)));
+
len = WideCharToMultiByte(CP_ACP, 0, V_BSTR(in), -1, NULL, 0, NULL, NULL);
stra = mshtml_alloc(len);
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) {
@@ -621,6 +631,7 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
MultiByteToWideChar(CP_ACP, 0, stra, -1, strw, -1);
nsfree(stra);
+ V_VT(out) = VT_BSTR;
V_BSTR(out) = SysAllocString(strw);
mshtml_free(strw);
}
@@ -937,3 +948,11 @@ const cmdtable_t editmode_cmds[] = {
{IDM_COMPOSESETTINGS, NULL, exec_composesettings},
{0,NULL,NULL}
};
+
+void init_editor(HTMLDocument *This)
+{
+ if(!This->nscontainer)
+ return;
+
+ set_ns_fontname(This->nscontainer, "Times New Roman");
+}
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 9668fcd..468dd6c 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -391,6 +391,7 @@ void update_doc(HTMLDocument *This, DWORD flags);
void update_title(HTMLDocument*);
/* editor */
+void init_editor(HTMLDocument*);
void set_ns_editmode(NSContainer*);
void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
diff --git a/dlls/mshtml/task.c b/dlls/mshtml/task.c
index 057f227..540c969 100644
--- a/dlls/mshtml/task.c
+++ b/dlls/mshtml/task.c
@@ -132,6 +132,9 @@ static void set_parsecomplete(HTMLDocument *doc)
TRACE("(%p)\n", doc);
+ if(doc->usermode == EDITMODE)
+ init_editor(doc);
+
call_property_onchanged(doc->cp_propnotif, 1005);
doc->readystate = READYSTATE_INTERACTIVE;
More information about the wine-cvs
mailing list