Browse Source

Add JScriptGlobals by John Simons: HtmlHelp settings (e.g. language filter) are now persisted.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1058 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
bba33f86ce
  1. 26
      src/AddIns/Misc/HtmlHelp2/JScriptGlobals/AssemblyInfo.vb
  2. 65
      src/AddIns/Misc/HtmlHelp2/JScriptGlobals/Globals.vb
  3. 43
      src/AddIns/Misc/HtmlHelp2/JScriptGlobals/HtmlHelp2JScriptGlobals.vbproj
  4. 4
      src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.csproj
  5. 55
      src/AddIns/Misc/HtmlHelp2/Project/src/BrowserScheme.cs
  6. 9
      src/SharpDevelop.sln

26
src/AddIns/Misc/HtmlHelp2/JScriptGlobals/AssemblyInfo.vb

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
Imports System.Reflection
Imports System.Runtime.CompilerServices
' Information about this assembly is defined by the following
' attributes.
'
' Change them to the information which is associated with the assembly
' you compile.
<assembly: AssemblyTitle("Java Script Globals Helper")>
<assembly: AssemblyDescription("Persists JavaScript variables used by the .NET Framework documentation")>
<assembly: AssemblyConfiguration("")>
<assembly: AssemblyCompany("ic#code")>
<assembly: AssemblyProduct("SharpDevelop")>
<assembly: AssemblyCopyright("2006 AlphaSierraPapa")>
<assembly: AssemblyTrademark("")>
<assembly: AssemblyCulture("")>
' The assembly version has following format :
'
' Major.Minor.Build.Revision
'
' You can specify all values by your own or you can build default build and revision
' numbers with the '*' character (the default):
<assembly: AssemblyVersion("1.0.0.1")>

65
src/AddIns/Misc/HtmlHelp2/JScriptGlobals/Globals.vb

@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
' <file>
' <copyright see="prj:///doc/copyright.txt"/>
' <license see="prj:///doc/license.txt"/>
' <owner name="John Simons" email="John.SIMONS@dewr.gov.au"/>
' <version>$Revision$</version>
' </file>
Imports System.Runtime.InteropServices
<ComVisible(True)> _
Public Class JScriptExternal
Dim jScriptGlobals As New JScriptGlobals
Public ReadOnly Property Globals() As JScriptGlobals
Get
Return jScriptGlobals
End Get
End Property
End Class
<ComVisible(True)> _
Public Class JScriptGlobals
Dim variableValueCol As New Dictionary(Of String, String)
Dim variablePersistCol As New Dictionary(Of String, Boolean)
Public Property VariableValueCollection() As Dictionary(Of String, String)
Get
Return variableValueCol
End Get
Set
variableValueCol = value
End Set
End Property
Public Property VariablePersistCollection() As Dictionary(Of String, Boolean)
Get
Return variablePersistCol
End Get
Set
variablePersistCol = value
End Set
End Property
Public Function VariableExists(ByVal key As String) As Boolean
Return variableValueCol.ContainsKey(key)
End Function
Public Default Property VariableValue(ByVal key As String) As Object
Get
Return variableValueCol(key)
End Get
Set
variableValueCol(key) = value
End Set
End Property
Public Property VariablePersists(ByVal key As String) As Boolean
Get
Return variablePersistCol(key)
End Get
Set
variablePersistCol(key) = value
End Set
End Property
End Class

43
src/AddIns/Misc/HtmlHelp2/JScriptGlobals/HtmlHelp2JScriptGlobals.vbproj

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>HtmlHelp2.JScriptGlobals</RootNamespace>
<AssemblyName>HtmlHelp2JScriptGlobals</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<MyType>Windows</MyType>
<ProjectGuid>{E54A5AD2-418D-4A85-BA5E-CD803DE38715}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG,TRACE</DefineConstants>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
</ItemGroup>
<ItemGroup>
<Compile Include="Globals.vb" />
<Compile Include="AssemblyInfo.vb" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.Targets" />
</Project>

4
src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.csproj

@ -104,6 +104,10 @@ @@ -104,6 +104,10 @@
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\JScriptGlobals\HtmlHelp2JScriptGlobals.vbproj">
<Project>{E54A5AD2-418D-4A85-BA5E-CD803DE38715}</Project>
<Name>HtmlHelp2JScriptGlobals</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>

55
src/AddIns/Misc/HtmlHelp2/Project/src/BrowserScheme.cs

