Skip to content

Commit

Permalink
Aboutダイアログを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
110-kenichi committed Aug 13, 2019
1 parent 678b7ed commit 9a652f8
Show file tree
Hide file tree
Showing 23 changed files with 608 additions and 254 deletions.
15 changes: 15 additions & 0 deletions build/generated/mame/mame/drivlist.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "emu.h"

#include "drivenum.h"

GAME_EXTERN(___empty);
GAME_EXTERN(genesis);

const game_driver * const driver_list::s_drivers_sorted[2] =
{
&GAME_NAME(___empty),
&GAME_NAME(genesis),
};

std::size_t const driver_list::s_driver_count = 2;

109 changes: 109 additions & 0 deletions src/mamidimemo/ComponentModel/ImageUtility.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace zanac.MAmidiMEmo.ComponentModel
{
//https://stackoverflow.com/questions/26884446/how-to-scale-on-high-dpi-the-image-of-a-windows-form-button

/// <summary>
///
/// </summary>
public static class ImageUtility
{
/// <summary>
///
/// </summary>
/// <param name="container"></param>
public static void AdjustControlImagesDpiScale(Control container)
{
var dpiScale = GetDpiScale(container).Value;
if (CloseToOne(dpiScale))
return;

AdjustControlImagesDpiScale(container.Controls, dpiScale);
}

private static void AdjustButtonImageDpiScale(ButtonBase button, float dpiScale)
{
var image = button.Image;
if (image == null)
return;

button.Image = ScaleImage(image, dpiScale);
}

private static void AdjustControlImagesDpiScale(Control.ControlCollection controls, float dpiScale)
{
foreach (Control control in controls)
{
var button = control as ButtonBase;
if (button != null)
AdjustButtonImageDpiScale(button, dpiScale);
else
{
var pictureBox = control as PictureBox;
if (pictureBox != null)
AdjustPictureBoxDpiScale(pictureBox, dpiScale);
}

AdjustControlImagesDpiScale(control.Controls, dpiScale);
}
}

private static void AdjustPictureBoxDpiScale(PictureBox pictureBox, float dpiScale)
{
var image = pictureBox.Image;
if (image == null)
return;

if (pictureBox.SizeMode == PictureBoxSizeMode.CenterImage)
pictureBox.Image = ScaleImage(pictureBox.Image, dpiScale);
}

private static bool CloseToOne(float dpiScale)
{
return Math.Abs(dpiScale - 1) < 0.001;
}

private static Lazy<float> GetDpiScale(Control control)
{
return new Lazy<float>(() =>
{
using (var graphics = control.CreateGraphics())
return graphics.DpiX / 96.0f;
});
}

private static Image ScaleImage(Image image, float dpiScale)
{
var newSize = ScaleSize(image.Size, dpiScale);
var newBitmap = new Bitmap(newSize.Width, newSize.Height);

using (var g = Graphics.FromImage(newBitmap))
{
// According to this blog post http://blogs.msdn.com/b/visualstudio/archive/2014/03/19/improving-high-dpi-support-for-visual-studio-2013.aspx
// NearestNeighbor is more adapted for 200% and 200%+ DPI

var interpolationMode = InterpolationMode.HighQualityBicubic;
if (dpiScale >= 2.0f)
interpolationMode = InterpolationMode.NearestNeighbor;

g.InterpolationMode = interpolationMode;
g.DrawImage(image, new Rectangle(new Point(), newSize));
}

return newBitmap;
}

private static Size ScaleSize(Size size, float scale)
{
return new Size((int)(size.Width * scale), (int)(size.Height * scale));
}
}
}
Binary file modified src/mamidimemo/Data/Images.pptx
Binary file not shown.
83 changes: 83 additions & 0 deletions src/mamidimemo/Gui/FormAbout.Designer.cs

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

26 changes: 26 additions & 0 deletions src/mamidimemo/Gui/FormAbout.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using zanac.MAmidiMEmo.ComponentModel;

namespace zanac.MAmidiMEmo.Gui
{
public partial class FormAbout : Form
{
public FormAbout()
{
InitializeComponent();

labelVer.Text = string.Format(labelVer.Text, Program.FILE_VERSION);

ImageUtility.AdjustControlImagesDpiScale(this);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,115 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="GB_APU" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>GB_APU.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="button1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
</data>
<data name="NAMCO_CUS30" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>NAMCO_CUS30.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="button1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="RP2A03" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>RP2A03.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="button1.Location" type="System.Drawing.Point, System.Drawing">
<value>422, 149</value>
</data>
<data name="SN76496" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>SN76496.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="button1.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="YM2151" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>YM2151.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="button1.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="YM2612" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>YM2612.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="button1.Text" xml:space="preserve">
<value>OK</value>
</data>
<data name="&gt;&gt;button1.Name" xml:space="preserve">
<value>button1</value>
</data>
<data name="&gt;&gt;button1.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;button1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;button1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="labelVer.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="labelVer.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 110</value>
</data>
<data name="labelVer.Size" type="System.Drawing.Size, System.Drawing">
<value>415, 33</value>
</data>
<data name="labelVer.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="labelVer.Text" xml:space="preserve">
<value>Virtual chiptune sound MIDI module "MAmidiMEmo" Version {0}
Copyright(C) 2019 Itoken. All rights reserved.</value>
</data>
<data name="&gt;&gt;labelVer.Name" xml:space="preserve">
<value>labelVer</value>
</data>
<data name="&gt;&gt;labelVer.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labelVer.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;labelVer.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="pictureBox1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="pictureBox1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 12</value>
</data>
<data name="pictureBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>485, 95</value>
</data>
<data name="pictureBox1.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>CenterImage</value>
</data>
<data name="pictureBox1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;pictureBox1.Name" xml:space="preserve">
<value>pictureBox1</value>
</data>
<data name="&gt;&gt;pictureBox1.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;pictureBox1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>509, 184</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterParent</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>About</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>FormAbout</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
3 changes: 2 additions & 1 deletion src/mamidimemo/Gui/FormMain.Designer.cs

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

Loading

0 comments on commit 9a652f8

Please sign in to comment.