change UI to UI.WinForms
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.Plugins.Advanced.UI.Telerik;
|
namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik;
|
||||||
|
|
||||||
public static class Extensions
|
public static class Extensions
|
||||||
{
|
{
|
||||||
@@ -14,27 +14,27 @@ public static class Extensions
|
|||||||
|
|
||||||
public static RadButtonItem GetAsItem(this PluginModuleBase module, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
|
public static RadButtonItem GetAsItem(this PluginModuleBase module, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
|
||||||
{
|
{
|
||||||
return GetAsItem(module, true, buttonType: buttonType);
|
return module.GetAsItem(true, buttonType: buttonType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RadButtonItem GetAsItem(this PluginModuleBase module, bool addDefaultHandler, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
|
public static RadButtonItem GetAsItem(this PluginModuleBase module, bool addDefaultHandler, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
|
||||||
{
|
{
|
||||||
return GetAsItem(module, addDefaultHandler ? RadMenuItem_RMMethod_Click : null, buttonType: buttonType);
|
return module.GetAsItem(addDefaultHandler ? RadMenuItem_RMMethod_Click : null, buttonType: buttonType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RadButtonItem GetAsItem(this PluginFunction function, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
|
public static RadButtonItem GetAsItem(this PluginFunction function, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
|
||||||
{
|
{
|
||||||
return GetAsItem(function, true, buttonType: buttonType);
|
return function.GetAsItem(true, buttonType: buttonType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RadButtonItem GetAsItem(this PluginFunction function, bool addDefaultHandler, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
|
public static RadButtonItem GetAsItem(this PluginFunction function, bool addDefaultHandler, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
|
||||||
{
|
{
|
||||||
return GetAsItem(function, addDefaultHandler ? RadMenuItem_RMFunction_Click : null, buttonType: buttonType);
|
return function.GetAsItem(addDefaultHandler ? RadMenuItem_RMFunction_Click : null, buttonType: buttonType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RadButtonItem GetAsItem(this PluginFeature module, EventHandler? clickHandler, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
|
public static RadButtonItem GetAsItem(this PluginFeature module, EventHandler? clickHandler, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
|
||||||
{
|
{
|
||||||
RadButtonItem item = buttonType switch
|
var item = buttonType switch
|
||||||
{
|
{
|
||||||
PluginButtonType.RadMenuItem => new RadMenuItem(),
|
PluginButtonType.RadMenuItem => new RadMenuItem(),
|
||||||
PluginButtonType.RadButtonElement => new RadButtonElement(),
|
PluginButtonType.RadButtonElement => new RadButtonElement(),
|
||||||
@@ -9,12 +9,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Pilz.Plugins.Advanced.UI\Pilz.Plugins.Advanced.UI.csproj" />
|
<ProjectReference Include="..\Pilz.Plugins.Advanced.UI.WinForms\Pilz.Plugins.Advanced.UI.WinForms.csproj" />
|
||||||
<ProjectReference Include="..\Pilz.UI.Telerik\Pilz.UI.Telerik.csproj" />
|
<ProjectReference Include="..\Pilz.UI.WinForms.Telerik\Pilz.UI.WinForms.Telerik.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.7.5</Version>
|
<Version>1.8.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.Plugins.Advanced.UI.Telerik;
|
namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik;
|
||||||
|
|
||||||
public enum PluginButtonType
|
public enum PluginButtonType
|
||||||
{
|
{
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Pilz.UI.Telerik.Dialogs;
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
using Pilz.UI.Telerik.Extensions;
|
using Pilz.UI.WinForms.Telerik.Extensions;
|
||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
|
|
||||||
namespace Pilz.Plugins.Advanced.UI.Telerik;
|
namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik;
|
||||||
|
|
||||||
public abstract class RadPluginModule : PluginModule<RadPluginModuleUI>
|
public abstract class RadPluginModule : PluginModule<RadPluginModuleUI>
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Pilz.UI;
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
using Pilz.UI.Telerik.Dialogs;
|
using Pilz.UI.WinForms;
|
||||||
|
|
||||||
namespace Pilz.Plugins.Advanced.UI.Telerik;
|
namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik;
|
||||||
|
|
||||||
public class RadPluginModuleUI : RadFlyoutBase, ILoadContent
|
public class RadPluginModuleUI : RadFlyoutBase, ILoadContent
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.Plugins.Advanced.UI;
|
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||||
|
|
||||||
public enum ControlExecuteReason
|
public enum ControlExecuteReason
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Pilz.Plugins.Advanced.UI;
|
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||||
|
|
||||||
internal class ControlListener(IEnumerable<ControlListenerFeature> features, Control control, bool recursive) : IControlListener
|
internal class ControlListener(IEnumerable<ControlListenerFeature> features, Control control, bool recursive) : IControlListener
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.Plugins.Advanced.UI;
|
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||||
|
|
||||||
internal class ControlListenerDummy(IEnumerable<ControlListenerFeature> features, Control control, bool recursive) : ControlListener(features, control, recursive)
|
internal class ControlListenerDummy(IEnumerable<ControlListenerFeature> features, Control control, bool recursive) : ControlListener(features, control, recursive)
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.Plugins.Advanced.UI;
|
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||||
|
|
||||||
public abstract class ControlListenerFeature : PluginFeature
|
public abstract class ControlListenerFeature : PluginFeature
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.Plugins.Advanced.UI;
|
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||||
|
|
||||||
public class ControlParameters(Control? control) : PluginFunctionParameter
|
public class ControlParameters(Control? control) : PluginFunctionParameter
|
||||||
{
|
{
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
namespace Pilz.Plugins.Advanced.UI.Extensions;
|
namespace Pilz.Plugins.Advanced.UI.WinForms.Extensions;
|
||||||
|
|
||||||
public static class PluginFeatureControllerExtensions
|
public static class PluginFeatureControllerExtensions
|
||||||
{
|
{
|
||||||
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control)
|
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control)
|
||||||
{
|
{
|
||||||
return ApplyControlManager(@this, featureType, control, true, true);
|
return @this.ApplyControlManager(featureType, control, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, PluginFunctionParameter? parameter)
|
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, PluginFunctionParameter? parameter)
|
||||||
{
|
{
|
||||||
return ApplyControlManager(@this, featureType, control, true, true, parameter);
|
return @this.ApplyControlManager(featureType, control, true, true, parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, bool recursive, bool autoTrack)
|
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, bool recursive, bool autoTrack)
|
||||||
{
|
{
|
||||||
return ApplyControlManager(@this, featureType, control, recursive, autoTrack, null);
|
return @this.ApplyControlManager(featureType, control, recursive, autoTrack, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, bool recursive, bool autoTrack, PluginFunctionParameter? parameter)
|
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, bool recursive, bool autoTrack, PluginFunctionParameter? parameter)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.Plugins.Advanced.UI;
|
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum FeatureInsertMode
|
public enum FeatureInsertMode
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.Plugins.Advanced.UI;
|
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum FeatureInsertPosition
|
public enum FeatureInsertPosition
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.Plugins.Advanced.UI;
|
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||||
|
|
||||||
public interface IControlListener
|
public interface IControlListener
|
||||||
{
|
{
|
||||||
@@ -9,12 +9,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.8.3</Version>
|
<Version>1.9.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Pilz.Plugins.Advanced\Pilz.Plugins.Advanced.csproj" />
|
<ProjectReference Include="..\Pilz.Plugins.Advanced\Pilz.Plugins.Advanced.csproj" />
|
||||||
<ProjectReference Include="..\Pilz.UI\Pilz.UI.csproj" />
|
<ProjectReference Include="..\Pilz.UI.WinForms\Pilz.UI.WinForms.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Pilz.UI.Dialogs;
|
using Pilz.UI.Dialogs;
|
||||||
using Pilz.UI.Extensions;
|
using Pilz.UI.WinForms.Extensions;
|
||||||
|
|
||||||
namespace Pilz.Plugins.Advanced.UI;
|
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||||
|
|
||||||
public abstract class PluginModule : PluginModule<PluginModuleUI>
|
public abstract class PluginModule : PluginModule<PluginModuleUI>
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Pilz.UI;
|
using Pilz.UI.WinForms;
|
||||||
using Pilz.UI.Dialogs;
|
using Pilz.UI.WinForms.Dialogs;
|
||||||
|
|
||||||
namespace Pilz.Plugins.Advanced.UI;
|
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||||
|
|
||||||
public partial class PluginModuleUI : FlyoutBase, ILoadContent
|
public partial class PluginModuleUI : FlyoutBase, ILoadContent
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.Plugins.Advanced.UI;
|
namespace Pilz.Plugins.Advanced.UI.WinForms;
|
||||||
|
|
||||||
public abstract class PluginModule<TPluginModuleUI> : PluginModuleBase where TPluginModuleUI : Control
|
public abstract class PluginModule<TPluginModuleUI> : PluginModuleBase where TPluginModuleUI : Control
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Symbols.Factories;
|
namespace Pilz.UI.WinForms.Telerik.Symbols.Factories;
|
||||||
|
|
||||||
public class BasicFactory<T>(string baseName) : RadSymbolFactory<T> where T : Enum
|
public class BasicFactory<T>(string baseName) : RadSymbolFactory<T> where T : Enum
|
||||||
{
|
{
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.0.10</Version>
|
<Version>1.2.0</Version>
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Pilz.UI.Telerik\Pilz.UI.Telerik.csproj" />
|
<ProjectReference Include="..\Pilz.UI.WinForms.Telerik\Pilz.UI.WinForms.Telerik.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Pilz.SymbolPacks.Sets;
|
using Pilz.SymbolPacks.Sets;
|
||||||
using Pilz.UI.Telerik.Symbols.Factories;
|
using Pilz.UI.Telerik.Symbols.Factories;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Symbols;
|
namespace Pilz.UI.WinForms.Telerik.Symbols;
|
||||||
|
|
||||||
public static class RadSymbols
|
public static class RadSymbols
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
//using System.Linq;
|
//using System.Linq;
|
||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
|
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -5,7 +5,7 @@ using Telerik.WinControls;
|
|||||||
//using System.Linq;
|
//using System.Linq;
|
||||||
using Telerik.WinControls.Data;
|
using Telerik.WinControls.Data;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
|
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// RadCompositeValidationRule evaluates two or more RadValidationRules or RadValidationRuleWithTargetControl
|
/// RadCompositeValidationRule evaluates two or more RadValidationRules or RadValidationRuleWithTargetControl
|
||||||
@@ -30,14 +30,12 @@ public class RadCompositeValidationRuleEx : CompositeFilterDescriptor, IRadValid
|
|||||||
List<Control> controls = [];
|
List<Control> controls = [];
|
||||||
foreach (IRadValidationRuleEx validationRule in ValidationRules)
|
foreach (IRadValidationRuleEx validationRule in ValidationRules)
|
||||||
{
|
{
|
||||||
foreach (Control control in validationRule.Controls)
|
foreach (var control in validationRule.Controls)
|
||||||
{
|
{
|
||||||
if (!controls.Contains(control))
|
if (!controls.Contains(control))
|
||||||
{
|
|
||||||
controls.Add(control);
|
controls.Add(control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return controls;
|
return controls;
|
||||||
}
|
}
|
||||||
@@ -58,18 +56,14 @@ public class RadCompositeValidationRuleEx : CompositeFilterDescriptor, IRadValid
|
|||||||
public virtual void AddControl(RadControl control)
|
public virtual void AddControl(RadControl control)
|
||||||
{
|
{
|
||||||
if (control == null)
|
if (control == null)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
foreach (IRadValidationRuleEx validationRule in ValidationRules)
|
foreach (IRadValidationRuleEx validationRule in ValidationRules)
|
||||||
{
|
{
|
||||||
if (!validationRule.Controls.Contains(control))
|
if (!validationRule.Controls.Contains(control))
|
||||||
{
|
|
||||||
validationRule.AddControl(control);
|
validationRule.AddControl(control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Removes the specified RadControl descendant from this rule and from all controls in ValidationRules collection .</para>
|
/// <para>Removes the specified RadControl descendant from this rule and from all controls in ValidationRules collection .</para>
|
||||||
@@ -78,9 +72,7 @@ public class RadCompositeValidationRuleEx : CompositeFilterDescriptor, IRadValid
|
|||||||
public void RemoveControl(RadControl control)
|
public void RemoveControl(RadControl control)
|
||||||
{
|
{
|
||||||
if (control == null)
|
if (control == null)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
foreach (IRadValidationRuleEx validationRule in ValidationRules)
|
foreach (IRadValidationRuleEx validationRule in ValidationRules)
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
|
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
|
||||||
|
|
||||||
public delegate void RadValidationEventHandlerEx(object sender, RadValidationEventArgsEx e);
|
public delegate void RadValidationEventHandlerEx(object sender, RadValidationEventArgsEx e);
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ using Telerik.WinControls.Data;
|
|||||||
using Telerik.WinControls.Design;
|
using Telerik.WinControls.Design;
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
|
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a validation management for RadControl descendant editors.
|
/// Provides a validation management for RadControl descendant editors.
|
||||||
@@ -3,7 +3,7 @@ using System.Drawing.Design;
|
|||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
using Telerik.WinControls.Data;
|
using Telerik.WinControls.Data;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
|
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// RadValidationRule provides a validation logic which compares RadControl's Property with Rule's Value.
|
/// RadValidationRule provides a validation logic which compares RadControl's Property with Rule's Value.
|
||||||
@@ -42,10 +42,8 @@ public class RadValidationRuleEx : FilterDescriptor, IRadValidationRuleEx
|
|||||||
public virtual void AddControl(RadControl control)
|
public virtual void AddControl(RadControl control)
|
||||||
{
|
{
|
||||||
if (control != null && !controls.Contains(control))
|
if (control != null && !controls.Contains(control))
|
||||||
{
|
|
||||||
controls.Add(control);
|
controls.Add(control);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Removes the specified RadControl descendant from this rule.</para>
|
/// <para>Removes the specified RadControl descendant from this rule.</para>
|
||||||
@@ -54,9 +52,7 @@ public class RadValidationRuleEx : FilterDescriptor, IRadValidationRuleEx
|
|||||||
public virtual void RemoveControl(RadControl control)
|
public virtual void RemoveControl(RadControl control)
|
||||||
{
|
{
|
||||||
if (control == null)
|
if (control == null)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
while (controls.Contains(control))
|
while (controls.Contains(control))
|
||||||
{
|
{
|
||||||
@@ -120,8 +116,8 @@ public class RadValidationRuleEx : FilterDescriptor, IRadValidationRuleEx
|
|||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool AutoToolTip
|
public bool AutoToolTip
|
||||||
{
|
{
|
||||||
get { return this.autoToolTip; }
|
get { return autoToolTip; }
|
||||||
set { this.autoToolTip = value; }
|
set { autoToolTip = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -130,8 +126,8 @@ public class RadValidationRuleEx : FilterDescriptor, IRadValidationRuleEx
|
|||||||
[DefaultValue("Validation Failed")]
|
[DefaultValue("Validation Failed")]
|
||||||
public string ToolTipTitle
|
public string ToolTipTitle
|
||||||
{
|
{
|
||||||
get { return this.toolTipTitle; }
|
get { return toolTipTitle; }
|
||||||
set { this.toolTipTitle = value; }
|
set { toolTipTitle = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -141,8 +137,8 @@ public class RadValidationRuleEx : FilterDescriptor, IRadValidationRuleEx
|
|||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool CaseSensitive
|
public bool CaseSensitive
|
||||||
{
|
{
|
||||||
get { return this.caseSensitive; }
|
get { return caseSensitive; }
|
||||||
set { this.caseSensitive = value; }
|
set { caseSensitive = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
using Telerik.WinControls.Data;
|
using Telerik.WinControls.Data;
|
||||||
//using System.Linq;
|
//using System.Linq;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
|
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -29,8 +29,8 @@ public class RadValidationRuleWithTargetControlEx : RadValidationRuleEx
|
|||||||
[DefaultValue("Text")]
|
[DefaultValue("Text")]
|
||||||
public string TargetControlPropertyName
|
public string TargetControlPropertyName
|
||||||
{
|
{
|
||||||
get { return this.sourceControlPropertyName; }
|
get { return sourceControlPropertyName; }
|
||||||
set { this.sourceControlPropertyName = value; }
|
set { sourceControlPropertyName = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -41,10 +41,8 @@ public class RadValidationRuleWithTargetControlEx : RadValidationRuleEx
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (this.TargetControl != null)
|
if (TargetControl != null)
|
||||||
{
|
Value = CalculateValue();
|
||||||
this.Value = this.CalculateValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.Expression;
|
return base.Expression;
|
||||||
}
|
}
|
||||||
@@ -60,7 +58,7 @@ public class RadValidationRuleWithTargetControlEx : RadValidationRuleEx
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (this.TargetControl != null && !string.IsNullOrEmpty(this.TargetControlPropertyName))
|
if (TargetControl != null && !string.IsNullOrEmpty(TargetControlPropertyName))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -80,12 +78,10 @@ public class RadValidationRuleWithTargetControlEx : RadValidationRuleEx
|
|||||||
|
|
||||||
protected virtual object CalculateValue()
|
protected virtual object CalculateValue()
|
||||||
{
|
{
|
||||||
if (this.TargetControl.Site != null)
|
if (TargetControl.Site != null)
|
||||||
{
|
return string.Format("{0}.{1}", TargetControl.Name, TargetControlPropertyName);
|
||||||
return string.Format("{0}.{1}", this.TargetControl.Name, this.TargetControlPropertyName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(this.TargetControlPropertyName))
|
if (!string.IsNullOrEmpty(TargetControlPropertyName))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace Pilz.UI.Telerik.Dialogs;
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
|
|
||||||
|
namespace Pilz.UI.WinForms.Telerik.Dialogs;
|
||||||
|
|
||||||
public class DialogClosedEventArgs : EventArgs
|
public class DialogClosedEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace Pilz.UI.Telerik.Dialogs;
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
|
|
||||||
|
namespace Pilz.UI.WinForms.Telerik.Dialogs;
|
||||||
|
|
||||||
public class DialogLoadingEventArgs : EventArgs
|
public class DialogLoadingEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace Pilz.UI.Telerik.Dialogs;
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
|
|
||||||
|
namespace Pilz.UI.WinForms.Telerik.Dialogs;
|
||||||
|
|
||||||
public class FlyoutClosedEventArgs(RadFlyoutBase content) : global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs(content)
|
public class FlyoutClosedEventArgs(RadFlyoutBase content) : global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs(content)
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using Telerik.WinControls.UI.SplashScreen;
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
|
using Telerik.WinControls.UI.SplashScreen;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Dialogs;
|
namespace Pilz.UI.WinForms.Telerik.Dialogs;
|
||||||
|
|
||||||
public class FlyoutCreatedEventArgs(RadFlyoutBase content) : ContentCreatedEventArgs(content)
|
public class FlyoutCreatedEventArgs(RadFlyoutBase content) : ContentCreatedEventArgs(content)
|
||||||
{
|
{
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using Pilz.UI.Extensions;
|
using Pilz.UI.WinForms.Extensions;
|
||||||
using Pilz.UI.Telerik.Extensions;
|
using Pilz.UI.WinForms.Telerik.Dialogs;
|
||||||
|
using Pilz.UI.WinForms.Telerik.Extensions;
|
||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Dialogs;
|
namespace Pilz.UI.Telerik.Dialogs;
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Telerik.WinControls.UI;
|
using Pilz.UI.WinForms;
|
||||||
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Dialogs;
|
namespace Pilz.UI.Telerik.Dialogs;
|
||||||
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
using Telerik.WinControls;
|
using Pilz.UI.WinForms;
|
||||||
|
using Pilz.UI.WinForms.Telerik.Dialogs;
|
||||||
|
using Telerik.WinControls;
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
using Telerik.WinControls.UI.SplashScreen;
|
using Telerik.WinControls.UI.SplashScreen;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using Pilz.UI.Telerik.Controls.RadValidationProvider;
|
using Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
using Telerik.WinControls.Data;
|
using Telerik.WinControls.Data;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Pilz.UI.Telerik.Dialogs;
|
using Pilz.UI.Telerik.Dialogs;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Extensions.Extensions;
|
namespace Pilz.UI.WinForms.Telerik.Extensions;
|
||||||
|
|
||||||
public static class RadFlyoutBaseExtensions
|
public static class RadFlyoutBaseExtensions
|
||||||
{
|
{
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Extensions;
|
namespace Pilz.UI.WinForms.Telerik.Extensions;
|
||||||
|
|
||||||
public static class RadListDataItemCollectionExtensions
|
public static class RadListDataItemCollectionExtensions
|
||||||
{
|
{
|
||||||
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this) where T : struct, Enum
|
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this) where T : struct, Enum
|
||||||
{
|
{
|
||||||
return AddEnumValues<T>(@this, false);
|
return @this.AddEnumValues<T>(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this, bool clearCollection) where T : struct, Enum
|
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this, bool clearCollection) where T : struct, Enum
|
||||||
{
|
{
|
||||||
return AddEnumValues<T>(@this, clearCollection, null, null);
|
return @this.AddEnumValues<T>(clearCollection, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this, bool clearCollection, Func<T, bool>? filter, Func<T, string?>? format) where T : struct, Enum
|
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this, bool clearCollection, Func<T, bool>? filter, Func<T, string?>? format) where T : struct, Enum
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
using Telerik.WinControls.Svg;
|
using Telerik.WinControls.Svg;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Extensions;
|
namespace Pilz.UI.WinForms.Telerik.Extensions;
|
||||||
|
|
||||||
public static class RadSvgImageExtensions
|
public static class RadSvgImageExtensions
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Patches;
|
namespace Pilz.UI.WinForms.Telerik.Patches;
|
||||||
|
|
||||||
public static class Patches
|
public static class Patches
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Patches.TelerikUiForWinForms;
|
namespace Pilz.UI.WinForms.Telerik.Patches.TelerikUiForWinForms;
|
||||||
|
|
||||||
[HarmonyPatch(typeof(RadPictureBoxElement))]
|
[HarmonyPatch(typeof(RadPictureBoxElement))]
|
||||||
[HarmonyPatch("PasteImage")]
|
[HarmonyPatch("PasteImage")]
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>2.10.9</Version>
|
<Version>2.12.0</Version>
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Pilz.UI\Pilz.UI.csproj" />
|
<ProjectReference Include="..\Pilz.UI.WinForms\Pilz.UI.WinForms.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Pilz.UI.Symbols;
|
using Pilz.UI.WinForms.Symbols;
|
||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Symbols;
|
namespace Pilz.UI.WinForms.Telerik.Symbols;
|
||||||
|
|
||||||
public interface IRadSymbolFactory<TSymbols> : ISymbolFactory<TSymbols>
|
public interface IRadSymbolFactory<TSymbols> : ISymbolFactory<TSymbols>
|
||||||
{
|
{
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Pilz.UI.Symbols;
|
using Pilz.UI.WinForms.Symbols;
|
||||||
using Pilz.UI.Telerik.Extensions;
|
using Pilz.UI.WinForms.Telerik.Extensions;
|
||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Symbols;
|
namespace Pilz.UI.WinForms.Telerik.Symbols;
|
||||||
|
|
||||||
public abstract class RadSymbolFactory<TSymbols> : SymbolFactory<TSymbols>, IRadSymbolFactory<TSymbols>
|
public abstract class RadSymbolFactory<TSymbols> : SymbolFactory<TSymbols>, IRadSymbolFactory<TSymbols>
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.UI.Telerik.Theming;
|
namespace Pilz.UI.WinForms.Telerik.Theming;
|
||||||
|
|
||||||
public enum ApplicationTheme
|
public enum ApplicationTheme
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.UI.Telerik.Theming;
|
namespace Pilz.UI.WinForms.Telerik.Theming;
|
||||||
|
|
||||||
public enum HighContrastMode
|
public enum HighContrastMode
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.UI.Telerik.Theming;
|
namespace Pilz.UI.WinForms.Telerik.Theming;
|
||||||
|
|
||||||
public class ThemeDefinition
|
public class ThemeDefinition
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
|
|
||||||
namespace Pilz.UI.Telerik.Theming;
|
namespace Pilz.UI.WinForms.Telerik.Theming;
|
||||||
|
|
||||||
public static class ThemeHelper
|
public static class ThemeHelper
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.UI.Controls.ConfigurationManager;
|
namespace Pilz.UI.WinForms.Controls.ConfigurationManager;
|
||||||
|
|
||||||
public class ConfigurationEntry(string name, string title, ConfigurationValueListener Listener)
|
public class ConfigurationEntry(string name, string title, ConfigurationValueListener Listener)
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.UI.Controls.ConfigurationManager;
|
namespace Pilz.UI.WinForms.Controls.ConfigurationManager;
|
||||||
|
|
||||||
public class ConfigurationManager
|
public class ConfigurationManager
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.UI.Controls.ConfigurationManager;
|
namespace Pilz.UI.WinForms.Controls.ConfigurationManager;
|
||||||
|
|
||||||
public class ConfigurationPanel : TableLayoutPanel
|
public class ConfigurationPanel : TableLayoutPanel
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.UI.Controls.ConfigurationManager;
|
namespace Pilz.UI.WinForms.Controls.ConfigurationManager;
|
||||||
|
|
||||||
public abstract class ConfigurationValueListener : IDisposable
|
public abstract class ConfigurationValueListener : IDisposable
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace Pilz.UI.Dialogs;
|
using Pilz.UI.WinForms.Dialogs;
|
||||||
|
|
||||||
|
namespace Pilz.UI.Dialogs;
|
||||||
|
|
||||||
partial class DialogBase
|
partial class DialogBase
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
namespace Pilz.UI.Dialogs;
|
using Pilz.UI.WinForms;
|
||||||
|
using Pilz.UI.WinForms.Dialogs;
|
||||||
|
|
||||||
|
namespace Pilz.UI.Dialogs;
|
||||||
|
|
||||||
public partial class DialogBase : Form
|
public partial class DialogBase : Form
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace Pilz.UI.Dialogs;
|
using Pilz.UI.Dialogs;
|
||||||
|
|
||||||
|
namespace Pilz.UI.WinForms.Dialogs;
|
||||||
|
|
||||||
public class DialogClosedEventArgs(DialogBase dialog) : EventArgs
|
public class DialogClosedEventArgs(DialogBase dialog) : EventArgs
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace Pilz.UI.Dialogs;
|
using Pilz.UI.Dialogs;
|
||||||
|
|
||||||
|
namespace Pilz.UI.WinForms.Dialogs;
|
||||||
|
|
||||||
public class DialogLoadingEventArgs(DialogBase dialog) : EventArgs
|
public class DialogLoadingEventArgs(DialogBase dialog) : EventArgs
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
using System.ComponentModel;
|
using Pilz.UI.Dialogs;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace Pilz.UI.Dialogs;
|
namespace Pilz.UI.WinForms.Dialogs;
|
||||||
|
|
||||||
public partial class FlyoutBase : UserControl
|
public partial class FlyoutBase : UserControl
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms;
|
||||||
|
|
||||||
public class DisplayHelp
|
public class DisplayHelp
|
||||||
{
|
{
|
||||||
@@ -211,7 +211,7 @@ public class DisplayHelp
|
|||||||
if (cornerDiameter == 0)
|
if (cornerDiameter == 0)
|
||||||
cornerDiameter = 1;
|
cornerDiameter = 1;
|
||||||
|
|
||||||
int diameter = cornerDiameter * 2;
|
var diameter = cornerDiameter * 2;
|
||||||
|
|
||||||
return corner switch
|
return corner switch
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.UI.Extensions;
|
namespace Pilz.UI.WinForms.Extensions;
|
||||||
|
|
||||||
public static class DialogResultExtensions
|
public static class DialogResultExtensions
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Pilz.UI.Dialogs;
|
using Pilz.UI.WinForms.Dialogs;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace Pilz.UI.Extensions;
|
namespace Pilz.UI.WinForms.Extensions;
|
||||||
|
|
||||||
public static class FlyoutBaseExtensions
|
public static class FlyoutBaseExtensions
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.UI.Extensions;
|
namespace Pilz.UI.WinForms.Extensions;
|
||||||
|
|
||||||
public static class ImageExtensions
|
public static class ImageExtensions
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms;
|
||||||
|
|
||||||
public static class HelpfulFunctions
|
public static class HelpfulFunctions
|
||||||
{
|
{
|
||||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms;
|
||||||
|
|
||||||
|
|
||||||
internal class HighlightPanel : Control
|
internal class HighlightPanel : Control
|
||||||
@@ -28,9 +28,9 @@ internal class HighlightPanel : Control
|
|||||||
var g = e.Graphics;
|
var g = e.Graphics;
|
||||||
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
||||||
|
|
||||||
foreach (HighlightRegion highlightRegion in _HighlightRegions)
|
foreach (var highlightRegion in _HighlightRegions)
|
||||||
{
|
{
|
||||||
Color[] colors = GetHighlightColors(highlightRegion.HighlightColor);
|
var colors = GetHighlightColors(highlightRegion.HighlightColor);
|
||||||
var r = highlightRegion.Bounds;
|
var r = highlightRegion.Bounds;
|
||||||
var back = highlightRegion.BackColor;
|
var back = highlightRegion.BackColor;
|
||||||
r.Inflate(1, 1);
|
r.Inflate(1, 1);
|
||||||
@@ -48,7 +48,7 @@ internal class HighlightPanel : Control
|
|||||||
|
|
||||||
private Color[] GetHighlightColors(eHighlightColor color)
|
private Color[] GetHighlightColors(eHighlightColor color)
|
||||||
{
|
{
|
||||||
Color[] colors = new Color[3];
|
var colors = new Color[3];
|
||||||
|
|
||||||
if (color == eHighlightColor.Blue)
|
if (color == eHighlightColor.Blue)
|
||||||
{
|
{
|
||||||
@@ -129,10 +129,10 @@ internal class HighlightPanel : Control
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool processFocusControl = true;
|
var processFocusControl = true;
|
||||||
Region region = null;
|
Region region = null;
|
||||||
|
|
||||||
foreach (KeyValuePair<Control, eHighlightColor> item in _Highlights)
|
foreach (var item in _Highlights)
|
||||||
{
|
{
|
||||||
if (item.Value == eHighlightColor.None || !GetIsVisible(item.Key))
|
if (item.Value == eHighlightColor.None || !GetIsVisible(item.Key))
|
||||||
continue;
|
continue;
|
||||||
@@ -221,13 +221,13 @@ internal class HighlightPanel : Control
|
|||||||
return false;
|
return false;
|
||||||
if (control.Parent is null || !control.IsHandleCreated)
|
if (control.Parent is null || !control.IsHandleCreated)
|
||||||
return control.Visible;
|
return control.Visible;
|
||||||
var rect = new Pilz.Win32.Native.RECT();
|
var rect = new Win32.Native.RECT();
|
||||||
Pilz.Win32.Native.User32.GetWindowRect(control.Handle, ref rect);
|
Win32.Native.User32.GetWindowRect(control.Handle, ref rect);
|
||||||
var pp = control.Parent.PointToClient(new Point(rect.Left + 3, rect.Top + 3));
|
var pp = control.Parent.PointToClient(new Point(rect.Left + 3, rect.Top + 3));
|
||||||
var handle = Pilz.Win32.Native.User32.ChildWindowFromPointEx(control.Parent.Handle, new Pilz.Win32.Native.POINT(pp.X, pp.Y), (uint)Pilz.Win32.Native.WindowFromPointFlags.CWP_SKIPINVISIBLE);
|
var handle = Win32.Native.User32.ChildWindowFromPointEx(control.Parent.Handle, new Win32.Native.POINT(pp.X, pp.Y), (uint)Win32.Native.WindowFromPointFlags.CWP_SKIPINVISIBLE);
|
||||||
if (handle == IntPtr.Zero)
|
if (handle == nint.Zero)
|
||||||
return control.Visible;
|
return control.Visible;
|
||||||
var c = Control.FromHandle(handle);
|
var c = FromHandle(handle);
|
||||||
|
|
||||||
if (c is not null && !ReferenceEquals(c, control) && !ReferenceEquals(c, this) && !ReferenceEquals(c, control.Parent))
|
if (c is not null && !ReferenceEquals(c, control) && !ReferenceEquals(c, this) && !ReferenceEquals(c, control.Parent))
|
||||||
return false;
|
return false;
|
||||||
@@ -259,9 +259,9 @@ internal class HighlightPanel : Control
|
|||||||
{
|
{
|
||||||
if (!c.IsHandleCreated)
|
if (!c.IsHandleCreated)
|
||||||
return Rectangle.Empty;
|
return Rectangle.Empty;
|
||||||
var rect = default(Pilz.Win32.Native.RECT);
|
var rect = default(Win32.Native.RECT);
|
||||||
Pilz.Win32.Native.User32.GetWindowRect(c.Handle, ref rect);
|
Win32.Native.User32.GetWindowRect(c.Handle, ref rect);
|
||||||
var p = this.PointToClient(rect.Location);
|
var p = PointToClient(rect.Location);
|
||||||
return new Rectangle(p, rect.Size);
|
return new Rectangle(p, rect.Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ using System.Drawing;
|
|||||||
// Imports System.Windows.Forms
|
// Imports System.Windows.Forms
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms;
|
||||||
|
|
||||||
|
|
||||||
public class Highlighter : Component
|
public class Highlighter : Component
|
||||||
@@ -172,14 +172,14 @@ public class Highlighter : Component
|
|||||||
|
|
||||||
private void ControlParentChanged(object sender, EventArgs e)
|
private void ControlParentChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Control c = (Control)sender;
|
var c = (Control)sender;
|
||||||
c.ParentChanged -= ControlParentChanged;
|
c.ParentChanged -= ControlParentChanged;
|
||||||
AddTabControlHandlers(c);
|
AddTabControlHandlers(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddTabControlHandlers(Control c)
|
private void AddTabControlHandlers(Control c)
|
||||||
{
|
{
|
||||||
TabControl tab2 = GetParentControl(c, typeof(TabControl)) as TabControl;
|
var tab2 = GetParentControl(c, typeof(TabControl)) as TabControl;
|
||||||
|
|
||||||
if (tab2 is not null)
|
if (tab2 is not null)
|
||||||
{
|
{
|
||||||
@@ -194,7 +194,7 @@ public class Highlighter : Component
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Panel parentPanel = GetParentControl(c, typeof(Panel)) as Panel;
|
var parentPanel = GetParentControl(c, typeof(Panel)) as Panel;
|
||||||
|
|
||||||
if (parentPanel is not null)
|
if (parentPanel is not null)
|
||||||
{
|
{
|
||||||
@@ -272,7 +272,7 @@ public class Highlighter : Component
|
|||||||
c.LocationChanged -= new EventHandler(ControlLocationChanged);
|
c.LocationChanged -= new EventHandler(ControlLocationChanged);
|
||||||
c.SizeChanged -= new EventHandler(ControlSizeChanged);
|
c.SizeChanged -= new EventHandler(ControlSizeChanged);
|
||||||
c.VisibleChanged -= new EventHandler(ControlVisibleChanged);
|
c.VisibleChanged -= new EventHandler(ControlVisibleChanged);
|
||||||
TabControl tab2 = GetParentControl(c, typeof(TabControl)) as TabControl;
|
var tab2 = GetParentControl(c, typeof(TabControl)) as TabControl;
|
||||||
|
|
||||||
if (tab2 is not null)
|
if (tab2 is not null)
|
||||||
{
|
{
|
||||||
@@ -293,7 +293,7 @@ public class Highlighter : Component
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Panel parentPanel = GetParentControl(c, typeof(Panel)) as Panel;
|
var parentPanel = GetParentControl(c, typeof(Panel)) as Panel;
|
||||||
|
|
||||||
if (parentPanel is not null)
|
if (parentPanel is not null)
|
||||||
{
|
{
|
||||||
@@ -419,7 +419,7 @@ public class Highlighter : Component
|
|||||||
{
|
{
|
||||||
if (_HighlightPanel.Parent is Form)
|
if (_HighlightPanel.Parent is Form)
|
||||||
{
|
{
|
||||||
Form form = _HighlightPanel.Parent as Form;
|
var form = _HighlightPanel.Parent as Form;
|
||||||
|
|
||||||
if (form.AutoSize)
|
if (form.AutoSize)
|
||||||
{
|
{
|
||||||
@@ -445,7 +445,7 @@ public class Highlighter : Component
|
|||||||
|
|
||||||
private void ContainerControlSizeChanged(object sender, EventArgs e)
|
private void ContainerControlSizeChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Form form = sender as Form;
|
var form = sender as Form;
|
||||||
|
|
||||||
if (form is not null)
|
if (form is not null)
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms;
|
||||||
|
|
||||||
public interface ILoadContent
|
public interface ILoadContent
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms;
|
||||||
|
|
||||||
public interface ILoadContentAsync
|
public interface ILoadContentAsync
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
|
|
||||||
public class ArrowLineCapProps : LineCapProps
|
public class ArrowLineCapProps : LineCapProps
|
||||||
{
|
{
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using Pilz.Drawing;
|
using Pilz.Drawing;
|
||||||
|
using Pilz.UI.WinForms.PaintingControl.EventArgs;
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -44,7 +45,7 @@ public class DefaultDrawMethodes
|
|||||||
RectangleF result;
|
RectangleF result;
|
||||||
Bitmap image;
|
Bitmap image;
|
||||||
SizeF zoomf;
|
SizeF zoomf;
|
||||||
bool hasNoParent = e.PaintingObject.Parent is null;
|
var hasNoParent = e.PaintingObject.Parent is null;
|
||||||
object syncObj;
|
object syncObj;
|
||||||
|
|
||||||
if (hasNoParent)
|
if (hasNoParent)
|
||||||
@@ -74,7 +75,7 @@ public class DefaultDrawMethodes
|
|||||||
|
|
||||||
if (image is null)
|
if (image is null)
|
||||||
{
|
{
|
||||||
bool needRescaleImageBecauseRot = false;
|
var needRescaleImageBecauseRot = false;
|
||||||
|
|
||||||
image = DrawToNewImage((Bitmap)objImg, result.Size);
|
image = DrawToNewImage((Bitmap)objImg, result.Size);
|
||||||
|
|
||||||
@@ -162,10 +163,10 @@ public class DefaultDrawMethodes
|
|||||||
var objrect = new RectangleF(obj.Location, obj.Size);
|
var objrect = new RectangleF(obj.Location, obj.Size);
|
||||||
var size = new SizeF(imageSize.Width * zoom.Width, imageSize.Height * zoom.Height);
|
var size = new SizeF(imageSize.Width * zoom.Width, imageSize.Height * zoom.Height);
|
||||||
var clientRectangle = objrect;
|
var clientRectangle = objrect;
|
||||||
float val = clientRectangle.Width / size.Width;
|
var val = clientRectangle.Width / size.Width;
|
||||||
|
|
||||||
clientRectangle = objrect;
|
clientRectangle = objrect;
|
||||||
float num = Math.Min(val, clientRectangle.Height / size.Height);
|
var num = Math.Min(val, clientRectangle.Height / size.Height);
|
||||||
|
|
||||||
result.Width = (int)Math.Round(Math.Truncate((double)(size.Width * num)));
|
result.Width = (int)Math.Round(Math.Truncate((double)(size.Width * num)));
|
||||||
result.Height = (int)Math.Round(Math.Truncate((double)(size.Height * num)));
|
result.Height = (int)Math.Round(Math.Truncate((double)(size.Height * num)));
|
||||||
@@ -195,7 +196,7 @@ public class DefaultDrawMethodes
|
|||||||
|
|
||||||
if (obj.EnableOutline)
|
if (obj.EnableOutline)
|
||||||
{
|
{
|
||||||
float lw = obj.OutlineThicknes;
|
var lw = obj.OutlineThicknes;
|
||||||
var p = new Pen(obj.OutlineColor, obj.OutlineThicknes) { DashStyle = obj.OutlineDashStyle, Alignment = PenAlignment.Inset };
|
var p = new Pen(obj.OutlineColor, obj.OutlineThicknes) { DashStyle = obj.OutlineDashStyle, Alignment = PenAlignment.Inset };
|
||||||
e.Graphics.DrawPolygon(p, new[] { p1, p2, p3 });
|
e.Graphics.DrawPolygon(p, new[] { p1, p2, p3 });
|
||||||
}
|
}
|
||||||
@@ -204,7 +205,7 @@ public class DefaultDrawMethodes
|
|||||||
public static void DrawRectangle(PaintingObjectPaintEventArgs e)
|
public static void DrawRectangle(PaintingObjectPaintEventArgs e)
|
||||||
{
|
{
|
||||||
var obj = e.PaintingObject;
|
var obj = e.PaintingObject;
|
||||||
float hol = obj.OutlineThicknes / 2f;
|
var hol = obj.OutlineThicknes / 2f;
|
||||||
|
|
||||||
if (obj.EnableFill)
|
if (obj.EnableFill)
|
||||||
{
|
{
|
||||||
@@ -243,10 +244,10 @@ public class DefaultDrawMethodes
|
|||||||
public static void DrawSelection(PaintingObjectPaintEventArgs e)
|
public static void DrawSelection(PaintingObjectPaintEventArgs e)
|
||||||
{
|
{
|
||||||
var obj = e.PaintingObject;
|
var obj = e.PaintingObject;
|
||||||
float lw = 2.5f;
|
var lw = 2.5f;
|
||||||
float hlw = lw / 2f;
|
var hlw = lw / 2f;
|
||||||
float hlwphol = hlw; // + hol
|
var hlwphol = hlw; // + hol
|
||||||
float hlwpholm2 = hlwphol * 2f;
|
var hlwpholm2 = hlwphol * 2f;
|
||||||
|
|
||||||
var p = new Pen(Color.CornflowerBlue, lw) { DashStyle = obj.SelectionDashStyle, Alignment = PenAlignment.Outset };
|
var p = new Pen(Color.CornflowerBlue, lw) { DashStyle = obj.SelectionDashStyle, Alignment = PenAlignment.Outset };
|
||||||
var rect = new Rectangle((int)Math.Round(e.X - hlwphol), (int)Math.Round(e.Y - hlwphol), (int)Math.Round(obj.Size.Width + hlwpholm2), (int)Math.Round(obj.Size.Height + hlwpholm2));
|
var rect = new Rectangle((int)Math.Round(e.X - hlwphol), (int)Math.Round(e.Y - hlwphol), (int)Math.Round(obj.Size.Width + hlwpholm2), (int)Math.Round(obj.Size.Height + hlwpholm2));
|
||||||
@@ -257,14 +258,14 @@ public class DefaultDrawMethodes
|
|||||||
{
|
{
|
||||||
var p = new Pen(pc.GridColor, 0.5f);
|
var p = new Pen(pc.GridColor, 0.5f);
|
||||||
|
|
||||||
int curX = (int)Math.Round(pc.GridChunkSize.Width * pc.ZoomFactor.Width - offset.X);
|
var curX = (int)Math.Round(pc.GridChunkSize.Width * pc.ZoomFactor.Width - offset.X);
|
||||||
while (curX < pc.Width)
|
while (curX < pc.Width)
|
||||||
{
|
{
|
||||||
e.Graphics.DrawLine(p, curX, -offset.Y, curX, pc.Height);
|
e.Graphics.DrawLine(p, curX, -offset.Y, curX, pc.Height);
|
||||||
curX = (int)Math.Round(curX + pc.GridChunkSize.Width * pc.ZoomFactor.Width);
|
curX = (int)Math.Round(curX + pc.GridChunkSize.Width * pc.ZoomFactor.Width);
|
||||||
}
|
}
|
||||||
|
|
||||||
int curY = (int)Math.Round(pc.GridChunkSize.Height * pc.ZoomFactor.Height - offset.Y);
|
var curY = (int)Math.Round(pc.GridChunkSize.Height * pc.ZoomFactor.Height - offset.Y);
|
||||||
while (curY < pc.Height)
|
while (curY < pc.Height)
|
||||||
{
|
{
|
||||||
e.Graphics.DrawLine(p, -offset.X, curY, pc.Width, curY);
|
e.Graphics.DrawLine(p, -offset.X, curY, pc.Width, curY);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
|
|
||||||
|
|
||||||
public class DefaultLineCapProps : LineCapProps
|
public class DefaultLineCapProps : LineCapProps
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms.PaintingControl.EventArgs;
|
||||||
|
|
||||||
public class PaintingObjectEventArgs(PaintingObject[] paintingObjects) : EventArgs
|
public class PaintingObjectEventArgs(PaintingObject[] paintingObjects) : EventArgs
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms.PaintingControl.EventArgs;
|
||||||
|
|
||||||
public class PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g, PointF offset) : EventArgs
|
public class PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g, PointF offset) : EventArgs
|
||||||
{
|
{
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
namespace Pilz.UI;
|
|
||||||
|
|
||||||
public interface IPaintingObjectContainer
|
public interface IPaintingObjectContainer
|
||||||
{
|
{
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
namespace Pilz.UI;
|
|
||||||
|
|
||||||
public class PaintingObjectImageProperties
|
public class PaintingObjectImageProperties
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
|
|
||||||
|
|
||||||
public class LineCapConfigurationArgs
|
public class LineCapConfigurationArgs
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
namespace Pilz.UI;
|
|
||||||
|
|
||||||
public abstract class LineCapProps
|
public abstract class LineCapProps
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
using Pilz.Drawing;
|
using Pilz.Drawing;
|
||||||
|
using Pilz.UI.WinForms.PaintingControl.EventArgs;
|
||||||
|
using Pilz.UI.WinForms.Utilities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -9,7 +11,7 @@ using System.Drawing.Drawing2D;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
|
|
||||||
|
|
||||||
public class PaintingControl : UserControl, IPaintingObjectContainer
|
public class PaintingControl : UserControl, IPaintingObjectContainer
|
||||||
@@ -79,7 +81,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
{
|
{
|
||||||
var objs = new List<PaintingObject>();
|
var objs = new List<PaintingObject>();
|
||||||
|
|
||||||
foreach (PaintingObject obj in PaintingObjects)
|
foreach (var obj in PaintingObjects)
|
||||||
{
|
{
|
||||||
if (obj.Selected)
|
if (obj.Selected)
|
||||||
objs.Add(obj);
|
objs.Add(obj);
|
||||||
@@ -173,7 +175,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
|
|
||||||
private void ResetAllBufferedImages()
|
private void ResetAllBufferedImages()
|
||||||
{
|
{
|
||||||
foreach (PaintingObject ob in PaintingObjects)
|
foreach (var ob in PaintingObjects)
|
||||||
ob.ResetImageBuffer();
|
ob.ResetImageBuffer();
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
@@ -195,7 +197,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
|
|
||||||
protected void CheckMouseClick(object sender, MouseEventArgs e)
|
protected void CheckMouseClick(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
foreach (PaintingObject obj in GetObjects(new Point((int)Math.Round(e.X + Offset.X), (int)Math.Round(e.Y + Offset.Y))))
|
foreach (var obj in GetObjects(new Point((int)Math.Round(e.X + Offset.X), (int)Math.Round(e.Y + Offset.Y))))
|
||||||
{
|
{
|
||||||
if (!obj.MouseTransparency)
|
if (!obj.MouseTransparency)
|
||||||
obj.RaiseMouseClick(GetMouseEventArgs(e, obj));
|
obj.RaiseMouseClick(GetMouseEventArgs(e, obj));
|
||||||
@@ -211,10 +213,10 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
|
|
||||||
if (curObjMouseDown is null || !curObjMouseDown.Selected || pressedControl)
|
if (curObjMouseDown is null || !curObjMouseDown.Selected || pressedControl)
|
||||||
{
|
{
|
||||||
bool hasMovedObjects = false;
|
var hasMovedObjects = false;
|
||||||
if (IsMovingObjects)
|
if (IsMovingObjects)
|
||||||
{
|
{
|
||||||
foreach (PaintingObject obj in GetSelectedObjects())
|
foreach (var obj in GetSelectedObjects())
|
||||||
{
|
{
|
||||||
if (HelpfulDrawingFunctions.IsPointInRectangle(lastMousePos, obj.Rectangle))
|
if (HelpfulDrawingFunctions.IsPointInRectangle(lastMousePos, obj.Rectangle))
|
||||||
{
|
{
|
||||||
@@ -230,7 +232,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
|
|
||||||
if (AutoRemoveSelection && !pressedControl)
|
if (AutoRemoveSelection && !pressedControl)
|
||||||
{
|
{
|
||||||
foreach (PaintingObject obj in PaintingObjects)
|
foreach (var obj in PaintingObjects)
|
||||||
{
|
{
|
||||||
if (obj.Selected)
|
if (obj.Selected)
|
||||||
{
|
{
|
||||||
@@ -306,7 +308,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
if (IsMovingObjects)
|
if (IsMovingObjects)
|
||||||
{
|
{
|
||||||
IsMovingObjects = false;
|
IsMovingObjects = false;
|
||||||
foreach (PaintingObject obj in GetSelectedObjects())
|
foreach (var obj in GetSelectedObjects())
|
||||||
obj.RaiseMoved(new EventArgs());
|
obj.RaiseMoved(new EventArgs());
|
||||||
AutoArrangeToGrid();
|
AutoArrangeToGrid();
|
||||||
}
|
}
|
||||||
@@ -337,7 +339,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
if (IsMovingObjects)
|
if (IsMovingObjects)
|
||||||
UpdateObjectPositions(e);
|
UpdateObjectPositions(e);
|
||||||
|
|
||||||
foreach (PaintingObject obj in GetObjects(new Point((int)Math.Round(e.X + Offset.X), (int)Math.Round(e.Y + Offset.Y))))
|
foreach (var obj in GetObjects(new Point((int)Math.Round(e.X + Offset.X), (int)Math.Round(e.Y + Offset.Y))))
|
||||||
{
|
{
|
||||||
if (!obj.MouseTransparency)
|
if (!obj.MouseTransparency)
|
||||||
obj.RaiseMouseMove(GetMouseEventArgs(e, obj));
|
obj.RaiseMouseMove(GetMouseEventArgs(e, obj));
|
||||||
@@ -381,7 +383,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
{
|
{
|
||||||
var objs = new List<PaintingObject>();
|
var objs = new List<PaintingObject>();
|
||||||
|
|
||||||
foreach (PaintingObject obj in PaintingObjects)
|
foreach (var obj in PaintingObjects)
|
||||||
{
|
{
|
||||||
if (obj.Selected)
|
if (obj.Selected)
|
||||||
objs.Add(obj);
|
objs.Add(obj);
|
||||||
@@ -416,7 +418,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
|
|
||||||
SuspendDrawing();
|
SuspendDrawing();
|
||||||
|
|
||||||
foreach (PaintingObject obj in objs)
|
foreach (var obj in objs)
|
||||||
{
|
{
|
||||||
var sp = savedPos[obj];
|
var sp = savedPos[obj];
|
||||||
|
|
||||||
@@ -438,7 +440,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
|
|
||||||
private bool UpdateObjectPosition(MouseEventArgs e, PaintingObject obj, PointF sp)
|
private bool UpdateObjectPosition(MouseEventArgs e, PaintingObject obj, PointF sp)
|
||||||
{
|
{
|
||||||
bool moved = false;
|
var moved = false;
|
||||||
var cancel = new CancelEventArgs(false);
|
var cancel = new CancelEventArgs(false);
|
||||||
obj.RaiseMovingBeforePositionUpdated(cancel);
|
obj.RaiseMovingBeforePositionUpdated(cancel);
|
||||||
|
|
||||||
@@ -454,7 +456,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
|
|
||||||
private bool IsResizingObjs(IList<PaintingObject> objs)
|
private bool IsResizingObjs(IList<PaintingObject> objs)
|
||||||
{
|
{
|
||||||
foreach (PaintingObject obj in objs)
|
foreach (var obj in objs)
|
||||||
{
|
{
|
||||||
if (obj.IsResizing)
|
if (obj.IsResizing)
|
||||||
return true;
|
return true;
|
||||||
@@ -471,7 +473,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
{
|
{
|
||||||
PaintingObject val = null;
|
PaintingObject val = null;
|
||||||
|
|
||||||
for (int i = PaintingObjects.Count - 1; i >= 0; i -= 1)
|
for (var i = PaintingObjects.Count - 1; i >= 0; i -= 1)
|
||||||
{
|
{
|
||||||
var obj = PaintingObjects[i];
|
var obj = PaintingObjects[i];
|
||||||
|
|
||||||
@@ -496,7 +498,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
{
|
{
|
||||||
var objs = new List<PaintingObject>();
|
var objs = new List<PaintingObject>();
|
||||||
|
|
||||||
foreach (PaintingObject obj in PaintingObjects)
|
foreach (var obj in PaintingObjects)
|
||||||
{
|
{
|
||||||
if (HelpfulDrawingFunctions.IsPointInRectangle(p, obj.RectangleExtended))
|
if (HelpfulDrawingFunctions.IsPointInRectangle(p, obj.RectangleExtended))
|
||||||
objs.Add(obj);
|
objs.Add(obj);
|
||||||
@@ -514,7 +516,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
{
|
{
|
||||||
var objs = new List<PaintingObject>();
|
var objs = new List<PaintingObject>();
|
||||||
|
|
||||||
foreach (PaintingObject obj in PaintingObjects)
|
foreach (var obj in PaintingObjects)
|
||||||
{
|
{
|
||||||
var objRect = obj.Rectangle;
|
var objRect = obj.Rectangle;
|
||||||
if (HelpfulDrawingFunctions.IsPointInRectangle(objRect.Location, rect) || HelpfulDrawingFunctions.IsPointInRectangle(objRect.Location + objRect.Size, rect) || HelpfulDrawingFunctions.IsPointInRectangle(new PointF(objRect.Left, objRect.Bottom), rect) || HelpfulDrawingFunctions.IsPointInRectangle(new PointF(objRect.Right, objRect.Top), rect))
|
if (HelpfulDrawingFunctions.IsPointInRectangle(objRect.Location, rect) || HelpfulDrawingFunctions.IsPointInRectangle(objRect.Location + objRect.Size, rect) || HelpfulDrawingFunctions.IsPointInRectangle(new PointF(objRect.Left, objRect.Bottom), rect) || HelpfulDrawingFunctions.IsPointInRectangle(new PointF(objRect.Right, objRect.Top), rect))
|
||||||
@@ -586,7 +588,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
|
|
||||||
var baserect = new RectangleF(Offset, Size);
|
var baserect = new RectangleF(Offset, Size);
|
||||||
|
|
||||||
foreach (PaintingObject obj in PaintingObjects)
|
foreach (var obj in PaintingObjects)
|
||||||
{
|
{
|
||||||
if (obj.Visible && HelpfulDrawingFunctions.OverlapsTwoRectangles(obj.Rectangle, baserect))
|
if (obj.Visible && HelpfulDrawingFunctions.OverlapsTwoRectangles(obj.Rectangle, baserect))
|
||||||
obj.Draw(e, Offset);
|
obj.Draw(e, Offset);
|
||||||
@@ -610,7 +612,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
|
|
||||||
public void PaintFullView(Graphics g)
|
public void PaintFullView(Graphics g)
|
||||||
{
|
{
|
||||||
foreach (PaintingObject obj in PaintingObjects)
|
foreach (var obj in PaintingObjects)
|
||||||
{
|
{
|
||||||
if (obj.Visible)
|
if (obj.Visible)
|
||||||
obj.Draw(g, PointF.Empty);
|
obj.Draw(g, PointF.Empty);
|
||||||
@@ -630,7 +632,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
private void SelectControlsInArea()
|
private void SelectControlsInArea()
|
||||||
{
|
{
|
||||||
var rect = HelpfulDrawingFunctions.GetRectangle(startMousePos, lastMousePos);
|
var rect = HelpfulDrawingFunctions.GetRectangle(startMousePos, lastMousePos);
|
||||||
foreach (PaintingObject obj in PaintingObjects)
|
foreach (var obj in PaintingObjects)
|
||||||
obj.Selected = startMousePos.X >= lastMousePos.X ? HelpfulDrawingFunctions.OverlapsTwoRectangles(obj.Rectangle, rect) : HelpfulDrawingFunctions.RectangleContainsRectangle(rect, obj.Rectangle);
|
obj.Selected = startMousePos.X >= lastMousePos.X ? HelpfulDrawingFunctions.OverlapsTwoRectangles(obj.Rectangle, rect) : HelpfulDrawingFunctions.RectangleContainsRectangle(rect, obj.Rectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,11 +642,11 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
{
|
{
|
||||||
var zoomedGridChunkSize = new SizeF(GridChunkSize.Width * ZoomFactor.Width, GridChunkSize.Height * ZoomFactor.Height);
|
var zoomedGridChunkSize = new SizeF(GridChunkSize.Width * ZoomFactor.Width, GridChunkSize.Height * ZoomFactor.Height);
|
||||||
|
|
||||||
int modTop = (int)Math.Round(obj.Y % zoomedGridChunkSize.Height);
|
var modTop = (int)Math.Round(obj.Y % zoomedGridChunkSize.Height);
|
||||||
int modLeft = (int)Math.Round(obj.X % zoomedGridChunkSize.Width);
|
var modLeft = (int)Math.Round(obj.X % zoomedGridChunkSize.Width);
|
||||||
|
|
||||||
int halfHeight = (int)Math.Round(zoomedGridChunkSize.Height / 2f);
|
var halfHeight = (int)Math.Round(zoomedGridChunkSize.Height / 2f);
|
||||||
int halfWidth = (int)Math.Round(zoomedGridChunkSize.Width / 2f);
|
var halfWidth = (int)Math.Round(zoomedGridChunkSize.Width / 2f);
|
||||||
|
|
||||||
void zoomLocation(PaintingObject obj2)
|
void zoomLocation(PaintingObject obj2)
|
||||||
{
|
{
|
||||||
@@ -665,25 +667,25 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
|
|
||||||
zoomLocation(obj);
|
zoomLocation(obj);
|
||||||
|
|
||||||
foreach (PaintingObject pinned in obj.PinnedObjects)
|
foreach (var pinned in obj.PinnedObjects)
|
||||||
zoomLocation(pinned);
|
zoomLocation(pinned);
|
||||||
|
|
||||||
int modH = (int)Math.Round(obj.Height % zoomedGridChunkSize.Height);
|
var modH = (int)Math.Round(obj.Height % zoomedGridChunkSize.Height);
|
||||||
int modW = (int)Math.Round(obj.Width % zoomedGridChunkSize.Width);
|
var modW = (int)Math.Round(obj.Width % zoomedGridChunkSize.Width);
|
||||||
|
|
||||||
|
|
||||||
void zoomSize(PaintingObject obj2) { if (obj2.EnableResize && !obj2.HardcodedSize) { if (modH > halfHeight) obj2.Height += zoomedGridChunkSize.Height - modH; else { obj2.Height -= modH; } if (modW > halfWidth) obj2.Width += zoomedGridChunkSize.Width - modW; else { obj2.Width -= modW; } } };
|
void zoomSize(PaintingObject obj2) { if (obj2.EnableResize && !obj2.HardcodedSize) { if (modH > halfHeight) obj2.Height += zoomedGridChunkSize.Height - modH; else { obj2.Height -= modH; } if (modW > halfWidth) obj2.Width += zoomedGridChunkSize.Width - modW; else { obj2.Width -= modW; } } };
|
||||||
|
|
||||||
zoomSize(obj);
|
zoomSize(obj);
|
||||||
|
|
||||||
foreach (PaintingObject pinned in obj.PinnedObjects)
|
foreach (var pinned in obj.PinnedObjects)
|
||||||
zoomSize(pinned);
|
zoomSize(pinned);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsPinnedObject(PaintingObject o)
|
public bool IsPinnedObject(PaintingObject o)
|
||||||
{
|
{
|
||||||
foreach (PaintingObject obj in PaintingObjects)
|
foreach (var obj in PaintingObjects)
|
||||||
{
|
{
|
||||||
if (obj.PinnedObjects.Contains(o))
|
if (obj.PinnedObjects.Contains(o))
|
||||||
return true;
|
return true;
|
||||||
@@ -695,7 +697,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
{
|
{
|
||||||
if (GridEnabled)
|
if (GridEnabled)
|
||||||
{
|
{
|
||||||
foreach (PaintingObject obj in GetSelectedObjects())
|
foreach (var obj in GetSelectedObjects())
|
||||||
{
|
{
|
||||||
if (obj.AutoAlignToGrid)
|
if (obj.AutoAlignToGrid)
|
||||||
ArrangeToGrid(obj, false);
|
ArrangeToGrid(obj, false);
|
||||||
@@ -712,15 +714,15 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
|
|
||||||
public static SizeF GetFullSize(IEnumerable<PaintingObject> objects)
|
public static SizeF GetFullSize(IEnumerable<PaintingObject> objects)
|
||||||
{
|
{
|
||||||
float curX = 0f;
|
var curX = 0f;
|
||||||
float curY = 0f;
|
var curY = 0f;
|
||||||
|
|
||||||
foreach (PaintingObject po in objects)
|
foreach (var po in objects)
|
||||||
{
|
{
|
||||||
float myX = po.X + po.Width;
|
var myX = po.X + po.Width;
|
||||||
if (curX < myX)
|
if (curX < myX)
|
||||||
curX = myX;
|
curX = myX;
|
||||||
float myY = po.Y + po.Height;
|
var myY = po.Y + po.Height;
|
||||||
if (curY < myY)
|
if (curY < myY)
|
||||||
curY = myY;
|
curY = myY;
|
||||||
}
|
}
|
||||||
@@ -746,7 +748,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
{
|
{
|
||||||
if (pressedAlt)
|
if (pressedAlt)
|
||||||
{
|
{
|
||||||
float val = (float)(e.Delta / 120d / 10d);
|
var val = (float)(e.Delta / 120d / 10d);
|
||||||
ZoomFactor = new SizeF((float)Math.Max((double)(ZoomFactor.Width + val), 0.25d), (float)Math.Max((double)(ZoomFactor.Height + val), 0.25d));
|
ZoomFactor = new SizeF((float)Math.Max((double)(ZoomFactor.Width + val), 0.25d), (float)Math.Max((double)(ZoomFactor.Height + val), 0.25d));
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
@@ -761,7 +763,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
if (_stopDrawing < 0)
|
if (_stopDrawing < 0)
|
||||||
// bufferedImg = New Bitmap(Width, Height)
|
// bufferedImg = New Bitmap(Width, Height)
|
||||||
// DrawToBitmap(bufferedImg, New Rectangle(0, 0, bufferedImg.Width, bufferedImg.Height))
|
// DrawToBitmap(bufferedImg, New Rectangle(0, 0, bufferedImg.Width, bufferedImg.Height))
|
||||||
Utils.DrawingControl.SuspendDrawing(this);
|
DrawingControl.SuspendDrawing(this);
|
||||||
_stopDrawing += 1;
|
_stopDrawing += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -779,7 +781,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
|
|||||||
// bufferedImg.Dispose()
|
// bufferedImg.Dispose()
|
||||||
// bufferedImg = Nothing
|
// bufferedImg = Nothing
|
||||||
// If executeRefresh Then Refresh()
|
// If executeRefresh Then Refresh()
|
||||||
Utils.DrawingControl.ResumeDrawing(this, executeRefresh);
|
DrawingControl.ResumeDrawing(this, executeRefresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
using System.Drawing;
|
using Pilz.UI.WinForms.PaintingControl.EventArgs;
|
||||||
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
|
|
||||||
|
|
||||||
public delegate void DelegateDrawPaintingObjectMethode(PaintingObjectPaintEventArgs e);
|
public delegate void DelegateDrawPaintingObjectMethode(PaintingObjectPaintEventArgs e);
|
||||||
@@ -8,7 +8,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
|
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
@@ -157,7 +157,7 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
|
|||||||
{
|
{
|
||||||
var tt = PaintingObjectType.Custom;
|
var tt = PaintingObjectType.Custom;
|
||||||
|
|
||||||
foreach (DelegateDrawPaintingObjectMethode d in DrawMethodes)
|
foreach (var d in DrawMethodes)
|
||||||
{
|
{
|
||||||
if (ReferenceEquals(d.Method.DeclaringType, typeof(DefaultDrawMethodes)))
|
if (ReferenceEquals(d.Method.DeclaringType, typeof(DefaultDrawMethodes)))
|
||||||
{
|
{
|
||||||
@@ -335,7 +335,7 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
bool re = !ReferenceEquals(value, _Parent);
|
var re = !ReferenceEquals(value, _Parent);
|
||||||
_Parent = value;
|
_Parent = value;
|
||||||
if (re)
|
if (re)
|
||||||
ParentChanged?.Invoke(this, new EventArgs());
|
ParentChanged?.Invoke(this, new EventArgs());
|
||||||
@@ -663,7 +663,7 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
|
|||||||
{
|
{
|
||||||
var poevargs = new PaintingObjectPaintEventArgs(this, g, offset);
|
var poevargs = new PaintingObjectPaintEventArgs(this, g, offset);
|
||||||
|
|
||||||
foreach (DelegateDrawPaintingObjectMethode dm in DrawMethodes)
|
foreach (var dm in DrawMethodes)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -689,12 +689,12 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
|
|||||||
{
|
{
|
||||||
var obj = new PaintingObject();
|
var obj = new PaintingObject();
|
||||||
var metype = GetType();
|
var metype = GetType();
|
||||||
string[] blackField = new[] { nameof(PinnedObjects), nameof(resizeEngine), nameof(_Parent), nameof(BufferedImage), nameof(ImageProperties) };
|
var blackField = new[] { nameof(PinnedObjects), nameof(resizeEngine), nameof(_Parent), nameof(BufferedImage), nameof(ImageProperties) };
|
||||||
|
|
||||||
void copyFields(object source, object dest, string[] blackFields, Type t)
|
void copyFields(object source, object dest, string[] blackFields, Type t)
|
||||||
{
|
{
|
||||||
var fields = new List<FieldInfo>(t.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.Instance));
|
var fields = new List<FieldInfo>(t.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.Instance));
|
||||||
foreach (FieldInfo @field in fields)
|
foreach (var @field in fields)
|
||||||
{
|
{
|
||||||
if (!blackFields.Contains(@field.Name))
|
if (!blackFields.Contains(@field.Name))
|
||||||
@field.SetValue(dest, @field.GetValue(source));
|
@field.SetValue(dest, @field.GetValue(source));
|
||||||
@@ -761,10 +761,10 @@ public class PaintingObjectList : List<PaintingObject>
|
|||||||
|
|
||||||
public void AddRange(PaintingObject[] items)
|
public void AddRange(PaintingObject[] items)
|
||||||
{
|
{
|
||||||
foreach (PaintingObject item in items)
|
foreach (var item in items)
|
||||||
item.Parent = MyParent;
|
item.Parent = MyParent;
|
||||||
base.AddRange(items);
|
base.AddRange(items);
|
||||||
foreach (PaintingObject item in items)
|
foreach (var item in items)
|
||||||
item.AutoArrangeToGrid();
|
item.AutoArrangeToGrid();
|
||||||
if (EnableRaisingEvents)
|
if (EnableRaisingEvents)
|
||||||
MyParent?.RaisePaintingObjectAdded(new PaintingObjectEventArgs(items));
|
MyParent?.RaisePaintingObjectAdded(new PaintingObjectEventArgs(items));
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
namespace Pilz.UI;
|
|
||||||
|
|
||||||
public class PaintingObjectJsonSerializer
|
public class PaintingObjectJsonSerializer
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
|
|
||||||
|
|
||||||
public class PaintingObjectLayering
|
public class PaintingObjectLayering
|
||||||
@@ -46,8 +46,8 @@ public class PaintingObjectLayering
|
|||||||
/// <param name="count">The number how many objects it should be moved.</param>
|
/// <param name="count">The number how many objects it should be moved.</param>
|
||||||
public void MoveObject(int count)
|
public void MoveObject(int count)
|
||||||
{
|
{
|
||||||
int oldIndex = ObjectList.IndexOf(PaintingObject);
|
var oldIndex = ObjectList.IndexOf(PaintingObject);
|
||||||
int newIndex = oldIndex + count;
|
var newIndex = oldIndex + count;
|
||||||
MoveObjectTo(newIndex);
|
MoveObjectTo(newIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Pilz.UI;
|
namespace Pilz.UI.WinForms.PaintingControl;
|
||||||
|
|
||||||
public class PaintingObjectListLayering
|
public class PaintingObjectListLayering
|
||||||
{
|
{
|
||||||
@@ -59,7 +59,7 @@ public class PaintingObjectListLayering
|
|||||||
{
|
{
|
||||||
var func = kvp.Value;
|
var func = kvp.Value;
|
||||||
|
|
||||||
foreach (PaintingObject obj in listOld)
|
foreach (var obj in listOld)
|
||||||
{
|
{
|
||||||
if (func(obj))
|
if (func(obj))
|
||||||
{
|
{
|
||||||
@@ -72,7 +72,7 @@ public class PaintingObjectListLayering
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove remembered objects
|
// Remove remembered objects
|
||||||
foreach (PaintingObject obj in toRemove)
|
foreach (var obj in toRemove)
|
||||||
listOld.Remove(obj);
|
listOld.Remove(obj);
|
||||||
toRemove.Clear();
|
toRemove.Clear();
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user