@ -5,17 +5,21 @@ @@ -5,17 +5,21 @@
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.BrowserDisplayBinding;
using HtmlHelp2.Environment;
using HtmlHelp2.JScriptGlobals;
namespace HtmlHelp2
{
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.BrowserDisplayBinding;
using HtmlHelp2.Environment;
public class BrowserScheme : DefaultSchemeExtension
{
JScriptExternal scriptObject;
public override void GoHome(HtmlViewPane pane)
{
pane.Navigate(HtmlHelp2Environment.DefaultPage);
@ -25,7 +29,42 @@ namespace HtmlHelp2 @@ -25,7 +29,42 @@ namespace HtmlHelp2
{
pane.Navigate(HtmlHelp2Environment.SearchPage);
}
public override void InterceptNavigate(HtmlViewPane pane, WebBrowserNavigatingEventArgs e)
{
if (scriptObject == null) {
scriptObject = new JScriptExternal();
LoadHelpState();
}
pane.WebBrowser.ObjectForScripting = scriptObject;
// add event (max. 1 one time)
pane.WebBrowser.Disposed -= SaveHelpState;
pane.WebBrowser.Disposed += SaveHelpState;
base.InterceptNavigate(pane, e);
}
void LoadHelpState()
{
foreach (string line in PropertyService.Get("HtmlHelpPersistedJScriptGlobals", new string[0])) {
int pos = line.IndexOf('=');
string name = line.Substring(0, pos);
scriptObject.Globals.VariablePersistCollection[name] = true;
scriptObject.Globals.VariableValueCollection[name] = line.Substring(pos + 1);
}
}
void SaveHelpState(object sender, EventArgs e)
{
((System.ComponentModel.IComponent)sender).Disposed -= SaveHelpState;
List<string> lines = new List<string>();
foreach (KeyValuePair<string, bool> pair in scriptObject.Globals.VariablePersistCollection) {
if (pair.Value) {
lines.Add(pair.Key + "=" + scriptObject.Globals.VariableValueCollection[pair.Key]);
}
}
PropertyService.Set("HtmlHelpPersistedJScriptGlobals", lines.ToArray());
}
public override void DocumentCompleted(HtmlViewPane pane, WebBrowserDocumentCompletedEventArgs e)
{
ShowHelpBrowser.HighlightDocument(pane);

9
src/SharpDevelop.sln

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.0.0.960
# SharpDevelop 2.0.0.1054
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
@ -44,6 +44,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{CE5B42B7-6 @@ -44,6 +44,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{CE5B42B7-6
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "HtmlHelp2JScriptGlobals", "AddIns\Misc\HtmlHelp2\JScriptGlobals\HtmlHelp2JScriptGlobals.vbproj", "{E54A5AD2-418D-4A85-BA5E-CD803DE38715}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCoverage", "AddIns\Misc\CodeCoverage\Project\CodeCoverage.csproj", "{08ce9972-283b-44f4-82fa-966f7dfa6b7a}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpQuery", "AddIns\Misc\SharpQuery\SharpQuery.csproj", "{BDD03ECD-42AE-4B50-9805-9C19090A264F}"
@ -280,6 +282,10 @@ Global @@ -280,6 +282,10 @@ Global
{08CE9972-283B-44F4-82FA-966F7DFA6B7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08CE9972-283B-44F4-82FA-966F7DFA6B7A}.Release|Any CPU.Build.0 = Release|Any CPU
{08CE9972-283B-44F4-82FA-966F7DFA6B7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E54A5AD2-418D-4A85-BA5E-CD803DE38715}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E54A5AD2-418D-4A85-BA5E-CD803DE38715}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E54A5AD2-418D-4A85-BA5E-CD803DE38715}.Release|Any CPU.Build.0 = Release|Any CPU
{E54A5AD2-418D-4A85-BA5E-CD803DE38715}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -316,6 +322,7 @@ Global @@ -316,6 +322,7 @@ Global
{8C52FFA5-35AF-4E28-8498-2DC2F168A241} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{BDD03ECD-42AE-4B50-9805-9C19090A264F} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{08ce9972-283b-44f4-82fa-966f7dfa6b7a} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{E54A5AD2-418D-4A85-BA5E-CD803DE38715} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{B08385CD-F0CC-488C-B4F4-EEB34B6D2688} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}

Loading…
Cancel
Save