Commit aa733bed authored by Alexander Nicolaysen Sørnes's avatar Alexander Nicolaysen Sørnes Committed by Alexandre Julliard

mshtml: Send more informative messages to OleInPlaceFrame.

parent bf46b4fd
......@@ -20,6 +20,12 @@
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE
{
IDS_STATUS_DONE "Done"
IDS_STATUS_DOWNLOADINGFROM "Downloading from %s..."
}
STRINGTABLE
{
IDS_HTMLDISABLED "HTML rendering is currently disabled."
......
......@@ -40,6 +40,7 @@
#define INIT_GUID
#include "mshtml_private.h"
#include "resource.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
......@@ -48,6 +49,7 @@ DWORD mshtml_tls = TLS_OUT_OF_INDEXES;
static HINSTANCE shdoclc = NULL;
static HDC display_dc;
static LPWSTR status_strings[NUM_STATUS_STRINGS];
static void thread_detach(void)
{
......@@ -63,6 +65,13 @@ static void thread_detach(void)
heap_free(thread_data);
}
void free_strings(void)
{
int i;
for(i = 0; i < NUM_STATUS_STRINGS; i++)
heap_free(status_strings[i]);
}
static void process_detach(void)
{
close_gecko();
......@@ -74,6 +83,46 @@ static void process_detach(void)
TlsFree(mshtml_tls);
if(display_dc)
DeleteObject(display_dc);
free_strings();
}
void set_statustext(HTMLDocumentObj* doc, INT id, LPCWSTR arg)
{
int index = id - IDS_STATUS_DONE;
LPWSTR p = status_strings[index];
if(!doc->frame)
return;
if(!p)
{
DWORD len = 255;
p = heap_alloc(len * sizeof(WCHAR));
len = LoadStringW(hInst, id, p, len);
len++;
p = heap_realloc(p, len * sizeof(WCHAR));
if(InterlockedCompareExchangePointer((void**)&status_strings[index], p, NULL))
{
heap_free(p);
p = status_strings[index];
}
}
if(arg)
{
DWORD len = lstrlenW(p) + lstrlenW(arg) - 1;
LPWSTR buf = heap_alloc(len * sizeof(WCHAR));
snprintfW(buf, len - 1, p, arg);
p = buf;
}
IOleInPlaceFrame_SetStatusText(doc->frame, p);
if(arg)
heap_free(p);
}
HINSTANCE get_shdoclc(void)
......
......@@ -1024,5 +1024,6 @@ static inline void windowref_release(windowref_t *ref)
HDC get_display_dc(void);
HINSTANCE get_shdoclc(void);
void set_statustext(HTMLDocumentObj*,INT,LPCWSTR);
extern HINSTANCE hInst;
......@@ -34,6 +34,7 @@
#include "mshtml_private.h"
#include "htmlevent.h"
#include "resource.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
......@@ -239,10 +240,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
if(doc_obj->view_sink)
IAdviseSink_OnViewChange(doc_obj->view_sink, DVASPECT_CONTENT, -1);
if(doc_obj->frame) {
static const WCHAR wszDone[] = {'D','o','n','e',0};
IOleInPlaceFrame_SetStatusText(doc_obj->frame, wszDone);
}
set_statustext(doc_obj, IDS_STATUS_DONE, NULL);
update_title(doc_obj);
}
......
......@@ -37,6 +37,7 @@
#include "mshtml_private.h"
#include "htmlevent.h"
#include "resource.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
......@@ -44,6 +45,7 @@ typedef struct {
task_t header;
HTMLDocumentObj *doc;
BOOL set_download;
LPOLESTR url;
} download_proc_task_t;
static BOOL use_gecko_script(LPCWSTR url)
......@@ -134,8 +136,8 @@ static void set_downloading_proc(task_t *_task)
TRACE("(%p)\n", doc);
if(doc->frame)
IOleInPlaceFrame_SetStatusText(doc->frame, NULL /* FIXME */);
set_statustext(doc, IDS_STATUS_DOWNLOADINGFROM, task->url);
CoTaskMemFree(task->url);
if(!doc->client)
return;
......@@ -243,26 +245,31 @@ HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, nsChannel
}
hres = create_doc_uri(This->window, url, &nsuri);
CoTaskMemFree(url);
if(FAILED(hres))
return hres;
if(async_bsc) {
bscallback = async_bsc;
}else {
hres = create_channelbsc(mon, NULL, NULL, 0, &bscallback);
if(FAILED(hres))
return hres;
if(SUCCEEDED(hres))
{
if(async_bsc) {
bscallback = async_bsc;
}else {
hres = create_channelbsc(mon, NULL, NULL, 0, &bscallback);
}
}
hres = load_nsuri(This->window, nsuri, bscallback, LOAD_INITIAL_DOCUMENT_URI);
nsISupports_Release((nsISupports*)nsuri); /* FIXME */
if(SUCCEEDED(hres))
set_window_bscallback(This->window, bscallback);
if(bscallback != async_bsc)
IUnknown_Release((IUnknown*)bscallback);
{
hres = load_nsuri(This->window, nsuri, bscallback, LOAD_INITIAL_DOCUMENT_URI);
nsISupports_Release((nsISupports*)nsuri); /* FIXME */
if(SUCCEEDED(hres))
set_window_bscallback(This->window, bscallback);
if(bscallback != async_bsc)
IUnknown_Release((IUnknown*)bscallback);
}
if(FAILED(hres))
{
CoTaskMemFree(url);
return hres;
}
HTMLDocument_LockContainer(This->doc_obj, TRUE);
......@@ -275,6 +282,7 @@ HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, nsChannel
download_task = heap_alloc(sizeof(download_proc_task_t));
download_task->doc = This->doc_obj;
download_task->set_download = set_download;
download_task->url = url;
push_task(&download_task->header, set_downloading_proc, This->doc_obj->basedoc.task_magic);
return S_OK;
......
......@@ -25,6 +25,10 @@
#define IDS_DOWNLOADING 7502
#define IDS_INSTALLING 7503
#define NUM_STATUS_STRINGS 2
#define IDS_STATUS_DOWNLOADINGFROM 7550
#define IDS_STATUS_DONE 7551
#define ID_DWL_DIALOG 7600
#define ID_DWL_PROGRESS 7601
#define ID_DWL_INSTALL 7602
......
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