Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto committed Nov 11, 2024
1 parent 4fbe8ed commit 137fb7e
Show file tree
Hide file tree
Showing 37 changed files with 5,373 additions and 1,684 deletions.
2 changes: 1 addition & 1 deletion CSManager/CSManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.26100.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2024.7.4.1116</AssemblyVersion>
<FileVersion>2024.7.4.1116</FileVersion>
Expand Down
4 changes: 4 additions & 0 deletions Crystallography.Controls/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]

# WFO1000: A property should determine its property content serialization with the DesignerSerializationVisibilityAttribute, DefaultValueAttribute or the ShouldSerializeProperty method
dotnet_diagnostic.WFO1000.severity = silent
3 changes: 3 additions & 0 deletions Crystallography.Controls/ChemicalFormulaInputControl.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace Crystallography.Controls;
Expand All @@ -7,6 +8,7 @@ public partial class ChemicalFormulaInputControl : UserControl
{
private bool standardMode = true;

[DefaultValue(true)]
public bool StandardMode
{
set
Expand All @@ -18,6 +20,7 @@ public bool StandardMode
}

private bool weightMode = true;
[DefaultValue(true)]

public bool WeightMode
{
Expand Down
13 changes: 10 additions & 3 deletions Crystallography.Controls/ColorControl.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 31 additions & 8 deletions Crystallography.Controls/ColorControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public partial class ColorControl : UserControl
{
public event EventHandler ColorChanged;


[DefaultValue(typeof(FlowDirection),"LeftToRight")]
[Category("Appearance property")]
public FlowDirection FlowDirection
{
Expand All @@ -22,16 +24,20 @@ public FlowDirection FlowDirection
}
}

[DefaultValue(typeof(Size),"24,24")]
[Category("Appearance property")]
public Size BoxSize { get => pictureBox.Size; set => pictureBox.Size = value; }

[DefaultValue("")]
[Localizable(true)]
public string ToolTip { set => toolTip.SetToolTip(pictureBox, value); get => toolTip.GetToolTip(pictureBox); }

[DefaultValue("")]
[Category("Header/footer text")]
[Localizable(true)]
public string HeaderText { set { labelHeader.Text = value; labelHeader.Visible = value != ""; } get => labelHeader.Text; }

[DefaultValue("")]
[Category("Header/footer text")]
[Localizable(true)]
public Font HeaderFont { set => labelHeader.Font = value; get => labelHeader.Font; }
Expand All @@ -44,6 +50,7 @@ public FlowDirection FlowDirection
[Localizable(true)]
public string FooterText { set { labelFooter.Text = value; labelFooter.Visible = value != ""; } get => labelFooter.Text; }


[Localizable(true)]
[Category("Header/footer text")]
public Font FooterFont { set => labelFooter.Font = value; get => labelFooter.Font; }
Expand All @@ -52,52 +59,68 @@ public FlowDirection FlowDirection
[Category("Header/footer text")]
public Padding FooterMargin { set => labelFooter.Margin = value; get => labelFooter.Margin; }


[DefaultValue(false)]
[Category("Color")]
public bool Inversion { set; get; } = false;

[Category("Color")]
public Color Color { set => pictureBox.BackColor = value; get => pictureBox.BackColor; }
public Color Color
{
set => pictureBox.BackColor = value;
get {
var color = pictureBox.BackColor;
return Inversion ? Color.FromArgb(color.A, 255 - color.R, 255 - color.G, 255 - color.B): color;
}
}

[Category("Color")]
public int Argb { set => pictureBox.BackColor = Color.FromArgb(value); get => pictureBox.BackColor.ToArgb(); }
public int Argb
{
set => pictureBox.BackColor = Color.FromArgb(value);
get => Color.ToArgb();
}

[Category("Color")]
public int Red
{
set { if (value >= 0 && value < 256) pictureBox.BackColor = Color.FromArgb(value, pictureBox.BackColor.G, pictureBox.BackColor.B); }
get { return pictureBox.BackColor.R; }
get => Inversion ? 255 - pictureBox.BackColor.R: pictureBox.BackColor.R;
}

[Category("Color")]
public int Green
{
set { if (value >= 0 && value < 256) pictureBox.BackColor = Color.FromArgb(pictureBox.BackColor.R, value, pictureBox.BackColor.B); }
get { return pictureBox.BackColor.G; }
get => Inversion ? 255 - pictureBox.BackColor.G: pictureBox.BackColor.G;
}

[Category("Color")]
public int Blue
{
set { if (value >= 0 && value < 256) pictureBox.BackColor = Color.FromArgb(pictureBox.BackColor.R, pictureBox.BackColor.G, value); }
get { return pictureBox.BackColor.B; }
get => Inversion ? 255 - pictureBox.BackColor.B: pictureBox.BackColor.B;
}

[Category("Color")]
public float RedF
{
set { if (value >= 0 && value <= 1) pictureBox.BackColor = Color.FromArgb((int)(value * 255), pictureBox.BackColor.G, pictureBox.BackColor.B); }
get { return pictureBox.BackColor.R / 255f; }
get => Inversion ? 1 - pictureBox.BackColor.R / 255f : pictureBox.BackColor.R / 255f;
}

[Category("Color")]
public float GreenF
{
set { if (value >= 0 && value < 256) pictureBox.BackColor = Color.FromArgb(pictureBox.BackColor.R, (int)(value * 255), pictureBox.BackColor.B); }
get { return pictureBox.BackColor.G / 255f; }
get => Inversion ? 1 - pictureBox.BackColor.G / 255f: pictureBox.BackColor.G / 255f;
}

[Category("Color")]
public float BlueF
{
set { if (value >= 0 && value < 256) pictureBox.BackColor = Color.FromArgb(pictureBox.BackColor.R, pictureBox.BackColor.G, (int)(value * 255)); }
get { return pictureBox.BackColor.B / 255f; }
get => Inversion ? 1 - pictureBox.BackColor.B / 255f: pictureBox.BackColor.B / 255f;
}

public ColorControl()
Expand Down
17 changes: 12 additions & 5 deletions Crystallography.Controls/Crystal/BoundControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public partial class BoundControl : UserControl

public Crystal Crystal
{
get => crystal; set
get => crystal;
set
{
crystal = value;
if (crystal != null)
Expand Down Expand Up @@ -78,9 +79,9 @@ public void SetToInterface(Bound b)

#region データベース操作
/// <summary>
/// データベースにbondsを追加する
/// データベースにboundsを追加する
/// </summary>
/// <param name="bonds"></param>
/// <param name="bounds"></param>
public void Add(Bound bounds)
{
if (bounds != null && bounds.Index != (0, 0, 0))
Expand All @@ -93,7 +94,7 @@ public void Add(Bound bounds)
}

/// <summary>
/// データベースに原子を追加する
/// データベースにboundsを追加する
/// </summary>
/// <param name="bounds"></param>
public void AddRange(IEnumerable<Bound> bounds)
Expand Down Expand Up @@ -147,7 +148,13 @@ public void Clear()
/// データベース中の全ての境界面を取得
/// </summary>
/// <returns></returns>
public Bound[] GetAll() => table.GetAll();
public Bound[] GetAll()
{
var bounds = table.GetAll();
for (int i = 0; i < bounds.Length; i++)
bounds[i].Reset(Crystal);
return bounds;
}

#endregion

Expand Down
Loading

0 comments on commit 137fb7e

Please sign in to comment.