static nsresult get_ns_command_state(GeckoBrowser *This, const char *cmd, nsICommandParams *nsparam) { nsICommandManager *cmdmgr; nsresult nsres; nsres = get_nsinterface((nsISupports*)This->webbrowser, &IID_nsICommandManager, (void**)&cmdmgr); if(NS_FAILED(nsres)) { ERR("Could not get nsICommandManager: %08x\n", nsres); return nsres; } nsres = nsICommandManager_GetCommandState(cmdmgr, cmd, This->doc->basedoc.window->window_proxy, nsparam); if(NS_FAILED(nsres)) ERR("GetCommandState(%s) failed: %08x\n", debugstr_a(cmd), nsres); nsICommandManager_Release(cmdmgr); return nsres; }
static void load_settings(HTMLDocumentObj *doc) { nsIContentViewer *content_viewer; nsIDocShell *doc_shell; HKEY settings_key; DWORD val, size; LONG res; nsresult nsres; static const WCHAR ie_keyW[] = { 'S','O','F','T','W','A','R','E','\\', 'M','i','c','r','o','s','o','f','t','\\', 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',0}; static const WCHAR zoomW[] = {'Z','o','o','m',0}; static const WCHAR zoom_factorW[] = {'Z','o','o','m','F','a','c','t','o','r',0}; res = RegOpenKeyW(HKEY_CURRENT_USER, ie_keyW, &settings_key); if(res != ERROR_SUCCESS) return; size = sizeof(val); res = RegGetValueW(settings_key, zoomW, zoom_factorW, RRF_RT_REG_DWORD, NULL, &val, &size); RegCloseKey(settings_key); if(res != ERROR_SUCCESS) return; TRACE("Setting ZoomFactor to %u\n", val); nsres = get_nsinterface((nsISupports*)doc->nscontainer->navigation, &IID_nsIDocShell, (void**)&doc_shell); assert(nsres == NS_OK); nsres = nsIDocShell_GetContentViewer(doc_shell, &content_viewer); assert(nsres == NS_OK && content_viewer); nsIDocShell_Release(doc_shell); nsres = nsIContentViewer_SetFullZoom(content_viewer, (float)val/100000); if(NS_FAILED(nsres)) ERR("SetFullZoom failed: %08x\n", nsres); nsIContentViewer_Release(content_viewer); }
static nsIClipboardCommands *get_clipboard_commands(HTMLDocument *doc) { nsIClipboardCommands *clipboard_commands; nsIDocShell *doc_shell; nsresult nsres; nsres = get_nsinterface((nsISupports*)doc->window->nswindow, &IID_nsIDocShell, (void**)&doc_shell); if(NS_FAILED(nsres)) { ERR("Could not get nsIDocShell interface\n"); return NULL; } nsres = nsIDocShell_QueryInterface(doc_shell, &IID_nsIClipboardCommands, (void**)&clipboard_commands); nsIDocShell_Release(doc_shell); if(NS_FAILED(nsres)) { ERR("Could not get nsIClipboardCommands interface\n"); return NULL; } return clipboard_commands; }
void do_ns_command(HTMLDocument *This, const char *cmd, nsICommandParams *nsparam) { nsICommandManager *cmdmgr; nsresult nsres; TRACE("(%p)\n", This); if(!This->doc_obj || !This->doc_obj->nscontainer) return; nsres = get_nsinterface((nsISupports*)This->doc_obj->nscontainer->webbrowser, &IID_nsICommandManager, (void**)&cmdmgr); if(NS_FAILED(nsres)) { ERR("Could not get nsICommandManager: %08x\n", nsres); return; } nsres = nsICommandManager_DoCommand(cmdmgr, cmd, nsparam, This->window->nswindow); if(NS_FAILED(nsres)) ERR("DoCommand(%s) failed: %08x\n", debugstr_a(cmd), nsres); nsICommandManager_Release(cmdmgr); }