Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Runtime.InteropServices.ComTypes;

namespace System.Runtime.InteropServices
{
// UCOMITypeLib is not yet ported to interop on core.
[Guid("00020402-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[ComImport]
public interface UCOMITypeLib
{
[PreserveSig]
int GetTypeInfoCount();

void GetTypeInfoType(int index, out TYPEKIND pTKind);

void GetLibAttr(out IntPtr ppTLibAttr);

void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile);

[return: MarshalAs(UnmanagedType.Bool)]
bool IsName([MarshalAs(UnmanagedType.LPWStr)] string szNameBuf, int lHashVal);

[PreserveSig]
void ReleaseTLibAttr(IntPtr pTLibAttr);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,71 +10,99 @@
namespace System.Windows.Forms.Design
{
/// <summary>
/// <para>
/// Imports ActiveX controls and generates a wrapper that can be accessed by a
/// designer.
/// </para>
/// Imports ActiveX controls and generates a wrapper that can be accessed by a designer.
/// </summary>
public class AxImporter
{
public AxImporter(Options options)
{
throw new NotImplementedException(SR.NotImplementedByDesign);
}

public sealed class Options
{
/// <summary>
/// The flag that controls when we sign the generated assemblies.
/// </summary>
public bool delaySign = false;

/// <summary>
/// Flag that controls whether we are to generate sources for the ActiveX control wrapper.
/// </summary>
public bool genSources = false;

/// <summary>
/// Regardless of which version of the library is registered, if at all, use the
/// path supplied on the command line for AxImp to generate the Windows Forms wrappers.
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
//This class is used to communicate option values between components, it does not have any functionality which might modify these values.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "This class is used to communicate option values between components, it does not have any functionality which might modify these values.")]
public bool ignoreRegisteredOcx;

/// <summary>
/// The file containing the strong name key container for the generated assemblies.
/// </summary>
public string keyContainer = null;

/// <summary>
/// The file containing the strong name key for the generated assemblies.
/// </summary>
public string keyFile = null;

/// <summary>
/// The strong name used for the generated assemblies.
/// </summary>
public StrongNameKeyPair keyPair = null;

/// <summary>
/// Flag that controls whether we should output errors in the MSBuild format.
/// </summary>
public bool msBuildErrors = false;

/// <summary>
/// Flag that controls whether we should show the logo.
/// </summary>
public bool noLogo = false;

/// <summary>
/// The output directory for all the generated assemblies.
/// <summary>
public string outputDirectory = null;

/// <summary>
/// The path-included filename of type library containing the definition of the ActiveX control.
/// </summary>
public string outputName = null;

/// <summary>
/// The flag that controls whether we try to overwrite existing generated assemblies.
/// </summary>
public bool overwriteRCW = false;

/// <summary>
/// The public key used to sign the generated assemblies.
/// </summary>
public byte[] publicKey = null;

/// <summary>
/// The object that allows us to resolve types and references needed to generate assemblies.
/// </summary>
public IReferenceResolver references = null;

/// <summary>
/// Flag that controls the output generated.
/// </summary>
public bool silentMode = false;

/// <summary>
/// Flag that controls the output generated.
/// </summary>
public bool verboseMode = false;
}

/// <summary>
/// The Reference Resolver service will try to look through the references it can obtain,
/// for a reference that matches the given criterion. For now, the only kind of references
/// it can look for are COM (RCW) references and ActiveX wrapper references.
/// The Reference Resolver service will try to look through the references it can obtain,
/// for a reference that matches the given criterion. For now, the only kind of references
/// it can look for are COM (RCW) references and ActiveX wrapper references.
/// </summary>
public interface IReferenceResolver
{
Expand All @@ -88,36 +116,3 @@ public interface IReferenceResolver
}
}
}

namespace System.Runtime.InteropServices
{

// UCOMITypeLib is not yet ported to interop on core.

[Guid("00020402-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[ComImport]
public interface UCOMITypeLib
{
[PreserveSig]
int GetTypeInfoCount();

//void GetTypeInfo(int index, out UCOMITypeInfo ppTI);
void GetTypeInfoType(int index, out TYPEKIND pTKind);

//void GetTypeInfoOfGuid(ref Guid guid, out UCOMITypeInfo ppTInfo);
void GetLibAttr(out IntPtr ppTLibAttr);

//void GetTypeComp(out UCOMITypeComp ppTComp);
void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext,
out string strHelpFile);

[return: MarshalAs(UnmanagedType.Bool)]
bool IsName([MarshalAs(UnmanagedType.LPWStr)] string szNameBuf, int lHashVal);

//void FindName([MarshalAs(UnmanagedType.LPWStr)] String szNameBuf, int lHashVal, [MarshalAs(UnmanagedType.LPArray), Out] UCOMITypeInfo[] ppTInfo, [MarshalAs(UnmanagedType.LPArray), Out] int[] rgMemId, ref Int16 pcFound);
[PreserveSig]
void ReleaseTLibAttr(IntPtr pTLibAttr);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,8 @@ public class DesignerOptions
{
private const int MinGridSize = 2;
private const int MaxGridSize = 200;
private bool _showGrid = true;
private bool _snapToGrid = true;
private Size _gridSize = new Size(8, 8);

private bool _useSnapLines = false;
private bool _useSmartTags = false;
private bool _objectBoundSmartTagAutoShow = true;
private bool _enableComponentCache = false;
private bool _enableInSituEditing = true;

/// <summary>
/// Public GridSize property.
/// </summary>
Expand All @@ -38,10 +30,23 @@ public virtual Size GridSize
set
{
//do some validation checking here
if (value.Width < MinGridSize) value.Width = MinGridSize;
if (value.Height < MinGridSize) value.Height = MinGridSize;
if (value.Width > MaxGridSize) value.Width = MaxGridSize;
if (value.Height > MaxGridSize) value.Height = MaxGridSize;
if (value.Width < MinGridSize)
{
value.Width = MinGridSize;
}
if (value.Height < MinGridSize)
{
value.Height = MinGridSize;
}
if (value.Width > MaxGridSize)
{
value.Width = MaxGridSize;
}
if (value.Height > MaxGridSize)
{
value.Height = MaxGridSize;
}

_gridSize = value;
}
}
Expand All @@ -52,69 +57,45 @@ public virtual Size GridSize
[SRCategory(nameof(SR.DesignerOptions_LayoutSettings))]
[SRDisplayName(nameof(SR.DesignerOptions_ShowGridDisplayName))]
[SRDescription(nameof(SR.DesignerOptions_ShowGridDesc))]
public virtual bool ShowGrid
{
get => _showGrid;
set => _showGrid = value;
}
public virtual bool ShowGrid { get; set; } = true;

/// <summary>
/// Public SnapToGrid property.
/// </summary>
[SRCategory(nameof(SR.DesignerOptions_LayoutSettings))]
[SRDisplayName(nameof(SR.DesignerOptions_SnapToGridDisplayName))]
[SRDescription(nameof(SR.DesignerOptions_SnapToGridDesc))]
public virtual bool SnapToGrid
{
get => _snapToGrid;
set => _snapToGrid = value;
}
public virtual bool SnapToGrid { get; set; } = true;

/// <summary>
/// This property enables or disables snaplines in the designer.
/// </summary>
[SRCategory(nameof(SR.DesignerOptions_LayoutSettings))]
[SRDescription(nameof(SR.DesignerOptions_UseSnapLines))]
public virtual bool UseSnapLines
{
get => _useSnapLines;
set => _useSnapLines = value;
}
public virtual bool UseSnapLines { get; set; }

/// <summary>
/// This property enables or disables smart tags in the designer.
/// </summary>
[SRCategory(nameof(SR.DesignerOptions_LayoutSettings))]
[SRDescription(nameof(SR.DesignerOptions_UseSmartTags))]
public virtual bool UseSmartTags
{
get => _useSmartTags;
set => _useSmartTags = value;
}
public virtual bool UseSmartTags { get; set; }

/// <summary>
/// This property enables or disables smart tags in the designer.
/// </summary>
[SRDisplayName(nameof(SR.DesignerOptions_ObjectBoundSmartTagAutoShowDisplayName))]
[SRCategory(nameof(SR.DesignerOptions_ObjectBoundSmartTagSettings))]
[SRDescription(nameof(SR.DesignerOptions_ObjectBoundSmartTagAutoShow))]
public virtual bool ObjectBoundSmartTagAutoShow
{
get => _objectBoundSmartTagAutoShow;
set => _objectBoundSmartTagAutoShow = value;
}
public virtual bool ObjectBoundSmartTagAutoShow { get; set; } = true;

/// <summary>
/// This property enables or disables the component cache
/// </summary>
[SRDisplayName(nameof(SR.DesignerOptions_CodeGenDisplay))]
[SRCategory(nameof(SR.DesignerOptions_CodeGenSettings))]
[SRDescription(nameof(SR.DesignerOptions_OptimizedCodeGen))]
public virtual bool UseOptimizedCodeGeneration
{
get => _enableComponentCache;
set => _enableComponentCache = value;
}
public virtual bool UseOptimizedCodeGeneration { get; set; }

/// <summary>
/// This property enables or disables the InSitu Editing for ToolStrips
Expand All @@ -123,10 +104,6 @@ public virtual bool UseOptimizedCodeGeneration
[SRCategory(nameof(SR.DesignerOptions_EnableInSituEditingCat))]
[SRDescription(nameof(SR.DesignerOptions_EnableInSituEditingDesc))]
[Browsable(false)]
public virtual bool EnableInSituEditing
{
get => _enableInSituEditing;
set => _enableInSituEditing = value;
}
public virtual bool EnableInSituEditing { get; set; } = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,20 @@
namespace System.Windows.Forms.Design
{
/// <summary>
/// <para>
/// This class contains command ID's and GUIDS that
/// correspond
/// to the host Command Bar menu layout.
/// </para>
/// This class contains command ID's and GUIDS that correspond to the host Command Bar menu layout.
/// </summary>
public sealed class MenuCommands : StandardCommands
{
// Windows Forms specific popup menus
//
private const int mnuidSelection = 0x0500;
private const int mnuidContainer = 0x0501;
private const int mnuidTraySelection = 0x0503;
private const int mnuidComponentTray = 0x0506;

// Windows Forms specific menu items
//
private const int cmdidDesignerProperties = 0x1001;

// Windows Forms specific keyboard commands
//
private const int cmdidReverseCancel = 0x4001;
private const int cmdidSetStatusText = 0x4003;
private const int cmdidSetStatusRectangle = 0x4004;
Expand Down Expand Up @@ -65,26 +58,26 @@ public sealed class MenuCommands : StandardCommands
private const int ECMD_END_EXT = 18;

/// <summary>
/// This guid corresponds to the standard set of commands for the shell and office.
/// This new giud is added so that the ToolStripDesigner now respond to the F2 command
/// and go into InSitu Edit mode.
/// This guid corresponds to the standard set of commands for the shell and office.
/// This new giud is added so that the ToolStripDesigner now respond to the F2 command
/// and go into InSitu Edit mode.
/// </summary>
private static readonly Guid VSStandardCommandSet97 = new Guid("{5efc7975-14bc-11cf-9b2b-00aa00573819}");

/// <summary>
/// This guid corresponds to the menu grouping Windows Forms will use for its menus. This is
/// defined in the Windows Forms menu CTC file, but we need it here so we can define what
/// context menus to use.
/// This guid corresponds to the menu grouping Windows Forms will use for its menus. This is
/// defined in the Windows Forms menu CTC file, but we need it here so we can define what
/// context menus to use.
/// </summary>
private static readonly Guid wfMenuGroup = new Guid("{74D21312-2AEE-11d1-8BFB-00A0C90F26F7}");

/// <summary>
/// This guid corresponds to the Windows Forms command set.
/// This guid corresponds to the Windows Forms command set.
/// </summary>
private static readonly Guid wfCommandSet = new Guid("{74D21313-2AEE-11d1-8BFB-00A0C90F26F7}");

/// <summary>
/// This guid is the standard vs 2k commands for key bindings
/// This guid is the standard vs 2k commands for key bindings
/// </summary>
private static readonly Guid guidVSStd2K = new Guid("{1496A755-94DE-11D0-8C3F-00C04FC2AAE2}");

Expand All @@ -97,11 +90,9 @@ public sealed class MenuCommands : StandardCommands
public static readonly CommandID ComponentTrayMenu = new CommandID(wfMenuGroup, mnuidComponentTray);

// Windows Forms commands

public static readonly CommandID DesignerProperties = new CommandID(wfCommandSet, cmdidDesignerProperties);

// Windows Forms Key commands

// Windows Forms Key commands
public static readonly CommandID KeyCancel = new CommandID(guidVSStd2K, ECMD_CANCEL);

public static readonly CommandID KeyReverseCancel = new CommandID(wfCommandSet, cmdidReverseCancel);
Expand Down
Loading