Skip to content

Commit 137fb7e

Browse files
committed
update
1 parent 4fbe8ed commit 137fb7e

37 files changed

Lines changed: 5373 additions & 1684 deletions

CSManager/CSManager.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
5+
<TargetFramework>net8.0-windows10.0.26100.0</TargetFramework>
66
<UseWindowsForms>true</UseWindowsForms>
77
<AssemblyVersion>2024.7.4.1116</AssemblyVersion>
88
<FileVersion>2024.7.4.1116</FileVersion>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[*.cs]
2+
3+
# WFO1000: A property should determine its property content serialization with the DesignerSerializationVisibilityAttribute, DefaultValueAttribute or the ShouldSerializeProperty method
4+
dotnet_diagnostic.WFO1000.severity = silent

Crystallography.Controls/ChemicalFormulaInputControl.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using System.Windows.Forms;
34

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

11+
[DefaultValue(true)]
1012
public bool StandardMode
1113
{
1214
set
@@ -18,6 +20,7 @@ public bool StandardMode
1820
}
1921

2022
private bool weightMode = true;
23+
[DefaultValue(true)]
2124

2225
public bool WeightMode
2326
{

Crystallography.Controls/ColorControl.Designer.cs

Lines changed: 10 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Crystallography.Controls/ColorControl.cs

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public partial class ColorControl : UserControl
1010
{
1111
public event EventHandler ColorChanged;
1212

13+
14+
[DefaultValue(typeof(FlowDirection),"LeftToRight")]
1315
[Category("Appearance property")]
1416
public FlowDirection FlowDirection
1517
{
@@ -22,16 +24,20 @@ public FlowDirection FlowDirection
2224
}
2325
}
2426

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

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

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

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

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

62+
63+
[DefaultValue(false)]
64+
[Category("Color")]
65+
public bool Inversion { set; get; } = false;
66+
5567
[Category("Color")]
56-
public Color Color { set => pictureBox.BackColor = value; get => pictureBox.BackColor; }
68+
public Color Color
69+
{
70+
set => pictureBox.BackColor = value;
71+
get {
72+
var color = pictureBox.BackColor;
73+
return Inversion ? Color.FromArgb(color.A, 255 - color.R, 255 - color.G, 255 - color.B): color;
74+
}
75+
}
5776

5877
[Category("Color")]
59-
public int Argb { set => pictureBox.BackColor = Color.FromArgb(value); get => pictureBox.BackColor.ToArgb(); }
78+
public int Argb
79+
{
80+
set => pictureBox.BackColor = Color.FromArgb(value);
81+
get => Color.ToArgb();
82+
}
6083

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

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

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

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

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

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

103126
public ColorControl()

Crystallography.Controls/Crystal/BoundControl.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public partial class BoundControl : UserControl
1717

1818
public Crystal Crystal
1919
{
20-
get => crystal; set
20+
get => crystal;
21+
set
2122
{
2223
crystal = value;
2324
if (crystal != null)
@@ -78,9 +79,9 @@ public void SetToInterface(Bound b)
7879

7980
#region データベース操作
8081
/// <summary>
81-
/// データベースにbondsを追加する
82+
/// データベースにboundsを追加する
8283
/// </summary>
83-
/// <param name="bonds"></param>
84+
/// <param name="bounds"></param>
8485
public void Add(Bound bounds)
8586
{
8687
if (bounds != null && bounds.Index != (0, 0, 0))
@@ -93,7 +94,7 @@ public void Add(Bound bounds)
9394
}
9495

9596
/// <summary>
96-
/// データベースに原子を追加する
97+
/// データベースにboundsを追加する
9798
/// </summary>
9899
/// <param name="bounds"></param>
99100
public void AddRange(IEnumerable<Bound> bounds)
@@ -147,7 +148,13 @@ public void Clear()
147148
/// データベース中の全ての境界面を取得
148149
/// </summary>
149150
/// <returns></returns>
150-
public Bound[] GetAll() => table.GetAll();
151+
public Bound[] GetAll()
152+
{
153+
var bounds = table.GetAll();
154+
for (int i = 0; i < bounds.Length; i++)
155+
bounds[i].Reset(Crystal);
156+
return bounds;
157+
}
151158

152159
#endregion
153160

0 commit comments

Comments
 (0)