Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
seto77 committed Oct 7, 2023
1 parent 2869585 commit 79e3d00
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 53 deletions.
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>net7.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.10.7.0542</AssemblyVersion>
<FileVersion>2023.10.7.0542</FileVersion>
<AssemblyVersion>2023.10.7.0557</AssemblyVersion>
<FileVersion>2023.10.7.0557</FileVersion>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<ApplicationUseCompatibleTextRendering>true</ApplicationUseCompatibleTextRendering>
<ApplicationVisualStyles>true</ApplicationVisualStyles>
Expand Down
11 changes: 4 additions & 7 deletions Crystallography.Controls/ScalablePictureBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public ScalablePictureBox()
public bool VerticalFlip
{
set { PseudoBitmap.VerticalFlip = value; drawPictureBox(); }
get { return PseudoBitmap.VerticalFlip; }
get => PseudoBitmap.VerticalFlip;
}

private bool horizontalFlip = false;
Expand All @@ -178,7 +178,7 @@ public bool VerticalFlip
public bool HorizontalFlip
{
set { PseudoBitmap.HorizontalFlip = value; drawPictureBox(); }
get { return PseudoBitmap.HorizontalFlip; }
get => PseudoBitmap.HorizontalFlip;
}

private double minZoom = 0.1f;
Expand Down Expand Up @@ -235,9 +235,6 @@ public PointD Center
get => _Center.IsNaN ? new PointD(0, 0) : _Center;
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
private Vector3DBase zoomAndCenter = new(1, 0, 0);

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public (double Zoom, PointD Center) ZoomAndCenter
{
Expand Down Expand Up @@ -307,7 +304,7 @@ public bool ShowAreaRectangle
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
private RectangleD areaRentagle = new RectangleD();
private RectangleD areaRentagle = new();
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public RectangleD AreaRectangle
{
Expand All @@ -331,7 +328,7 @@ public RectangleD AreaRectangle
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Color TextColor { get => label.ForeColor; set => label.ForeColor = value; }

private PseudoBitmap _pseudoBitmap = new PseudoBitmap();
private PseudoBitmap _pseudoBitmap = new();

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public PseudoBitmap PseudoBitmap
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>net7.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.10.7.0542</AssemblyVersion>
<FileVersion>2023.10.7.0542</FileVersion>
<AssemblyVersion>2023.10.7.0557</AssemblyVersion>
<FileVersion>2023.10.7.0557</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
41 changes: 16 additions & 25 deletions Crystallography/PointD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ public struct RectangleD
public double Width { set; get; }
public double Height { set; get; }

public double UpperX { get { return X + Width; } }
public double UpperY { get { return Y + Height; } }
public readonly double UpperX => X + Width;
public readonly double UpperY => Y + Height;

public readonly bool IsInsde(PointD p)
{
return p.X >= X && p.X <= X + Width && p.Y >= Y && p.Y <= Y + Height;
}
public readonly bool IsInsde(PointD p) => p.X >= X && p.X <= X + Width && p.Y >= Y && p.Y <= Y + Height;

public RectangleD(double x, double y, double width, double height) : this()
{
Expand Down Expand Up @@ -63,16 +60,16 @@ public RectangleD(PointD pt1, PointD pt2) : this()
Height = Math.Abs(pt2.Y - pt1.Y);
}

public readonly RectangleF ToRectangleF() => new RectangleF((float)X, (float)Y, (float)Width, (float)Height);
public readonly RectangleF ToRectangleF() => new((float)X, (float)Y, (float)Width, (float)Height);

public readonly SizeD ToSizeD() => new SizeD(Width, Height);
public readonly SizeF ToSizeF() => new SizeF((float)Width, (float)Height);
public readonly SizeD ToSizeD() => new(Width, Height);
public readonly SizeF ToSizeF() => new((float)Width, (float)Height);

/// <summary>
/// 四捨五入して整数サイズに変換
/// </summary>
/// <returns></returns>
public readonly Size ToSize() => new Size((int)(Width + 0.5), (int)(Height + 0.5));
public readonly Size ToSize() => new((int)(Width + 0.5), (int)(Height + 0.5));

}

Expand Down Expand Up @@ -108,27 +105,21 @@ public SizeD(Size size) : this()
Height = size.Height;
}

public readonly SizeF ToSizeF()
{
return new SizeF((float)Width, (float)Height);
}
public readonly SizeF ToSizeF() => new((float)Width, (float)Height);

