mirror of
https://github.com/greenshot/greenshot
synced 2025-08-21 14:03:23 -07:00
Added a small change for the confluence plugin build, debug-info was included in the release. Also added a ExtendedWebBrowser, which suppresses Script-error messages when using the WebBrowser. (For this a the IOleCommandTarget was introduced). Had to update the readme.txt to make the version consistent.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2176 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
332efc3f96
commit
4713847d2e
12 changed files with 208 additions and 17 deletions
68
GreenshotPlugin/Controls/ExtendedWebBrowser.cs
Normal file
68
GreenshotPlugin/Controls/ExtendedWebBrowser.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using GreenshotInterop.Interop;
|
||||
|
||||
namespace GreenshotPlugin.Controls {
|
||||
public class ExtendedWebBrowser : WebBrowser {
|
||||
protected class ExtendedWebBrowserSite : WebBrowserSite, IOleCommandTarget {
|
||||
const int OLECMDID_SHOWSCRIPTERROR = 40;
|
||||
const int OLECMDID_SHOWMESSAGE = 41;
|
||||
|
||||
static Guid CGID_DocHostCommandHandler = new Guid("F38BC242-B950-11D1-8918-00C04FC2C836");
|
||||
|
||||
const int S_OK = 0;
|
||||
const int OLECMDERR_E_NOTSUPPORTED = (-2147221248);
|
||||
const int OLECMDERR_E_UNKNOWNGROUP = (-2147221244);
|
||||
|
||||
public ExtendedWebBrowserSite(WebBrowser wb) : base(wb) {
|
||||
}
|
||||
|
||||
#region IOleCommandTarget Members
|
||||
public int QueryStatus(Guid pguidCmdGroup, int cCmds, IntPtr prgCmds, IntPtr pCmdText) {
|
||||
return OLECMDERR_E_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
public int Exec(Guid pguidCmdGroup, int nCmdID, int nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) {
|
||||
if (pguidCmdGroup == CGID_DocHostCommandHandler) {
|
||||
if (nCmdID == OLECMDID_SHOWSCRIPTERROR) {
|
||||
// do not need to alter pvaOut as the docs says, enough to return S_OK here
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return OLECMDERR_E_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
protected override WebBrowserSiteBase CreateWebBrowserSiteBase() {
|
||||
return new ExtendedWebBrowserSite(this);
|
||||
}
|
||||
|
||||
public ExtendedWebBrowser() {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ namespace GreenshotPlugin.Controls {
|
|||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.addressTextBox = new System.Windows.Forms.TextBox();
|
||||
this.browser = new System.Windows.Forms.WebBrowser();
|
||||
this.browser = new ExtendedWebBrowser();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// addressTextBox
|
||||
|
@ -81,12 +81,12 @@ namespace GreenshotPlugin.Controls {
|
|||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox addressTextBox;
|
||||
private System.Windows.Forms.WebBrowser browser;
|
||||
private ExtendedWebBrowser browser;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,8 @@ namespace GreenshotPlugin.Controls {
|
|||
this.Text = browserTitle;
|
||||
this.addressTextBox.Text = authorizationLink;
|
||||
|
||||
browser.ScriptErrorsSuppressed = true;
|
||||
// The script errors are suppressed by using the ExtendedWebBrowser
|
||||
browser.ScriptErrorsSuppressed = false;
|
||||
browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted);
|
||||
browser.Navigate(new Uri(authorizationLink));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue