CUETools: use standard textBox control for offset, because

numericUpAndDown glitches with large fonts.
This commit is contained in:
Grigory Chudov
2013-10-14 17:04:46 -04:00
parent 132bd9a6f7
commit 1aeed2e7a8
4 changed files with 1407 additions and 872 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

View File

@@ -97,7 +97,6 @@ namespace JDP {
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.labelPregap = new System.Windows.Forms.Label(); this.labelPregap = new System.Windows.Forms.Label();
this.lblWriteOffset = new System.Windows.Forms.Label(); this.lblWriteOffset = new System.Windows.Forms.Label();
this.numericWriteOffset = new System.Windows.Forms.NumericUpDown();
this.txtPreGapLength = new System.Windows.Forms.MaskedTextBox(); this.txtPreGapLength = new System.Windows.Forms.MaskedTextBox();
this.labelDataTrack = new System.Windows.Forms.Label(); this.labelDataTrack = new System.Windows.Forms.Label();
this.txtDataTrackLength = new System.Windows.Forms.MaskedTextBox(); this.txtDataTrackLength = new System.Windows.Forms.MaskedTextBox();
@@ -129,6 +128,7 @@ namespace JDP {
this.updateLocalDatabaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.updateLocalDatabaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.locateInExplorerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.locateInExplorerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.backgroundWorkerAddToLocalDB = new System.ComponentModel.BackgroundWorker(); this.backgroundWorkerAddToLocalDB = new System.ComponentModel.BackgroundWorker();
this.textBoxOffset = new System.Windows.Forms.TextBox();
this.toolStripContainer1.BottomToolStripPanel.SuspendLayout(); this.toolStripContainer1.BottomToolStripPanel.SuspendLayout();
this.toolStripContainer1.ContentPanel.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout();
this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
@@ -151,7 +151,6 @@ namespace JDP {
this.grpAction.SuspendLayout(); this.grpAction.SuspendLayout();
this.grpExtra.SuspendLayout(); this.grpExtra.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericWriteOffset)).BeginInit();
this.panelGo.SuspendLayout(); this.panelGo.SuspendLayout();
this.toolStripMenu.SuspendLayout(); this.toolStripMenu.SuspendLayout();
this.contextMenuStripFileTree.SuspendLayout(); this.contextMenuStripFileTree.SuspendLayout();
@@ -793,10 +792,10 @@ namespace JDP {
resources.ApplyResources(this.tableLayoutPanel4, "tableLayoutPanel4"); resources.ApplyResources(this.tableLayoutPanel4, "tableLayoutPanel4");
this.tableLayoutPanel4.Controls.Add(this.labelPregap, 0, 0); this.tableLayoutPanel4.Controls.Add(this.labelPregap, 0, 0);
this.tableLayoutPanel4.Controls.Add(this.lblWriteOffset, 0, 2); this.tableLayoutPanel4.Controls.Add(this.lblWriteOffset, 0, 2);
this.tableLayoutPanel4.Controls.Add(this.numericWriteOffset, 1, 2);
this.tableLayoutPanel4.Controls.Add(this.txtPreGapLength, 1, 0); this.tableLayoutPanel4.Controls.Add(this.txtPreGapLength, 1, 0);
this.tableLayoutPanel4.Controls.Add(this.labelDataTrack, 0, 1); this.tableLayoutPanel4.Controls.Add(this.labelDataTrack, 0, 1);
this.tableLayoutPanel4.Controls.Add(this.txtDataTrackLength, 1, 1); this.tableLayoutPanel4.Controls.Add(this.txtDataTrackLength, 1, 1);
this.tableLayoutPanel4.Controls.Add(this.textBoxOffset, 1, 2);
this.tableLayoutPanel4.Name = "tableLayoutPanel4"; this.tableLayoutPanel4.Name = "tableLayoutPanel4";
// //
// labelPregap // labelPregap
@@ -809,22 +808,6 @@ namespace JDP {
resources.ApplyResources(this.lblWriteOffset, "lblWriteOffset"); resources.ApplyResources(this.lblWriteOffset, "lblWriteOffset");
this.lblWriteOffset.Name = "lblWriteOffset"; this.lblWriteOffset.Name = "lblWriteOffset";
// //
// numericWriteOffset
//
resources.ApplyResources(this.numericWriteOffset, "numericWriteOffset");
this.numericWriteOffset.Maximum = new decimal(new int[] {
99999,
0,
0,
0});
this.numericWriteOffset.Minimum = new decimal(new int[] {
99999,
0,
0,
-2147483648});
this.numericWriteOffset.Name = "numericWriteOffset";
this.toolTip1.SetToolTip(this.numericWriteOffset, resources.GetString("numericWriteOffset.ToolTip"));
//
// txtPreGapLength // txtPreGapLength
// //
this.txtPreGapLength.Culture = new System.Globalization.CultureInfo(""); this.txtPreGapLength.Culture = new System.Globalization.CultureInfo("");
@@ -1059,6 +1042,13 @@ namespace JDP {
this.backgroundWorkerAddToLocalDB.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorkerAddToLocalDB_DoWork); this.backgroundWorkerAddToLocalDB.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorkerAddToLocalDB_DoWork);
this.backgroundWorkerAddToLocalDB.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorkerAddToLocalDB_RunWorkerCompleted); this.backgroundWorkerAddToLocalDB.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorkerAddToLocalDB_RunWorkerCompleted);
// //
// textBoxOffset
//
resources.ApplyResources(this.textBoxOffset, "textBoxOffset");
this.textBoxOffset.Name = "textBoxOffset";
this.textBoxOffset.TextChanged += new System.EventHandler(this.textBoxOffset_TextChanged);
this.textBoxOffset.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxOffset_KeyPress);
//
// frmCUETools // frmCUETools
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");
@@ -1103,7 +1093,6 @@ namespace JDP {
this.grpExtra.ResumeLayout(false); this.grpExtra.ResumeLayout(false);
this.tableLayoutPanel4.ResumeLayout(false); this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel4.PerformLayout(); this.tableLayoutPanel4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericWriteOffset)).EndInit();
this.panelGo.ResumeLayout(false); this.panelGo.ResumeLayout(false);
this.toolStripMenu.ResumeLayout(false); this.toolStripMenu.ResumeLayout(false);
this.toolStripMenu.PerformLayout(); this.toolStripMenu.PerformLayout();
@@ -1141,8 +1130,7 @@ namespace JDP {
private System.Windows.Forms.ToolStripMenuItem setAsMyMusicFolderToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem setAsMyMusicFolderToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem SelectedNodeName; private System.Windows.Forms.ToolStripMenuItem SelectedNodeName;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem resetToOriginalLocationToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem resetToOriginalLocationToolStripMenuItem;
private System.Windows.Forms.NumericUpDown numericWriteOffset;
private System.Windows.Forms.Label lblWriteOffset; private System.Windows.Forms.Label lblWriteOffset;
private System.Windows.Forms.TextBox textBatchReport; private System.Windows.Forms.TextBox textBatchReport;
private System.Windows.Forms.ComboBox comboBoxAudioFormat; private System.Windows.Forms.ComboBox comboBoxAudioFormat;
@@ -1218,6 +1206,7 @@ namespace JDP {
private System.Windows.Forms.ToolStripMenuItem updateLocalDatabaseToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem updateLocalDatabaseToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem locateInExplorerToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem locateInExplorerToolStripMenuItem;
private System.Windows.Forms.Button buttonEncoderSettings; private System.Windows.Forms.Button buttonEncoderSettings;
private System.Windows.Forms.TextBox textBoxOffset;
} }
} }

