OSDN Git Service

#28263 DTX2WAV006:
authoryyagi <yyagi.dtxmania@gmail.com>
Mon, 12 Feb 2018 15:59:58 +0000 (00:59 +0900)
committeryyagi <yyagi.dtxmania@gmail.com>
Mon, 12 Feb 2018 15:59:58 +0000 (00:59 +0900)
 * 録音終了と録音キャンセルのダイアログに、OS標準アイコンを追加。
 *  曲データの読み込み前に録音キャンセルをしたときに例外が発生した問題を修正。

DTX2WAV/Form_FInished_OK.Designer.cs
DTX2WAV/Form_FInished_OK.cs
DTX2WAV/Form_FInished_OK.resx
DTX2WAV/Form_Finished_Fail.Designer.cs [new file with mode: 0644]
DTX2WAV/Form_Finished_Fail.cs [new file with mode: 0644]
DTX2WAV/Form_Finished_Fail.resx [new file with mode: 0644]
DTX2WAV/Form_Recording.cs
DTXMania/コード/全体/CDTXMania.cs

index 7938285..543754e 100644 (file)
@@ -31,6 +31,8 @@
                        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form_Finished_OK));
                        this.button_OK = new System.Windows.Forms.Button();
                        this.label_finished = new System.Windows.Forms.Label();
+                       this.pictureBox_OKIcon = new System.Windows.Forms.PictureBox();
+                       ((System.ComponentModel.ISupportInitialize)(this.pictureBox_OKIcon)).BeginInit();
                        this.SuspendLayout();
                        // 
                        // button_OK
                        resources.ApplyResources(this.label_finished, "label_finished");
                        this.label_finished.Name = "label_finished";
                        // 
-                       // Form_FInished
+                       // pictureBox_OKIcon
+                       // 
+                       resources.ApplyResources(this.pictureBox_OKIcon, "pictureBox_OKIcon");
+                       this.pictureBox_OKIcon.Name = "pictureBox_OKIcon";
+                       this.pictureBox_OKIcon.TabStop = false;
+                       // 
+                       // Form_Finished_OK
                        // 
                        resources.ApplyResources(this, "$this");
                        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                        this.ControlBox = false;
+                       this.Controls.Add(this.pictureBox_OKIcon);
                        this.Controls.Add(this.label_finished);
                        this.Controls.Add(this.button_OK);
-                       this.Name = "Form_FInished";
+                       this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+                       this.Name = "Form_Finished_OK";
+                       this.Shown += new System.EventHandler(this.Form_Finished_OK_Shown);
+                       ((System.ComponentModel.ISupportInitialize)(this.pictureBox_OKIcon)).EndInit();
                        this.ResumeLayout(false);
                        this.PerformLayout();
 
@@ -62,5 +74,6 @@
 
                private System.Windows.Forms.Button button_OK;
                private System.Windows.Forms.Label label_finished;
+               private System.Windows.Forms.PictureBox pictureBox_OKIcon;
        }
 }
\ No newline at end of file
index 12fed89..f5447c8 100644 (file)
@@ -21,5 +21,15 @@ namespace DTX2WAV
                {
                        this.Close();
                }
+
+               private void Form_Finished_OK_Shown(object sender, EventArgs e)
+               {
+                       Bitmap canvas = new Bitmap(pictureBox_OKIcon.Width, pictureBox_OKIcon.Height);
+                       Graphics g = Graphics.FromImage(canvas);
+
+                       g.DrawIcon(SystemIcons.Information, 0, 0);
+                       g.Dispose();
+                       pictureBox_OKIcon.Image = canvas;
+               }
        }
 }
index 98c544b..e6a946f 100644 (file)
   <resheader name="writer">
     <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="button_OK.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
+    <value>Bottom</value>
+  </data>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="button_OK.Location" type="System.Drawing.Point, System.Drawing">
-    <value>42, 85</value>
+    <value>57, 56</value>
   </data>
   <data name="button_OK.Size" type="System.Drawing.Size, System.Drawing">
     <value>75, 23</value>
     <value>$this</value>
   </data>
   <data name="&gt;&gt;button_OK.ZOrder" xml:space="preserve">
-    <value>1</value>
+    <value>2</value>
   </data>
   <data name="label_finished.AutoSize" type="System.Boolean, mscorlib">
     <value>True</value>
   </data>
   <data name="label_finished.Location" type="System.Drawing.Point, System.Drawing">