#region 演算子のオーバーロード

public override int GetHashCode()
{
return HashCode.Combine(Width, Height);
}
public override readonly int GetHashCode() => HashCode.Combine(Width, Height);

public override bool Equals(object obj) => obj is SizeD d && Equals(d);
public override readonly bool Equals(object obj) => obj is SizeD d && Equals(d);

public bool Equals(in SizeD other) => Width == other.Width && Height == other.Height;
public readonly bool Equals(in SizeD other) => Width == other.Width && Height == other.Height;

public static SizeD operator +(in SizeD p1, in SizeD p2) => new(p1.Width + p2.Width, p1.Height + p2.Height);

public static SizeD operator -(in SizeD p1, in SizeD p2) => new(p1.Width - p2.Width, p1.Height - p2.Height);

public static SizeD operator -(in SizeD p) => new SizeD(-p.Width, -p.Height);
public static SizeD operator -(in SizeD p) => new(-p.Width, -p.Height);

public static SizeD operator *(in double d, in SizeD p) => new(d * p.Width, d * p.Height);

Expand Down Expand Up @@ -177,7 +168,7 @@ public PointD(in PointD pt)

public readonly PointF ToPointF() => new((float)X, (float)Y);

public int CompareTo(object obj)
public readonly int CompareTo(object obj)
{
int value = X.CompareTo(((PointD)obj).X);
if (value != 0)
Expand All @@ -191,11 +182,11 @@ public int CompareTo(object obj)
/// <returns></returns>
public override readonly string ToString() => string.Format("({0}, {1})", this.X, this.Y);

public override bool Equals(object obj) => obj is PointD d && Equals(d);
public override readonly bool Equals(object obj) => obj is PointD d && Equals(d);

public bool Equals(PointD other) => X == other.X && Y == other.Y;
public readonly bool Equals(PointD other) => X == other.X && Y == other.Y;

public override int GetHashCode() => HashCode.Combine(X, Y);
public override readonly int GetHashCode() => HashCode.Combine(X, Y);

#region 演算子のオーバーロード

Expand Down
4 changes: 2 additions & 2 deletions PDIndexer/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ private void FormMain_FormClosed(object sender, FormClosedEventArgs e)

#region レジストリ操作

private void ClearRegistry()
private static void ClearRegistry()
{
try { Microsoft.Win32.Registry.CurrentUser.DeleteSubKey("Software\\Crystallography\\PDIndexer"); }
catch { }
Expand Down Expand Up @@ -1551,7 +1551,7 @@ private void DrawGradiation()
var pen = new Pen(colorControlScaleLine.Color, 1);

gMain.DrawLine(pen, OriginPos.X, pictureBoxMain.Height - OriginPos.Y, pictureBoxMain.Width, pictureBoxMain.Height - OriginPos.Y);
Font strFont = new Font(new FontFamily("tahoma"), 8);
using Font strFont = new(new FontFamily("tahoma"), 8);
for (int i = (int)(LowerX / AngleGradiation) + 1; i < UpperX / AngleGradiation; i++)
{
pen = new Pen(colorControlScaleLine.Color, 1);
Expand Down
4 changes: 2 additions & 2 deletions PDIndexer/PDIndexer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<AssemblyVersion>2023.10.7.0542</AssemblyVersion>
<FileVersion>2023.10.7.0542</FileVersion>
<AssemblyVersion>2023.10.7.0557</AssemblyVersion>
<FileVersion>2023.10.7.0557</FileVersion>
<ApplicationIcon>App.ico</ApplicationIcon>
</PropertyGroup>

Expand Down
14 changes: 1 addition & 13 deletions PDIndexer/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,12 @@ static class Version
{
public const string Software = "PDIndexer";

static public string RecentHistory
{
get
{
var list = History.Remove(0, 10).Split(new string[] { "\r\n " }, StringSplitOptions.RemoveEmptyEntries);
var str = "";
for (int i = 0; i < 5; i++)
str += list[i] + "<br>\r\n";
return str;
}
}

/// <summary>
/// 更新履歴
/// </summary>
public const string History =
"History" +
"\r\n ver4.441(2023/10/07) Fixed minor bugs." +
"\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." +
"\r\n ver4.440(2023/05/24) Improved registry read/write.The registry is cleared the first time this version is launched." +
"\r\n ver4.439(2023/05/23) Fixed bugs on loading txt-format profiles." +
Expand Down

0 comments on commit 79e3d00

Please sign in to comment.