Browse Source

Add HtmlPreview and ImageViewer sample AddIns.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1133 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
79222e01e9
  1. 27
      samples/DisplayBindings/HtmlPreview/Configuration/AssemblyInfo.cs
  2. 15
      samples/DisplayBindings/HtmlPreview/HtmlPreview.addin
  3. 62
      samples/DisplayBindings/HtmlPreview/HtmlPreview.csproj
  4. 16
      samples/DisplayBindings/HtmlPreview/HtmlPreview.sln
  5. 33
      samples/DisplayBindings/HtmlPreview/Src/PreviewDisplayBinding.cs
  6. 53
      samples/DisplayBindings/HtmlPreview/Src/PreviewViewContent.cs
  7. 27
      samples/DisplayBindings/ImageViewer/Configuration/AssemblyInfo.cs
  8. 23
      samples/DisplayBindings/ImageViewer/ImageViewer.addin
  9. 66
      samples/DisplayBindings/ImageViewer/ImageViewer.csproj
  10. 16
      samples/DisplayBindings/ImageViewer/ImageViewer.sln
  11. 51
      samples/DisplayBindings/ImageViewer/Src/ImageViewContent.cs
  12. 30
      samples/DisplayBindings/ImageViewer/Src/ImageViewerDisplayBinding.cs
  13. 6
      src/AddIns/DisplayBindings/ResourceEditor/Project/ResourceEditor.addin
  14. 14
      src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.cs
  15. 2
      src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.DynamicHelp.addin
  16. 7
      src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.addin

27
samples/DisplayBindings/HtmlPreview/Configuration/AssemblyInfo.cs

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
using System.Reflection;
using 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("HtmlPreview")]
[assembly: AssemblyDescription("Addin for SharpDevelop 2.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharpDevelop")]
[assembly: AssemblyCopyright("GNU Lesser General Public Licence")]
[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.*")]

15
samples/DisplayBindings/HtmlPreview/HtmlPreview.addin

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
<AddIn name = "HtmlPreview"
author = "Daniel Grunwald"
copyright = "GNU Lesser General Public License">
<Runtime>
<Import assembly = "HtmlPreview.dll"/>
</Runtime>
<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "HtmlPreview"
type = "Secondary"
class = "HtmlPreview.PreviewDisplayBinding"
fileNamePattern = "\.html?$" />
</Path>
</AddIn>

62
samples/DisplayBindings/HtmlPreview/HtmlPreview.csproj

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>HtmlPreview</RootNamespace>
<AssemblyName>HtmlPreview</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BECEEB35-A81D-4545-AC8E-BC622451DB99}</ProjectGuid>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<StartAction>Program</StartAction>
<StartProgram>..\..\..\bin\SharpDevelop.exe</StartProgram>
<OutputPath>..\..\..\AddIns\Samples\HtmlPreview</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="ICSharpCode.SharpDevelop">
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="ICSharpCode.Core">
<HintPath>..\..\..\bin\ICSharpCode.Core.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="HtmlPreview.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\PreviewViewContent.cs" />
<Compile Include="Src\PreviewDisplayBinding.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

16
samples/DisplayBindings/HtmlPreview/HtmlPreview.sln

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.0.0.1128
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HtmlPreview", "HtmlPreview.csproj", "{BECEEB35-A81D-4545-AC8E-BC622451DB99}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BECEEB35-A81D-4545-AC8E-BC622451DB99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BECEEB35-A81D-4545-AC8E-BC622451DB99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BECEEB35-A81D-4545-AC8E-BC622451DB99}.Release|Any CPU.Build.0 = Release|Any CPU
{BECEEB35-A81D-4545-AC8E-BC622451DB99}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
EndGlobal

33
samples/DisplayBindings/HtmlPreview/Src/PreviewDisplayBinding.cs

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 19.10.2005
* Time: 17:02
*/
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace HtmlPreview
{
/// <summary>
/// Description of PreviewDisplayBinding.
/// </summary>
public class PreviewDisplayBinding : ISecondaryDisplayBinding
{
public bool ReattachWhenParserServiceIsReady {
get {
return false;
}
}
public bool CanAttachTo(IViewContent content) {
return true;
}
public ISecondaryViewContent[] CreateSecondaryViewContent(IViewContent viewContent) {
return new ISecondaryViewContent[] { new PreviewViewContent() };
}
}
}