-    <value>30, 35</value>
+    <value>57, 23</value>
   </data>
   <data name="label_finished.Size" type="System.Drawing.Size, System.Drawing">
     <value>107, 12</value>
     <value>$this</value>
   </data>
   <data name="&gt;&gt;label_finished.ZOrder" xml:space="preserve">
+    <value>1</value>
+  </data>
+  <data name="pictureBox_OKIcon.Location" type="System.Drawing.Point, System.Drawing">
+    <value>11, 12</value>
+  </data>
+  <data name="pictureBox_OKIcon.Size" type="System.Drawing.Size, System.Drawing">
+    <value>40, 46</value>
+  </data>
+  <data name="pictureBox_OKIcon.TabIndex" type="System.Int32, mscorlib">
+    <value>2</value>
+  </data>
+  <data name="&gt;&gt;pictureBox_OKIcon.Name" xml:space="preserve">
+    <value>pictureBox_OKIcon</value>
+  </data>
+  <data name="&gt;&gt;pictureBox_OKIcon.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;pictureBox_OKIcon.Parent" xml:space="preserve">
+    <value>$this</value>
+  </data>
+  <data name="&gt;&gt;pictureBox_OKIcon.ZOrder" xml:space="preserve">
     <value>0</value>
   </data>
   <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>6, 12</value>
   </data>
   <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
-    <value>167, 120</value>
+    <value>186, 92</value>
   </data>
-  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
   <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
     <value>CenterParent</value>
   </data>
     <value>録音終了</value>
   </data>
   <data name="&gt;&gt;$this.Name" xml:space="preserve">
-    <value>Form_FInished</value>
+    <value>Form_Finished_OK</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>
diff --git a/DTX2WAV/Form_Finished_Fail.Designer.cs b/DTX2WAV/Form_Finished_Fail.Designer.cs
new file mode 100644 (file)
index 0000000..394792d
--- /dev/null
@@ -0,0 +1,92 @@
+namespace DTX2WAV
+{
+       partial class Form_Finished_Fail
+       {
+               /// <summary>
+               /// Required designer variable.
+               /// </summary>
+               private System.ComponentModel.IContainer components = null;
+
+               /// <summary>
+               /// Clean up any resources being used.
+               /// </summary>
+               /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+               protected override void Dispose(bool disposing)
+               {
+                       if (disposing && (components != null))
+                       {
+                               components.Dispose();
+                       }
+                       base.Dispose(disposing);
+               }
+
+               #region Windows Form Designer generated code
+
+               /// <summary>
+               /// Required method for Designer support - do not modify
+               /// the contents of this method with the code editor.
+               /// </summary>
+               private void InitializeComponent()
+               {
+                       this.label_Canceled = new System.Windows.Forms.Label();
+                       this.button_OK = new System.Windows.Forms.Button();
+                       this.pictureBox_FailIcon = new System.Windows.Forms.PictureBox();
+                       ((System.ComponentModel.ISupportInitialize)(this.pictureBox_FailIcon)).BeginInit();
+                       this.SuspendLayout();
+                       // 
+                       // label_Canceled
+                       // 
+                       this.label_Canceled.AutoSize = true;
+                       this.label_Canceled.Location = new System.Drawing.Point(57, 23);
+                       this.label_Canceled.Name = "label_Canceled";
+                       this.label_Canceled.Size = new System.Drawing.Size(117, 12);
+                       this.label_Canceled.TabIndex = 0;
+                       this.label_Canceled.Text = "録音が中止されました。";
+                       // 
+                       // button_OK
+                       // 
+                       this.button_OK.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
+                       this.button_OK.Location = new System.Drawing.Point(59, 56);
+                       this.button_OK.Name = "button_OK";
+                       this.button_OK.Size = new System.Drawing.Size(75, 23);
+                       this.button_OK.TabIndex = 1;
+                       this.button_OK.Text = "OK";
+                       this.button_OK.UseVisualStyleBackColor = true;
+                       this.button_OK.Click += new System.EventHandler(this.button_OK_Click);
+                       // 
+                       // pictureBox_FailIcon
+                       // 
+                       this.pictureBox_FailIcon.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+                       this.pictureBox_FailIcon.Location = new System.Drawing.Point(12, 12);
+                       this.pictureBox_FailIcon.Name = "pictureBox_FailIcon";
+                       this.pictureBox_FailIcon.Size = new System.Drawing.Size(40, 46);
+                       this.pictureBox_FailIcon.TabIndex = 3;
+                       this.pictureBox_FailIcon.TabStop = false;
+                       // 
+                       // Form_Finished_Fail
+                       // 
+                       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+                       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+                       this.ClientSize = new System.Drawing.Size(192, 91);
+                       this.ControlBox = false;
+                       this.Controls.Add(this.pictureBox_FailIcon);
+                       this.Controls.Add(this.button_OK);
+                       this.Controls.Add(this.label_Canceled);
+                       this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+                       this.Name = "Form_Finished_Fail";
+                       this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+                       this.Text = "録音中断";
+                       this.Shown += new System.EventHandler(this.Form_Finished_Fail_Shown);
+                       ((System.ComponentModel.ISupportInitialize)(this.pictureBox_FailIcon)).EndInit();
+                       this.ResumeLayout(false);
+                       this.PerformLayout();
+
+               }
+
+               #endregion
+
+               private System.Windows.Forms.Label label_Canceled;
+               private System.Windows.Forms.Button button_OK;
+               private System.Windows.Forms.PictureBox pictureBox_FailIcon;
+       }
+}
\ No newline at end of file
diff --git a/DTX2WAV/Form_Finished_Fail.cs b/DTX2WAV/Form_Finished_Fail.cs
new file mode 100644 (file)
index 0000000..b68ad18
--- /dev/null
@@ -0,0 +1,35 @@
+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;
+
+namespace DTX2WAV
+{
+       public partial class Form_Finished_Fail : Form
+       {
+               public Form_Finished_Fail()
+               {
+                       InitializeComponent();
+               }
+
+               private void button_OK_Click(object sender, EventArgs e)
+               {
+                       this.Close();
+               }
+
+               private void Form_Finished_Fail_Shown(object sender, EventArgs e)
+               {
+                       Bitmap canvas = new Bitmap(pictureBox_FailIcon.Width, pictureBox_FailIcon.Height);
+                       Graphics g = Graphics.FromImage(canvas);
+
+                       g.DrawIcon(SystemIcons.Warning, 0, 0);
+                       g.Dispose();
+                       pictureBox_FailIcon.Image = canvas;
+               }
+       }
+}
diff --git a/DTX2WAV/Form_Finished_Fail.resx b/DTX2WAV/Form_Finished_Fail.resx
new file mode 100644 (file)
index 0000000..1af7de1
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file
index b44846c..6907c88 100644 (file)
@@ -80,7 +80,6 @@ namespace DTX2WAV
                                        string[] s = label_state.Text.Split(new char[] { ',' });
                                        int nEstimateTimeMs = Convert.ToInt32(s[2]);
                                        int nCurrentTimeMs = Convert.ToInt32(s[1]);
