Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto77 committed Dec 6, 2023
1 parent bef9d95 commit e9d7a1e
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Crystallography.Controls/ChemicalFormulaInputControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public Molecule GetMolecule()

if (comboBoxCompound.SelectedIndex != comboBoxCompound.Items.Count - 1)
{
string[] s = comboBoxCompound.Text.Split(new char[] { ' ' });
string[] s = comboBoxCompound.Text.Split([' ']);
accesoryFormula = s[0];
accesoryValence = Convert.ToDouble(string.Concat(s[1].AsSpan(s[1].Length - 1, 1), s[1].AsSpan()[0..^1]));
}
Expand Down
10 changes: 5 additions & 5 deletions Crystallography.Controls/Crystal/AtomControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -587,13 +587,13 @@ public void SetToInterface(Atoms atoms)
private Atoms GetFromInterface()
{

var aniso = UseTypeU ?
new[] { Aniso11 / 100, Aniso22 / 100, Aniso33 / 100, Aniso12 / 100, Aniso23 / 100, Aniso13 / 100 } :
double[] aniso = UseTypeU ?
[Aniso11 / 100, Aniso22 / 100, Aniso33 / 100, Aniso12 / 100, Aniso23 / 100, Aniso13 / 100] :
new[] { Aniso11, Aniso22, Aniso33, Aniso12, Aniso23, Aniso13 };

var anisoErr = UseTypeU ?
new[] { Aniso11Err / 100, Aniso22Err / 100, Aniso33Err / 100, Aniso12Err / 100, Aniso23Err / 100, Aniso13Err / 100 } :
new[] { Aniso11Err, Aniso22Err, Aniso33Err, Aniso12Err, Aniso23Err, Aniso13Err };
double[] anisoErr = UseTypeU ?
[Aniso11Err / 100, Aniso22Err / 100, Aniso33Err / 100, Aniso12Err / 100, Aniso23Err / 100, Aniso13Err / 100] :
[Aniso11Err, Aniso22Err, Aniso33Err, Aniso12Err, Aniso23Err, Aniso13Err];

var dsf = new DiffuseScatteringFactor(UseTypeU ? DiffuseScatteringFactor.Type.U : DiffuseScatteringFactor.Type.B,
UseIsotropy, Iso / 100, IsoErr / 100, aniso, anisoErr, Crystal.CellValue);
Expand Down
16 changes: 5 additions & 11 deletions Crystallography.Controls/Crystal/AtomCoordinateTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Crystallography.Controls
{
public partial class AtomCoordinateTable : UserControl
{
readonly ReaderWriterLockSlim rwLock = new ReaderWriterLockSlim();
readonly ReaderWriterLockSlim rwLock = new();
private bool skipEvent { get; set; } = false;
public AtomCoordinateTable()
{
Expand Down Expand Up @@ -190,16 +190,10 @@ private void DrawGraph(List<(string Label, double Distance)> atoms)
pictureBox.Image = bmp;
}

private class ControlPoint : IComparable
private class ControlPoint(double x, bool flag) : IComparable
{
public double X;
public bool Flag;

public ControlPoint(double x, bool flag)
{
X = x;
Flag = flag;
}
public double X = x;
public bool Flag = flag;

public int CompareTo(object obj)
{
Expand Down Expand Up @@ -265,7 +259,7 @@ private void DrawGraduation()
else if (d < 5.0) AngleGradiation = (float)(5 * Math.Pow(10, (int)Math.Log10(UpperX - LowerX) - 1));
else AngleGradiation = (float)(10 * Math.Pow(10, (int)Math.Log10(UpperX - LowerX) - 1));
g.DrawLine(new Pen(Color.Black, 1), OriginPos.X, pictureBox.Height - OriginPos.Y, pictureBox.Width, pictureBox.Height - OriginPos.Y);
Font strFont = new Font(new FontFamily("tahoma"), 8);
Font strFont = new(new FontFamily("tahoma"), 8);
for (int i = (int)(LowerX / AngleGradiation) + 1; i < UpperX / AngleGradiation; i++)
{
g.DrawLine(new Pen(Color.Black, 1), ConvToPicBoxCoord(i * AngleGradiation, 0).X, pictureBox.Height - OriginPos.Y, ConvToPicBoxCoord(i * AngleGradiation, 0).X, pictureBox.Height - OriginPos.Y + 5);
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.Controls/Crystal/FormIsotopeComposition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public double[] IsotopicComposition
{
dataGridView.Rows.Clear();
foreach (int z in AtomStatic.IsotopeAbundance[atomNumber].Keys)
dataGridView.Rows.Add(new object[] { z.ToString(), AtomStatic.IsotopeAbundance[atomNumber][z], AtomStatic.IsotopeAbundance[atomNumber][z] });
dataGridView.Rows.Add([z.ToString(), AtomStatic.IsotopeAbundance[atomNumber][z], AtomStatic.IsotopeAbundance[atomNumber][z]]);
}
else
{
int n = 0;
foreach (int z in AtomStatic.IsotopeAbundance[atomNumber].Keys)
dataGridView.Rows.Add(new object[] { z, AtomStatic.IsotopeAbundance[atomNumber][z], isotopicComposition[n++] });
dataGridView.Rows.Add([z, AtomStatic.IsotopeAbundance[atomNumber][z], isotopicComposition[n++]]);
}
}
get
Expand Down
4 changes: 2 additions & 2 deletions Crystallography.Controls/Crystallography.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.12.6.0433</AssemblyVersion>
<FileVersion>2023.12.6.0433</FileVersion>
<AssemblyVersion>2023.12.6.0628</AssemblyVersion>
<FileVersion>2023.12.6.0628</FileVersion>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<ApplicationUseCompatibleTextRendering>true</ApplicationUseCompatibleTextRendering>
<ApplicationVisualStyles>true</ApplicationVisualStyles>
Expand Down
2 changes: 1 addition & 1 deletion Crystallography.Controls/ExRichTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public partial class ExRichTextBox : System.Windows.Forms.RichTextBox
private readonly ListBox listBox = new();//入力候補のポップアップリスト
//private Timer timer = new Timer();

private ToolTip tooltip = new();
private readonly ToolTip tooltip = new();

//private Label toolTipLabel = new Label();
private string[] _AutoCompleteItems;//入力候補事前登録用
Expand Down
2 changes: 1 addition & 1 deletion Crystallography.Controls/GraphControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public bool YLog

#endregion プロパティ

private List<Profile> destProfileList = new List<Profile>();
private List<Profile> destProfileList = new();

#region プロファイルの追加、置換、スムージング
public void AddPoint(int profileNumber, PointD pt)
Expand Down
12 changes: 3 additions & 9 deletions Crystallography.Controls/Macro/FormMacro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -487,16 +487,10 @@ public byte[] ZippedMacros
}
}

private struct macro
private struct macro(string name, string body)
{
public string Name;
public string Body;

public macro(string name, string body)
{
Name = name;
Body = body;
}
public string Name = name;
public string Body = body;

public override string ToString() => Name;
}
Expand Down
18 changes: 5 additions & 13 deletions Crystallography.Controls/Macro/Macro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,12 @@
namespace Crystallography.Controls;

[Serializable()]
public class MacroTriger
public class MacroTriger(string target, bool debug, object[] obj, string macroName = "")
{
public bool Debug { set; get; }
public string Target { set; get; }
public string MacroName = "";
public object[] Obj;

public MacroTriger(string target, bool debug, object[] obj, string macroName = "")
{
Target = target;
Debug = debug;
Obj = obj;
MacroName = macroName;
}
public bool Debug { set; get; } = debug;
public string Target { set; get; } = target;
public string MacroName = macroName;
public object[] Obj = obj;
}

[Serializable()]
Expand Down
2 changes: 1 addition & 1 deletion Crystallography.Controls/ScalablePictureBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ private void pictureBox_Paint(object sender, PaintEventArgs e)
private void drawSymbols(PaintEventArgs e, List<PointD> spot, List<string> spotLabel, Brush brush1, Brush brush2, bool showLabel, int? emphasizeNum)
{
var gp = new GraphicsPath();
FontFamily ff = new FontFamily("Arial");
FontFamily ff = new("Arial");
Pen pen1 = new(brush1), pen2 = new(brush2);
if (spot != null && spot.Count > 0)
for (int i = 0; i < spot.Count; i++)
Expand Down
4 changes: 2 additions & 2 deletions Crystallography/Crystallography.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>Library</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.12.6.0430</AssemblyVersion>
<FileVersion>2023.12.6.0430</FileVersion>
<AssemblyVersion>2023.12.6.0628</AssemblyVersion>
<FileVersion>2023.12.6.0628</FileVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup>

Expand Down
3 changes: 3 additions & 0 deletions PDIndexer/FormMain.Designer.cs

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

3 changes: 3 additions & 0 deletions PDIndexer/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,9 @@ public void SetDrawRangeLimit()
}
if (double.IsInfinity(MinimalX)) return;

if (minimalX < 0)
minimalX = 0;

MinimalX = minimalX;//MinimalXが直近のMaximalXより大きかった場合、正常に更新できない。そのため、2行下でもう一回更新。
MaximalX = maximalX;
MinimalX = minimalX;//2行上のコメント参照
Expand Down
9 changes: 4 additions & 5 deletions PDIndexer/PDIndexer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.12.6.0433</AssemblyVersion>
<FileVersion>2023.12.6.0433</FileVersion>
<AssemblyVersion>2023.12.6.0628</AssemblyVersion>
<FileVersion>2023.12.6.0628</FileVersion>
<ApplicationIcon>App.ico</ApplicationIcon>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationHighDpiMode>SystemAware</ApplicationHighDpiMode>
<ForceDesignerDpiUnaware>true</ForceDesignerDpiUnaware>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<ApplicationUseCompatibleTextRendering>true</ApplicationUseCompatibleTextRendering>
<ApplicationVisualStyles>true</ApplicationVisualStyles>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
2 changes: 1 addition & 1 deletion PDIndexer/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static class Version
/// </summary>
public const string History =
"History" +
"\r\n ver4.444(2023/12/06) Fixed bugs when loading *.npd files (thx to Shibasaki-san)." +
"\r\n ver4.445(2023/12/06) Fixed bugs when loading *.npd files (thx to Shibasaki-san)." +
"\r\n ver4.443(2023/11/27) The target framework has been changed to .Net Desktop Runtime 8.0. Fixed a minor bug (thx to Okazaki-san)." +
"\r\n ver4.442(2023/10/07) Update crystal database. Fixed minor bugs." +
"\r\n ver4.441(2023/07/01) Fixed a bug on loading *.pdi2 format files." +
Expand Down

0 comments on commit e9d7a1e

Please sign in to comment.