Skip to content

Commit

Permalink
Major Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Nov 29, 2024
1 parent 1dd1aa4 commit 951f4c4
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 9 deletions.
6 changes: 3 additions & 3 deletions demo/ReaLTaiizor.UI/ReaLTaiizor.UI/ReaLTaiizor.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<!--<PackageReference Include="ReaLTaiizor" Version="3.8.0.8" />-->
<Reference Include="ReaLTaiizor">
<PackageReference Include="ReaLTaiizor" Version="3.8.0.8" />
<!--<Reference Include="ReaLTaiizor">
<HintPath>..\..\..\src\ReaLTaiizor\bin\Release\$(TargetFramework)\ReaLTaiizor.dll</HintPath>
</Reference>
</Reference>-->
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='GitHub|AnyCPU'">
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
Expand Down
4 changes: 2 additions & 2 deletions src/ReaLTaiizor/Colors/Material.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ namespace ReaLTaiizor.Colors

public class MaterialColorScheme
{
public readonly Color PrimaryColor, DarkPrimaryColor, LightPrimaryColor, AccentColor, TextColor;

public readonly Pen PrimaryPen, DarkPrimaryPen, LightPrimaryPen, AccentPen, TextPen;

public readonly Brush PrimaryBrush, DarkPrimaryBrush, LightPrimaryBrush, AccentBrush, TextBrush;

public readonly Color PrimaryColor, DarkPrimaryColor, LightPrimaryColor, AccentColor, TextColor;

public MaterialColorScheme() : this(MaterialPrimary.Indigo500, MaterialPrimary.Indigo700, MaterialPrimary.Indigo100, MaterialAccent.Pink200, MaterialTextShade.WHITE)
{
}
Expand Down
40 changes: 38 additions & 2 deletions src/ReaLTaiizor/Controls/Drawer/MaterialDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,23 @@ public bool UseColors
}
}

[Category("Drawer")]
private bool _usePreProcessIcons;

public bool UsePreProcessIcons
{
get
{
return _usePreProcessIcons;
}
set
{
_usePreProcessIcons = value;
preProcessIcons();
Invalidate();
}
}

[Category("Drawer")]
private bool _highlightWithAccent;

Expand Down Expand Up @@ -293,8 +310,27 @@ private void preProcessIcons()
new float[] { 0, 0, 0, 1, 0}, // alpha scale factor
new float[] { r, g, b, 0, 1}};// offset

ColorMatrix colorMatrixGray = new(matrixGray);
ColorMatrix colorMatrixColor = new(matrixColor);
// Create matrices
float[][] matrixStandard = {
new float[] { 1, 0, 0, 0, 0}, // Red scale factor
new float[] { 0, 1, 0, 0, 0}, // Green scale factor
new float[] { 0, 0, 1, 0, 0}, // Blue scale factor
new float[] { 0, 0, 0, 1, 0}, // alpha scale factor
new float[] { 0, 0, 0, 0, 0}};// offset

ColorMatrix colorMatrixGray = new();
ColorMatrix colorMatrixColor = new();

if (_usePreProcessIcons)
{
colorMatrixGray = new ColorMatrix(matrixGray);
colorMatrixColor = new ColorMatrix(matrixColor);
}
else
{
colorMatrixGray = new ColorMatrix(matrixStandard);
colorMatrixColor = new ColorMatrix(matrixStandard);
}

ImageAttributes grayImageAttributes = new();
ImageAttributes colorImageAttributes = new();
Expand Down
2 changes: 1 addition & 1 deletion src/ReaLTaiizor/Controls/ListBox/MaterialListBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ protected override void OnPaint(PaintEventArgs e)
string itemText = Items[i].Text;
string itemSecondaryText = Items[i].SecondaryText;

Rectangle itemRect = new Rectangle(0, (i - firstItem) * _itemHeight - itemOffset, Width - (_showScrollBar && _scrollBar.Visible ? _scrollBar.Width : 0), _itemHeight);
Rectangle itemRect = new(0, (i - firstItem) * _itemHeight - itemOffset, Width - (_showScrollBar && _scrollBar.Visible ? _scrollBar.Width : 0), _itemHeight);

if (MultiSelect && _indicates.Count != 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ReaLTaiizor/Forms/Form/MaterialFlexibleForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void InitializeComponent()
this.richTextBoxMessage.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBoxMessage.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.MaterialFlexibleFormBindingSource, "MessageText", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
this.richTextBoxMessage.Depth = 0;
this.richTextBoxMessage.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)0);
this.richTextBoxMessage.Font = new System.Drawing.Font("Roboto", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)0);
this.richTextBoxMessage.ForeColor = System.Drawing.Color.FromArgb((int)(byte)222, (int)(byte)0, (int)(byte)0, (int)(byte)0);
this.richTextBoxMessage.Location = new System.Drawing.Point(56, 12);
this.richTextBoxMessage.Margin = new System.Windows.Forms.Padding(0);
Expand Down
19 changes: 19 additions & 0 deletions src/ReaLTaiizor/Forms/Form/MaterialForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,23 @@ public bool DrawerUseColors
}
}

[Category("Drawer")]
public bool DrawerUsePreProcessIcons
{
get => _drawerUsePreProcessIcons;
set
{
if (_drawerUsePreProcessIcons == value) return;

_drawerUsePreProcessIcons = value;

if (drawerControl == null) return;

drawerControl.UsePreProcessIcons = value;
drawerControl.Refresh();
}
}

[Category("Drawer")]
public bool DrawerHighlightWithAccent
{
Expand Down Expand Up @@ -435,6 +452,7 @@ private bool Maximized
private bool _drawerAutoShow;
private bool _drawerIsOpen;
private bool _drawerUseColors;
private bool _drawerUsePreProcessIcons;
private bool _drawerHighlightWithAccent;
private bool _backgroundWithAccent;
private MaterialDrawer drawerControl = new();
Expand All @@ -452,6 +470,7 @@ public MaterialForm()
DrawerAutoHide = true;
DrawerAutoShow = false;
DrawerIndicatorWidth = 0;
DrawerUsePreProcessIcons = true;
DrawerHighlightWithAccent = true;
DrawerShowIconsWhenHidden = false;
DrawerBackgroundWithAccent = false;
Expand Down

0 comments on commit 951f4c4

Please sign in to comment.