Added right-click-save-image-as in 'set un-italic factor' (in ocr)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1611 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2013-02-07 20:50:52 +00:00
parent b7fa10a68e
commit 561150b8bc
4 changed files with 73 additions and 2 deletions

View File

@ -13,8 +13,9 @@
* Updated Czech language file - thx Trottel
* Updated German language file - thx Christoph Kitsche
* FIXED:
* Possible crash in 'Fix common errors' on selected lines - thx Dan
* Possible crash+bug in 'Fix common errors' on selected lines - thx Dan
* Drag'n'drop of large bluray sup files - thx AT
* Minor fix in 'Fix common errors -> Fix invalid italic tags' - thx azu
3.3.1 (3rd February 2013)

View File

@ -28,13 +28,18 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonOK = new System.Windows.Forms.Button();
this.pictureBoxSubtitleImage = new System.Windows.Forms.PictureBox();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.contextMenuStripListview = new System.Windows.Forms.ContextMenuStrip(this.components);
this.saveImageAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSubtitleImage)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.contextMenuStripListview.SuspendLayout();
this.SuspendLayout();
//
// buttonCancel
@ -66,6 +71,7 @@
this.pictureBoxSubtitleImage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBoxSubtitleImage.ContextMenuStrip = this.contextMenuStripListview;
this.pictureBoxSubtitleImage.Location = new System.Drawing.Point(12, 47);
this.pictureBoxSubtitleImage.Name = "pictureBoxSubtitleImage";
this.pictureBoxSubtitleImage.Size = new System.Drawing.Size(743, 259);
@ -106,6 +112,20 @@
this.label1.TabIndex = 11;
this.label1.Text = "Adjust value until text style is normal and not italic. Note that original image " +
"should be italic.";
//
// contextMenuStripListview
//
this.contextMenuStripListview.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.saveImageAsToolStripMenuItem});
this.contextMenuStripListview.Name = "contextMenuStripListview";
this.contextMenuStripListview.Size = new System.Drawing.Size(158, 48);
//
// saveImageAsToolStripMenuItem
//
this.saveImageAsToolStripMenuItem.Name = "saveImageAsToolStripMenuItem";
this.saveImageAsToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.saveImageAsToolStripMenuItem.Text = "Save image as...";
this.saveImageAsToolStripMenuItem.Click += new System.EventHandler(this.saveImageAsToolStripMenuItem_Click);
//
// VobSubOcrSetItalicFactor
//
@ -124,10 +144,11 @@
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Set de-italic factor";
this.Text = "Set un-italic factor";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.VobSubOcrSetItalicFactor_KeyDown);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSubtitleImage)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.contextMenuStripListview.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -140,5 +161,8 @@
private System.Windows.Forms.PictureBox pictureBoxSubtitleImage;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private System.Windows.Forms.ContextMenuStrip contextMenuStripListview;
private System.Windows.Forms.ToolStripMenuItem saveImageAsToolStripMenuItem;
}
}

View File

@ -1,6 +1,7 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using Nikse.SubtitleEdit.Logic;
namespace Nikse.SubtitleEdit.Forms
{
@ -16,6 +17,8 @@ namespace Nikse.SubtitleEdit.Forms
_bmp = bmp;
_factor = factor;
numericUpDown1.Value = (decimal)factor;
saveImageAsToolStripMenuItem.Text = Configuration.Settings.Language.VobSubOcr.SaveSubtitleImageAs;
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
@ -44,5 +47,42 @@ namespace Nikse.SubtitleEdit.Forms
if (e.KeyCode == Keys.Escape)
DialogResult = DialogResult.Cancel;
}
private void saveImageAsToolStripMenuItem_Click(object sender, EventArgs e)
{
saveFileDialog1.Title = Configuration.Settings.Language.VobSubOcr.SaveSubtitleImageAs;
saveFileDialog1.AddExtension = true;
saveFileDialog1.FileName = "ImageUnItalic";
saveFileDialog1.Filter = "PNG image|*.png|BMP image|*.bmp|GIF image|*.gif|TIFF image|*.tiff";
saveFileDialog1.FilterIndex = 0;
DialogResult result = saveFileDialog1.ShowDialog(this);
if (result == DialogResult.OK)
{
Bitmap bmp = (Bitmap) pictureBoxSubtitleImage.Image;
if (bmp == null)
{
MessageBox.Show("No image!");
return;
}
try
{
if (saveFileDialog1.FilterIndex == 0)
bmp.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png);
else if (saveFileDialog1.FilterIndex == 1)
bmp.Save(saveFileDialog1.FileName);
else if (saveFileDialog1.FilterIndex == 2)
bmp.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Gif);
else
bmp.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Tiff);
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
}
}
}
}

View File

@ -117,4 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStripListview.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>467, 17</value>
</metadata>
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>331, 17</value>
</metadata>
</root>