View File

@@ -491,7 +491,7 @@ namespace JDP
cueSheet.PasswordRequired += new EventHandler<CompressionPasswordRequiredEventArgs>(PasswordRequired); cueSheet.PasswordRequired += new EventHandler<CompressionPasswordRequiredEventArgs>(PasswordRequired);
cueSheet.CUEToolsProgress += new EventHandler<CUEToolsProgressEventArgs>(SetStatus); cueSheet.CUEToolsProgress += new EventHandler<CUEToolsProgressEventArgs>(SetStatus);
cueSheet.CUEToolsSelection += new EventHandler<CUEToolsSelectionEventArgs>(MakeSelection); cueSheet.CUEToolsSelection += new EventHandler<CUEToolsSelectionEventArgs>(MakeSelection);
cueSheet.WriteOffset = (int)numericWriteOffset.Value; cueSheet.WriteOffset = Int32.Parse(textBoxOffset.Text);
object[] p = new object[7]; object[] p = new object[7];
@@ -1323,7 +1323,7 @@ namespace JDP
private bool CheckWriteOffset() private bool CheckWriteOffset()
{ {
if (!rbActionEncode.Checked || SelectedOutputAudioType == AudioEncoderType.NoAudio || numericWriteOffset.Value == 0) if (!rbActionEncode.Checked || SelectedOutputAudioType == AudioEncoderType.NoAudio || 0 == Int32.Parse(textBoxOffset.Text))
{ {
return true; return true;
} }
@@ -1341,7 +1341,7 @@ namespace JDP
SelectedOutputAudioFormat = _profile._outputAudioFormat; SelectedOutputAudioFormat = _profile._outputAudioFormat;
SelectedAction = _profile._action; SelectedAction = _profile._action;
SelectedCUEStyle = _profile._CUEStyle; SelectedCUEStyle = _profile._CUEStyle;
numericWriteOffset.Value = _profile._writeOffset; textBoxOffset.Text = _profile._writeOffset.ToString();
comboBoxOutputFormat.Text = _profile._outputTemplate ?? comboBoxOutputFormat.Items[0].ToString(); comboBoxOutputFormat.Text = _profile._outputTemplate ?? comboBoxOutputFormat.Items[0].ToString();
toolStripDropDownButtonProfile.Text = _profile._name; toolStripDropDownButtonProfile.Text = _profile._name;
SelectedScript = _profile._script; SelectedScript = _profile._script;
@@ -1388,7 +1388,7 @@ namespace JDP
_profile._outputAudioFormat = SelectedOutputAudioFormat; _profile._outputAudioFormat = SelectedOutputAudioFormat;
_profile._action = SelectedAction; _profile._action = SelectedAction;
_profile._CUEStyle = SelectedCUEStyle; _profile._CUEStyle = SelectedCUEStyle;
_profile._writeOffset = (int)numericWriteOffset.Value; _profile._writeOffset = Int32.Parse(textBoxOffset.Text);
_profile._outputTemplate = comboBoxOutputFormat.Text; _profile._outputTemplate = comboBoxOutputFormat.Text;
_profile._script = SelectedScript; _profile._script = SelectedScript;
_profile._editTags = checkBoxEditTags.Checked; _profile._editTags = checkBoxEditTags.Checked;
@@ -2723,5 +2723,35 @@ namespace JDP
} }
SelectedOutputAudioType = SelectedOutputAudioType; SelectedOutputAudioType = SelectedOutputAudioType;
} }
private void textBoxOffset_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar)
&& !char.IsDigit(e.KeyChar)
&& e.KeyChar != '-')
{
e.Handled = true;
}
base.OnKeyPress(e);
}
private void textBoxOffset_TextChanged(object sender, EventArgs e)
{
int res;
var sb = new StringBuilder();
foreach (var c in textBoxOffset.Text.ToCharArray())
if (char.IsDigit(c) || (c == '-' && sb.Length == 0))
sb.Append(c);
if (textBoxOffset.Text != sb.ToString())
textBoxOffset.Text = sb.ToString();
if (!int.TryParse(textBoxOffset.Text, out res))
textBoxOffset.Text = "0";
else
{
res = Math.Max(-9999,Math.Min(res, 9999));
if (textBoxOffset.Text != res.ToString() && textBoxOffset.Text != "-0")
textBoxOffset.Text = res.ToString();
}
}
} }
} }

File diff suppressed because it is too large Load Diff