-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17dd8db
commit fe1cc3a
Showing
7 changed files
with
249 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+32.8 KB
rhinocommon/cs/SampleCsMouseCallback/EmbeddedResources/plugin-utility.ico
Binary file not shown.
59 changes: 59 additions & 0 deletions
59
rhinocommon/cs/SampleCsMouseCallback/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using Rhino.PlugIns; | ||
|
||
// Plug-in Description Attributes - all of these are optional. | ||
// These will show in Rhino's option dialog, in the tab Plug-ins. | ||
[assembly: PlugInDescription(DescriptionType.Address, "-")] | ||
[assembly: PlugInDescription(DescriptionType.Country, "-")] | ||
[assembly: PlugInDescription(DescriptionType.Email, "-")] | ||
[assembly: PlugInDescription(DescriptionType.Phone, "-")] | ||
[assembly: PlugInDescription(DescriptionType.Fax, "-")] | ||
[assembly: PlugInDescription(DescriptionType.Organization, "-")] | ||
[assembly: PlugInDescription(DescriptionType.UpdateUrl, "-")] | ||
[assembly: PlugInDescription(DescriptionType.WebSite, "-")] | ||
|
||
// Icons should be Windows .ico files and contain 32-bit images in the following sizes: 16, 24, 32, 48, and 256. | ||
// This is a Rhino 6-only description. | ||
[assembly: PlugInDescription(DescriptionType.Icon, "SampleCsMouseCallback.EmbeddedResources.plugin-utility.ico")] | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("SampleCsMouseCallback")] | ||
|
||
// This will be used also for the plug-in description. | ||
[assembly: AssemblyDescription("SampleCsMouseCallback utility plug-in")] | ||
|
||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("SampleCsMouseCallback")] | ||
[assembly: AssemblyCopyright("Copyright © 2019")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("cf2a3245-3eb5-4247-8532-a09139eec262")] // This will also be the Guid of the Rhino plug-in | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
|
||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] | ||
|
||
// Make compatible with Rhino Installer Engine | ||
[assembly: AssemblyInformationalVersion("2")] |
85 changes: 85 additions & 0 deletions
85
rhinocommon/cs/SampleCsMouseCallback/SampleCsMouseCallback.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{CF2A3245-3EB5-4247-8532-A09139EEC262}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>SampleCsMouseCallback</RootNamespace> | ||
<AssemblyName>SampleCsMouseCallback</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<IsWebBootstrapper>false</IsWebBootstrapper> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>..\bin\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="RhinoCommon"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>C:\Program Files\Rhino 6\System\rhinocommon.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Eto"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>C:\Program Files\Rhino 6\System\Eto.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="Rhino.UI"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>C:\Program Files\Rhino 6\System\Rhino.UI.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="SampleCsMouseCallbackCommand.cs" /> | ||
<Compile Include="SampleCsMouseCallbackPlugIn.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="SampleMouseCallback.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="EmbeddedResources\plugin-utility.ico" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
<PropertyGroup> | ||
<PostBuildEvent>Copy "$(TargetPath)" "$(TargetDir)$(ProjectName).rhp" | ||
Erase "$(TargetPath)"</PostBuildEvent> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<FallbackCulture>en-US</FallbackCulture> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> | ||
<StartProgram>C:\Program Files\Rhino 6\System\Rhino.exe</StartProgram> | ||
<StartArguments> | ||
</StartArguments> | ||
<StartAction>Program</StartAction> | ||
</PropertyGroup> | ||
</Project> |
39 changes: 39 additions & 0 deletions
39
rhinocommon/cs/SampleCsMouseCallback/SampleCsMouseCallbackCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Rhino; | ||
using Rhino.Commands; | ||
using Rhino.Geometry; | ||
using Rhino.Input; | ||
using Rhino.Input.Custom; | ||
|
||
namespace SampleCsMouseCallback | ||
{ | ||
public class SampleCsMouseCallbackCommand : Command | ||
{ | ||
readonly SampleMouseCallback smcb = new SampleMouseCallback(); | ||
public SampleCsMouseCallbackCommand() | ||
{ | ||
// Rhino only creates one instance of each command class defined in a | ||
// plug-in, so it is safe to store a refence in a static property. | ||
Instance = this; | ||
} | ||
|
||
///<summary>The only instance of this command.</summary> | ||
public static SampleCsMouseCallbackCommand Instance | ||
{ | ||
get; private set; | ||
} | ||
|
||
///<returns>The command name as it appears on the Rhino command line.</returns> | ||
public override string EnglishName | ||
{ | ||
get { return "SampleCsMouseCallbackCommand"; } | ||
} | ||
|
||
protected override Result RunCommand(RhinoDoc doc, RunMode mode) | ||
{ | ||
smcb.Enabled = !smcb.Enabled; | ||
return Result.Success; | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
rhinocommon/cs/SampleCsMouseCallback/SampleCsMouseCallbackPlugIn.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace SampleCsMouseCallback | ||
{ | ||
///<summary> | ||
/// <para>Every RhinoCommon .rhp assembly must have one and only one PlugIn-derived | ||
/// class. DO NOT create instances of this class yourself. It is the | ||
/// responsibility of Rhino to create an instance of this class.</para> | ||
/// <para>To complete plug-in information, please also see all PlugInDescription | ||
/// attributes in AssemblyInfo.cs (you might need to click "Project" -> | ||
/// "Show All Files" to see it in the "Solution Explorer" window).</para> | ||
///</summary> | ||
public class SampleCsMouseCallbackPlugIn : Rhino.PlugIns.PlugIn | ||
|
||
{ | ||
public SampleCsMouseCallbackPlugIn() | ||
{ | ||
Instance = this; | ||
} | ||
|
||
///<summary>Gets the only instance of the SampleCsMouseCallbackPlugIn plug-in.</summary> | ||
public static SampleCsMouseCallbackPlugIn Instance | ||
{ | ||
get; private set; | ||
} | ||
|
||
// You can override methods here to change the plug-in behavior on | ||
// loading and shut down, add options pages to the Rhino _Option command | ||
// and maintain plug-in wide options in a document. | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
rhinocommon/cs/SampleCsMouseCallback/SampleMouseCallback.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Rhino; | ||
using Rhino.UI; | ||
|
||
namespace SampleCsMouseCallback | ||
{ | ||
public class SampleMouseCallback : MouseCallback | ||
{ | ||
protected override void OnMouseEnter(MouseCallbackEventArgs e) | ||
{ | ||
RhinoApp.WriteLine($"Entering view {e.View?.ActiveViewport?.Name}"); | ||
} | ||
|
||
protected override void OnMouseHover(MouseCallbackEventArgs e) | ||
{ | ||
RhinoApp.WriteLine($"Hovering on view {e.View?.ActiveViewport?.Name}"); | ||
base.OnMouseHover(e); | ||
} | ||
|
||
protected override void OnMouseLeave(MouseCallbackEventArgs e) | ||
{ | ||
RhinoApp.WriteLine($"Leaving view {e.View?.ActiveViewport?.Name}"); | ||
base.OnMouseLeave(e); | ||
} | ||
|
||
protected override void OnMouseMove(MouseCallbackEventArgs e) | ||
{ | ||
RhinoApp.WriteLine($"Moving over view {e.View?.ActiveViewport?.Name}"); | ||
base.OnMouseMove(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters