Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement (compatibility with Msft CLI/C++) + Code Cleansing and Refactoring #338

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
91 changes: 91 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@


This repo is a fork obtained from https://github.com/leocb/MaterialSkin.git
- Revision: e14384f49f142cde712951824f6c461b57a0032b
- Author: orapps44 <[email protected]>
- Date: 06/02/2022 21:50:11



build 2.3.1.5 [2022-02-20]
-------------------------
- Enhancements:
- MaterialComboBox - better support for font customization (Item text and hint text)
- user can change Item text font using properties pane, changes are rendered in design-mode as well as during runtime.
- previously the item text font was hardcoded to "Subtitle1"
- base property "Font" changed to "hidden". Avoids misleading the user since its value is not respected
- new property "ItemMaterialFont" - user can choose from a list of "material fonts".
- new property "ItemFont" - read-only property that shows in the "properties pane" the characteristics of the corresponding Font type defined by property "ItemMaterialFont", helping the user to understand the true meaning of the selected Material font



build 2.3.1.4 [2022-02-20]
-------------------------
- Enhancements:
- Added support for "UserControl" Containers
- Previous versions only supported placing controls like MaterialDialog if the Parent Container was of a type that inherits from Winform (Form class), like MaterialForm or plain Winform. Adding MaterialDialog control to a custom UserControl would generate a runtime exception because MaterialDialog._formOverlay was expecting an "Onwer" of type "Form" which is not the case when using parent containers like UserControls.
- Changed class "MaterialDialog" to expect a Parent-container of type "ContainerControl", Form and UserControl classes inherit from ContainControl class.
- Affected files:
- MaterialDialog.cs
- MaterialSkinManager.cs

- Improved design-mode experience of MaterialDrawer when combined with MaterialTabControl object. Now, during design-time, it's possible to view the drawer and the design impact on it when drawer's and tabcontrol's properties are changed by the user.

- Improved performance of MaterialDrawer during initialization
- Reduced the number of "Redraws" (Pain events) while the MaterialDrawer control is being initialized by its container.
- Previously, during MaterialDrawer's initialization, every property set done by the container that would impact drawer's UI would generate a redraw event (paint event).
- Now, MaterialDrawer control checks if its container has finish the initialization and if not ignores the redraw. When container invokes control's "InitLayout" method, meaning "end of control's initialization phase, future propertities changes will invoke a redraw action.



build 2.3.1.3 [2022-02-20]
-------------------------
- Code Cleansing:
- moved all p/invoke declarations to a new static class "NativeWin" (NativeWin.cs)
- there were a significant number of duplicated declarations on several controls
- affected files:
- NativeTextRenderer.cs
- MouseWheelRedirector.cs
- MaterialDialog.cs
- MaterialForm.cs
- MaterialMultiLineTextBox.cs
- MaterialMultiLineTextBox2.cs
- MaterialScrollBar.cs
- MaterialSnackBar.cs
- MaterialTextBox.cs
- MaterialSkinManager.cs

- moved several const declarations related to native Window Message IDs to new static class "NativeWin"
- affected files:
- MouseWheelRedirector.cs

- moved all possible category's labels to a new static class "CategoryLabels" (Globals.cs) and replaced the Category Labels by the corresponding const string
- affected files:
- MaterialButton.cs
- MaterialCheckBox.cs
- MaterialComboBox.cs
- MaterialDrawer.cs
- MaterialExpansionPanel.cs
- MaterialFloatingActionButton.cs
- MaterialForm.cs
- MaterialLabel.cs
- MaterialListBox.cs
- MaterialListView.cs
- MaterialMaskedTextBox.cs
- MaterialMultiLineTextBox.cs
- MaterialMultiLineTextBox2.cs
- MaterialRadioButton.cs
- MaterialScrollBar.cs
- MaterialSlider.cs
- MaterialSnackBar.cs
- MaterialSwitch.cs
- MaterialTabSelector.cs
- MaterialTextBox.cs
- MaterialTextBox2.cs

- moved several const declarations and enum declarations that were shared among files to a new file Globals.cs
- MaterialDrawer.cs

- Enhancement - compatibility with Msft CLI/C++:
- enum value MouseState.OUT (IMaterialControl.cs) renamed to MouseState.OUT_
- "OUT" keyword is a reserved word on CLI/C++.
2 changes: 1 addition & 1 deletion MaterialSkin.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.136
Expand All @@ -9,6 +8,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaterialSkin", "MaterialSki
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{17028688-3699-4BC7-849F-A6B0F6E766BC}"
ProjectSection(SolutionItems) = preProject
CHANGELOG.md = CHANGELOG.md
README.md = README.md
EndProjectSection
EndProject
Expand Down
36 changes: 18 additions & 18 deletions MaterialSkin/Controls/MaterialButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class MaterialButton : Button, IMaterialControl

// icons
private TextureBrush iconsBrushes;

/// <summary>
/// Gets or sets the Depth
/// </summary>
Expand Down Expand Up @@ -59,14 +59,14 @@ public enum MaterialButtonDensity
[Browsable(false)]
public Color NoAccentTextColor { get; set; }

[Category("Material Skin")]
[Category(CategoryLabels.MaterialSkin)]
public bool UseAccentColor
{
get { return useAccentColor; }
set { useAccentColor = value; Invalidate(); }
}

[Category("Material Skin")]
[Category(CategoryLabels.MaterialSkin)]
/// <summary>
/// Gets or sets a value indicating whether HighEmphasis
/// </summary>
Expand All @@ -77,32 +77,32 @@ public bool HighEmphasis
}

[DefaultValue(true)]
[Category("Material Skin")]
[Category(CategoryLabels.MaterialSkin)]
[Description("Draw Shadows around control")]
public bool DrawShadows
{
get { return drawShadows; }
set { drawShadows = value; Invalidate(); }
}

[Category("Material Skin")]
[Category(CategoryLabels.MaterialSkin)]
public MaterialButtonType Type
{
get { return type; }
set { type = value; preProcessIcons(); Invalidate(); }
}

[Category("Material Skin")]
[Category(CategoryLabels.MaterialSkin)]
/// <summary>
/// Gets or sets a value indicating button density
/// </summary>
public MaterialButtonDensity Density
{
get { return _density; }
set
{
set
{
_density = value;
if (_density== MaterialButtonDensity.Dense)
if (_density == MaterialButtonDensity.Dense)
Size = new Size(Size.Width, HEIGHTDENSE);
else
Size = new Size(Size.Width, HEIGHTDEFAULT);
Expand All @@ -119,7 +119,7 @@ public enum CharacterCasingEnum
}

public CharacterCasingEnum _cc;
[Category("Behavior"), DefaultValue(CharacterCasingEnum.Upper), Description("Change capitalization of Text property")]
[Category(CategoryLabels.Behavior), DefaultValue(CharacterCasingEnum.Upper), Description("Change capitalization of Text property")]
public CharacterCasingEnum CharacterCasing
{
get => _cc;
Expand Down Expand Up @@ -200,7 +200,7 @@ private void RemoveShadowPaintEvent(Control control, PaintEventHandler shadowPai
private MaterialButtonType type;
private MaterialButtonDensity _density;

[Category("Material Skin")]
[Category(CategoryLabels.MaterialSkin)]
/// <summary>
/// Gets or sets the Icon
/// </summary>
Expand Down Expand Up @@ -325,7 +325,7 @@ private void preProcessIcons()

int newWidth, newHeight;
//Resize icon if greater than ICON_SIZE
if (Icon.Width> ICON_SIZE || Icon.Height > ICON_SIZE)
if (Icon.Width > ICON_SIZE || Icon.Height > ICON_SIZE)
{
//calculate aspect ratio
float aspect = Icon.Width / (float)Icon.Height;
Expand Down Expand Up @@ -399,7 +399,7 @@ private void preProcessIcons()
textureBrushGray.WrapMode = System.Drawing.Drawing2D.WrapMode.Clamp;

// Translate the brushes to the correct positions
var iconRect = new Rectangle(8, (Height/2 - ICON_SIZE / 2), ICON_SIZE, ICON_SIZE);
var iconRect = new Rectangle(8, (Height / 2 - ICON_SIZE / 2), ICON_SIZE, ICON_SIZE);

textureBrushGray.TranslateTransform(iconRect.X + iconRect.Width / 2 - IconResized.Width / 2,
iconRect.Y + iconRect.Height / 2 - IconResized.Height / 2);
Expand Down Expand Up @@ -534,7 +534,7 @@ protected override void OnPaint(PaintEventArgs pevent)

Color textColor = Enabled ? (HighEmphasis ? (Type == MaterialButtonType.Text || Type == MaterialButtonType.Outlined) ?
UseAccentColor ? SkinManager.ColorScheme.AccentColor : // Outline or Text and accent and emphasis
NoAccentTextColor == Color.Empty ?
NoAccentTextColor == Color.Empty ?
SkinManager.ColorScheme.PrimaryColor : // Outline or Text and emphasis
NoAccentTextColor : // User defined Outline or Text and emphasis
SkinManager.ColorScheme.TextColor : // Contained and Emphasis
Expand Down Expand Up @@ -607,7 +607,7 @@ public override Size GetPreferredSize(Size proposedSize)
s.Width += extra;
s.Height = HEIGHTDEFAULT;
}
if (Icon != null && Text.Length==0 && s.Width < MINIMUMWIDTHICONONLY) s.Width = MINIMUMWIDTHICONONLY;
if (Icon != null && Text.Length == 0 && s.Width < MINIMUMWIDTHICONONLY) s.Width = MINIMUMWIDTHICONONLY;
else if (s.Width < MINIMUMWIDTH) s.Width = MINIMUMWIDTH;

return s;
Expand All @@ -627,7 +627,7 @@ protected override void OnCreateControl()
return;
}

MouseState = MouseState.OUT;
MouseState = MouseState.OUT_;
MouseEnter += (sender, args) =>
{
MouseState = MouseState.HOVER;
Expand All @@ -636,7 +636,7 @@ protected override void OnCreateControl()
};
MouseLeave += (sender, args) =>
{
MouseState = MouseState.OUT;
MouseState = MouseState.OUT_;
_hoverAnimationManager.StartNewAnimation(AnimationDirection.Out);
Invalidate();
};
Expand Down Expand Up @@ -664,7 +664,7 @@ protected override void OnCreateControl()
};
LostFocus += (sender, args) =>
{
MouseState = MouseState.OUT;
MouseState = MouseState.OUT_;
_focusAnimationManager.StartNewAnimation(AnimationDirection.Out);
Invalidate();
};
Expand Down
6 changes: 3 additions & 3 deletions MaterialSkin/Controls/MaterialCheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MaterialCheckbox : CheckBox, IMaterialControl

private bool _ripple;

[Category("Appearance")]
[Category(CategoryLabels.Appearance)]
public bool Ripple
{
get { return _ripple; }
Expand Down Expand Up @@ -224,7 +224,7 @@ protected override void OnCreateControl()

if (DesignMode) return;

MouseState = MouseState.OUT;
MouseState = MouseState.OUT_;

GotFocus += (sender, AddingNewEventArgs) =>
{
Expand Down Expand Up @@ -258,7 +258,7 @@ protected override void OnCreateControl()
MouseLeave += (sender, args) =>
{
MouseLocation = new Point(-1, -1);
MouseState = MouseState.OUT;
MouseState = MouseState.OUT_;
//if (Ripple && hovered)
//{
// _hoverAM.StartNewAnimation(AnimationDirection.Out, new object[] { Checked });
Expand Down
Loading