53
samples/DisplayBindings/HtmlPreview/Src/PreviewViewContent.cs

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 19.10.2005
* Time: 15:53
*/
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace HtmlPreview
{
/// <summary>
/// Description of PreviewViewContent.
/// </summary>
public class PreviewViewContent : AbstractSecondaryViewContent
{
public PreviewViewContent()
{
}
WebBrowser browser = new WebBrowser();
#region ICSharpCode.SharpDevelop.Gui.AbstractSecondaryViewContent interface implementation
public override Control Control {
get {
return browser;
}
}
public override string TabPageText {
get {
return "Preview";
}
}
public override void Deselected() {
browser.DocumentText = "";
base.Deselected();
}
public override void Selected() {
IViewContent viewContent = this.WorkbenchWindow.ViewContent;
IEditable editable = (IEditable)viewContent;
browser.DocumentText = editable.Text;
base.Selected();
}
#endregion
}
}

27
samples/DisplayBindings/ImageViewer/Configuration/AssemblyInfo.cs

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
using System.Reflection;
using 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("ImageViewer")]
[assembly: AssemblyDescription("Addin for SharpDevelop 2.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharpDevelop")]
[assembly: AssemblyCopyright("GNU Lesser General Public Licence")]
[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.*")]

23
samples/DisplayBindings/ImageViewer/ImageViewer.addin

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
<AddIn name = "ImageViewer"
author = "Daniel Grunwald"
copyright = "GNU Lesser General Public License">
<Runtime>
<Import assembly = "ImageViewer.dll"/>
</Runtime>
<Path name="/SharpDevelop/Workbench/FileFilter">
<FileFilter id = "ImageFileFilter"
name = "Images"
extensions = "*.bmp;*.gif;*.jpg;*.jpeg;*.png"
insertbefore = "Boo"/>
</Path>
<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "ImageViewer"
class = "ImageViewer.ImageViewerDisplayBinding"
insertbefore = "Text"
fileNamePattern = "\.(bmp|gif|jpe?g|png)$"
languagePattern = "^ImagesFiles$"/>
</Path>
</AddIn>

66
samples/DisplayBindings/ImageViewer/ImageViewer.csproj

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>ImageViewer</RootNamespace>
<AssemblyName>ImageViewer</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BECEEB35-A81D-4545-AC8E-BC622451DB99}</ProjectGuid>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<StartAction>Program</StartAction>
<StartProgram>..\..\..\bin\SharpDevelop.exe</StartProgram>
<OutputPath>..\..\..\AddIns\Samples\ImageViewer\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="ICSharpCode.Core">
<HintPath>..\..\..\bin\ICSharpCode.Core.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="ICSharpCode.SharpDevelop">
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="ImageViewer.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\ImageViewerDisplayBinding.cs" />
<Compile Include="Src\ImageViewContent.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Src" />
<Folder Include="Resources" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

16
samples/DisplayBindings/ImageViewer/ImageViewer.sln

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.0.0.1128
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageViewer", "ImageViewer.csproj", "{BECEEB35-A81D-4545-AC8E-BC622451DB99}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BECEEB35-A81D-4545-AC8E-BC622451DB99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BECEEB35-A81D-4545-AC8E-BC622451DB99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BECEEB35-A81D-4545-AC8E-BC622451DB99}.Release|Any CPU.Build.0 = Release|Any CPU
{BECEEB35-A81D-4545-AC8E-BC622451DB99}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
EndGlobal

51
samples/DisplayBindings/ImageViewer/Src/ImageViewContent.cs

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 19.10.2005
* Time: 21:43
*/
using System;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace ImageViewer
{
public class ImageViewContent : AbstractViewContent
{
PictureBox box = new PictureBox();
public override Control Control {
get {
return box;
}
}
public override string TabPageText {
get {
return "Image Viewer";
}
}
public override void Load(string fileName) {
this.IsDirty = false;
this.FileName = fileName;
this.TitleName = Path.GetFileName(fileName);
box.SizeMode = PictureBoxSizeMode.Zoom;
box.Load(fileName);
}
public override void Save(string fileName) {
this.IsDirty = false;
this.FileName = fileName;
this.TitleName = Path.GetFileName(fileName);
box.Image.Save(fileName);
}
public override bool IsReadOnly {
get {
return (File.GetAttributes(this.FileName)
& FileAttributes.ReadOnly) != 0;
}
}
}
}