-//Debug.WriteLine(label_state.Text + ": " + nCurrentTimeMs + " : " + nEstimateTimeMs);
 
                                        if (nCurrentTimeMs > nEstimateTimeMs)
                                        {
@@ -88,7 +87,6 @@ namespace DTX2WAV
                                        }
                                        progressBar_Recording.Value = (int)(((double)nCurrentTimeMs / (double)nEstimateTimeMs) * 10000);
 
-                                       //int nEstimateTimeMs = (CDTXMania.Instance.DTX.listChip.Count > 0) ? CDTXMania.Instance.DTX.listChip[CDTXMania.Instance.DTX.listChip.Count - 1].n発声時刻ms : 0;
                                        string strEstimateTime = (((double)nEstimateTimeMs) / 1000.0).ToString("####0.00");
                                        string strCurrentTime = (((double)nCurrentTimeMs) / 1000.0).ToString("####0.00");
 
index ba49113..7690602 100644 (file)
@@ -1262,8 +1262,11 @@ namespace DTXMania
                                                        //SendKeys.Send("{ESC}");
                                                        //SendKeys.SendWait("%{F4}");
                                                        //Application.Exit();
-                                                       DTX.t全チップの再生停止();
-                                                       DTX.On非活性化();
+                                                       if (DTX != null)        // 曲読み込みの前に録音Cancelされると、DTXがnullのままここにきてでGPFとなる→nullチェック追加
+                                                       {
+                                                               DTX.t全チップの再生停止();
+                                                               DTX.On非活性化();
+                                                       }
                                                        r現在のステージ.On非活性化();
 
                                                        //Environment.ExitCode = 10010;         // この組み合わせではダメ、返り値が反映されない