30
samples/DisplayBindings/ImageViewer/Src/ImageViewerDisplayBinding.cs

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 19.10.2005
* Time: 21:41
*/
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace ImageViewer
{
public class ImageViewerDisplayBinding : IDisplayBinding
{
public bool CanCreateContentForFile(string fileName) {
return true;
}
public IViewContent CreateContentForFile(string fileName) {
ImageViewContent vc = new ImageViewContent();
vc.Load(fileName);
return vc;
}
public bool CanCreateContentForLanguage(string languageName) {
return false;
}
public IViewContent CreateContentForLanguage(string languageName, string content) {
throw new NotImplementedException();
}
}
}

6
src/AddIns/DisplayBindings/ResourceEditor/Project/ResourceEditor.addin

@ -1,7 +1,11 @@ @@ -1,7 +1,11 @@
<AddIn name = "Resource Editor"
author = "Mike Krueger"
copyright = "prj:///doc/copyright.txt"
description = "A Display binding for *.resources and *.resx files.">
description = "A display binding for *.resources and *.resx files.">
<Manifest>
<Identity name = "ICSharpCode.ResourceEditor"/>
</Manifest>
<Runtime>
<Import assembly="ResourceEditor.dll"/>

14
src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.cs

@ -89,7 +89,7 @@ namespace ICSharpCode.AddInManager @@ -89,7 +89,7 @@ namespace ICSharpCode.AddInManager
});
foreach (AddIn addIn in addInList) {
string identity = addIn.Manifest.PrimaryIdentity;
if (identity == null || addIn.Properties["addInManagerHidden"] == "true")
if (addIn.Properties["addInManagerHidden"] == "true")
continue;
addInControl = new AddInControl(addIn);
addInControl.Dock = DockStyle.Top;
@ -213,6 +213,7 @@ namespace ICSharpCode.AddInManager @@ -213,6 +213,7 @@ namespace ICSharpCode.AddInManager
runActionButton.Visible = true;
uninstallButton.Visible = true;
bool allHaveIdentity = true;
bool allEnabled = true;
bool allDisabled = true;
bool allInstalling = true;
@ -221,6 +222,10 @@ namespace ICSharpCode.AddInManager @@ -221,6 +222,10 @@ namespace ICSharpCode.AddInManager
bool allUninstallable = true;
bool hasErrors = false;
foreach (AddIn addIn in selected) {
if (addIn.Manifest.PrimaryIdentity == null) {
allHaveIdentity = false;
break;
}
allEnabled &= addIn.Action == AddInAction.Enable;
if (addIn.Action == AddInAction.DependencyError || addIn.Action == AddInAction.InstalledTwice)
hasErrors = true;
@ -235,11 +240,14 @@ namespace ICSharpCode.AddInManager @@ -235,11 +240,14 @@ namespace ICSharpCode.AddInManager
}
}
}
if (allEnabled) {
if (allEnabled == true || allHaveIdentity == false) {
selectedAction = AddInAction.Disable;
actionGroupBox.Text = runActionButton.Text = ResourceService.GetString("AddInManager.ActionDisable");
actionDescription.Text = ResourceService.GetString("AddInManager.DescriptionDisable");
runActionButton.Enabled = ShowDependencies(selected, ShowDependencyMode.Disable);
if (allHaveIdentity)
runActionButton.Enabled = ShowDependencies(selected, ShowDependencyMode.Disable);
else
runActionButton.Enabled = false;
uninstallButton.Enabled = allUninstallable && runActionButton.Enabled;
} else if (allDisabled) {
selectedAction = AddInAction.Enable;

2
src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.DynamicHelp.addin

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
description = "integrates Microsoft's Help 2.0 Environment">
<Manifest>
<Identity name = "ICSharpCode.HtmlHelp2"/>
<Identity name = "ICSharpCode.HtmlHelp2.DynamicHelpPad"/>
</Manifest>
<Runtime>

7
src/AddIns/Misc/HtmlHelp2/Project/HtmlHelp2.addin

@ -1,6 +1,11 @@ @@ -1,6 +1,11 @@
<AddIn name = "Help 2.0 Environment for SharpDevelop"
author = "Mathias Simmack"
description = "integrates Microsoft's Help 2.0 Environment">
description = "integrates Microsoft's Help 2.0 Environment"
addInManagerHidden = "true">
<Manifest>
<Identity name = "ICSharpCode.HtmlHelp2"/>
</Manifest>
<Runtime>
<Import assembly="HtmlHelp2.dll"/>

Loading…
Cancel
Save