Undocked video windows: Better title text + updates title when changing video file + uses SE main icon + works better with VLC

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@436 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-06-02 08:37:42 +00:00
parent a813ad2b93
commit 63bb06beff
10 changed files with 59 additions and 29 deletions

View File

@ -1575,7 +1575,7 @@
this.fixCommonErrorsInSelectedLinesToolStripMenuItem, this.fixCommonErrorsInSelectedLinesToolStripMenuItem,
this.changeCasingForSelectedLinesToolStripMenuItem}); this.changeCasingForSelectedLinesToolStripMenuItem});
this.contextMenuStripListview.Name = "contextMenuStripListview"; this.contextMenuStripListview.Name = "contextMenuStripListview";
this.contextMenuStripListview.Size = new System.Drawing.Size(285, 628); this.contextMenuStripListview.Size = new System.Drawing.Size(285, 606);
this.contextMenuStripListview.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListviewOpening); this.contextMenuStripListview.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListviewOpening);
// //
// toolStripMenuItemDelete // toolStripMenuItemDelete

View File

@ -1378,14 +1378,7 @@ namespace Nikse.SubtitleEdit.Forms
_change = false; _change = false;
_converted = false; _converted = false;
if (_videoControlsUnDocked != null && !_videoControlsUnDocked.IsDisposed) SetUndockedWindowsTitle();
_videoControlsUnDocked.Text = fileName;
if (_videoPlayerUnDocked != null && !_videoPlayerUnDocked.IsDisposed)
_videoPlayerUnDocked.Text = fileName;
if (_waveFormUnDocked != null && !_waveFormUnDocked.IsDisposed)
_waveFormUnDocked.Text = fileName;
if (justConverted) if (justConverted)
{ {
@ -1449,6 +1442,28 @@ namespace Nikse.SubtitleEdit.Forms
} }
} }
private void SetUndockedWindowsTitle()
{
string title = Configuration.Settings.Language.General.NoVideoLoaded;
if (!string.IsNullOrEmpty(_videoFileName))
title = Path.GetFileNameWithoutExtension(_videoFileName);
try //TODO: Remove in 3.2 final
{
if (_videoControlsUnDocked != null && !_videoControlsUnDocked.IsDisposed)
_videoControlsUnDocked.Text = string.Format(Configuration.Settings.Language.General.ControlsWindowTitle, title);
if (_videoPlayerUnDocked != null && !_videoPlayerUnDocked.IsDisposed)
_videoPlayerUnDocked.Text = string.Format(Configuration.Settings.Language.General.VideoWindowTitle, title);
if (_waveFormUnDocked != null && !_waveFormUnDocked.IsDisposed)
_waveFormUnDocked.Text = string.Format(Configuration.Settings.Language.General.AudioWindowTitle, title);
}
catch
{
}
}
private void ImportAndOcrBdnXml(string fileName, BdnXml bdnXml, List<string> list) private void ImportAndOcrBdnXml(string fileName, BdnXml bdnXml, List<string> list)
{ {
Subtitle bdnSubtitle = new Subtitle(); Subtitle bdnSubtitle = new Subtitle();
@ -1841,15 +1856,7 @@ namespace Nikse.SubtitleEdit.Forms
_change = false; _change = false;
_converted = false; _converted = false;
SetUndockedWindowsTitle();
if (_videoControlsUnDocked != null && !_videoControlsUnDocked.IsDisposed)
_videoControlsUnDocked.Text = string.Empty;
if (_videoPlayerUnDocked != null && !_videoPlayerUnDocked.IsDisposed)
_videoPlayerUnDocked.Text = string.Empty;
if (_waveFormUnDocked != null && !_waveFormUnDocked.IsDisposed)
_waveFormUnDocked.Text = string.Empty;
} }
private void FileNew() private void FileNew()
@ -6955,6 +6962,8 @@ namespace Nikse.SubtitleEdit.Forms
timerWaveForm.Start(); timerWaveForm.Start();
} }
Cursor = Cursors.Default; Cursor = Cursors.Default;
SetUndockedWindowsTitle();
} }
} }
@ -9314,7 +9323,7 @@ namespace Nikse.SubtitleEdit.Forms
private void UnDockVideoPlayer() private void UnDockVideoPlayer()
{ {
_videoPlayerUnDocked = new VideoPlayerUnDocked(this, labelVideoInfo.Text, _formPositionsAndSizes, mediaPlayer); _videoPlayerUnDocked = new VideoPlayerUnDocked(this, _formPositionsAndSizes, mediaPlayer);
_formPositionsAndSizes.SetPositionAndSize(_videoPlayerUnDocked); _formPositionsAndSizes.SetPositionAndSize(_videoPlayerUnDocked);
Control control = null; Control control = null;
@ -9345,7 +9354,7 @@ namespace Nikse.SubtitleEdit.Forms
private void UnDockWaveForm() private void UnDockWaveForm()
{ {
_waveFormUnDocked = new WaveFormUnDocked(this, labelVideoInfo.Text, _formPositionsAndSizes); _waveFormUnDocked = new WaveFormUnDocked(this, _formPositionsAndSizes);
_formPositionsAndSizes.SetPositionAndSize(_waveFormUnDocked); _formPositionsAndSizes.SetPositionAndSize(_waveFormUnDocked);
var control = AudioWaveForm; var control = AudioWaveForm;
@ -9385,7 +9394,7 @@ namespace Nikse.SubtitleEdit.Forms
private void UnDockVideoButtons() private void UnDockVideoButtons()
{ {
_videoControlsUnDocked = new VideoControlsUndocked(this, labelVideoInfo.Text, _formPositionsAndSizes); _videoControlsUnDocked = new VideoControlsUndocked(this, _formPositionsAndSizes);
_formPositionsAndSizes.SetPositionAndSize(_videoControlsUnDocked); _formPositionsAndSizes.SetPositionAndSize(_videoControlsUnDocked);
var control = tabControlButtons; var control = tabControlButtons;
groupBoxVideo.Controls.Remove(control); groupBoxVideo.Controls.Remove(control);
@ -9429,11 +9438,13 @@ namespace Nikse.SubtitleEdit.Forms
_videoControlsUnDocked.Show(this); _videoControlsUnDocked.Show(this);
_isVideoControlsUnDocked = true; _isVideoControlsUnDocked = true;
SetUndockedWindowsTitle();
undockVideoControlsToolStripMenuItem.Visible = false; undockVideoControlsToolStripMenuItem.Visible = false;
redockVideoControlsToolStripMenuItem.Visible = true; redockVideoControlsToolStripMenuItem.Visible = true;
tabControl1_SelectedIndexChanged(null, null); tabControl1_SelectedIndexChanged(null, null);
} }
private void redockVideoControlsToolStripMenuItem_Click(object sender, EventArgs e) private void redockVideoControlsToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -577,6 +577,9 @@
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>208, 56</value> <value>208, 56</value>
</metadata> </metadata>
<metadata name="toolStripWaveControls.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>208, 56</value>
</metadata>
<data name="toolStripButtonWaveFormZoomOut.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="toolStripButtonWaveFormZoomOut.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -684,7 +687,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD2
CAAAAk1TRnQBSQFMAgEBAgEAAZgBBQGYAQUBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo CAAAAk1TRnQBSQFMAgEBAgEAAagBBQGoAQUBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -46,7 +46,6 @@
this.ClientSize = new System.Drawing.Size(458, 311); this.ClientSize = new System.Drawing.Size(458, 311);
this.Controls.Add(this.panelContainer); this.Controls.Add(this.panelContainer);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.MaximizeBox = false;
this.Name = "VideoControlsUndocked"; this.Name = "VideoControlsUndocked";
this.Text = "VideoControlsUndocked"; this.Text = "VideoControlsUndocked";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.VideoControlsUndocked_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.VideoControlsUndocked_FormClosing);

View File

@ -22,12 +22,12 @@ namespace Nikse.SubtitleEdit.Forms
} }
} }
public VideoControlsUndocked(Main mainForm, string title, PositionsAndSizes positionsAndSizes) public VideoControlsUndocked(Main mainForm, PositionsAndSizes positionsAndSizes)
{ {
InitializeComponent(); InitializeComponent();
_mainForm = mainForm; _mainForm = mainForm;
this.Icon = (Icon)mainForm.Icon.Clone();
_positionsAndSizes = positionsAndSizes; _positionsAndSizes = positionsAndSizes;
Text = title;
} }
public VideoControlsUndocked() public VideoControlsUndocked()

View File

@ -1,5 +1,6 @@
using System.Windows.Forms; using System.Windows.Forms;
using Nikse.SubtitleEdit.Logic; using Nikse.SubtitleEdit.Logic;
using System.Drawing;
namespace Nikse.SubtitleEdit.Forms namespace Nikse.SubtitleEdit.Forms
{ {
@ -17,13 +18,13 @@ namespace Nikse.SubtitleEdit.Forms
} }
} }
public VideoPlayerUnDocked(Main main, string title, PositionsAndSizes positionsAndSizes, Controls.VideoPlayerContainer videoPlayerContainer) public VideoPlayerUnDocked(Main main, PositionsAndSizes positionsAndSizes, Controls.VideoPlayerContainer videoPlayerContainer)
{ {
InitializeComponent(); InitializeComponent();
_mainForm = main; _mainForm = main;
this.Icon = (Icon)_mainForm.Icon.Clone();
_positionsAndSizes = positionsAndSizes; _positionsAndSizes = positionsAndSizes;
_videoPlayerContainer = videoPlayerContainer; _videoPlayerContainer = videoPlayerContainer;
Text = title;
} }
public VideoPlayerUnDocked() public VideoPlayerUnDocked()

View File

@ -22,12 +22,12 @@ namespace Nikse.SubtitleEdit.Forms
} }
} }
public WaveFormUnDocked(Main mainForm, string title, PositionsAndSizes positionsAndSizes) public WaveFormUnDocked(Main mainForm, PositionsAndSizes positionsAndSizes)
{ {
InitializeComponent(); InitializeComponent();
_mainForm = mainForm; _mainForm = mainForm;
this.Icon = (Icon)mainForm.Icon.Clone();
_positionsAndSizes = positionsAndSizes; _positionsAndSizes = positionsAndSizes;
Text = title;
} }
public WaveFormUnDocked() public WaveFormUnDocked()

View File

@ -127,6 +127,9 @@ namespace Nikse.SubtitleEdit.Logic
UserNameAlreadyInUse = "Username already in use", UserNameAlreadyInUse = "Username already in use",
WebServiceUrl = "Webservice url", WebServiceUrl = "Webservice url",
IP = "IP", IP = "IP",
VideoWindowTitle = "Video - {0}",
AudioWindowTitle = "Audio - {0}",
ControlsWindowTitle = "Controls - {0}",
}; };
About = new LanguageStructure.About About = new LanguageStructure.About

View File

@ -61,6 +61,9 @@
public string UserNameAlreadyInUse { get; set; } public string UserNameAlreadyInUse { get; set; }
public string WebServiceUrl { get; set; } public string WebServiceUrl { get; set; }
public string IP { get; set; } public string IP { get; set; }
public string VideoWindowTitle { get; set; }
public string AudioWindowTitle { get; set; }
public string ControlsWindowTitle { get; set; }
} }
public class About public class About

View File

@ -485,8 +485,18 @@ namespace Nikse.SubtitleEdit.Logic.VideoPlayers
_mediaPlayer = _libvlc_media_player_new_from_media(media); _mediaPlayer = _libvlc_media_player_new_from_media(media);
_libvlc_media_release(media); _libvlc_media_release(media);
// Linux: libvlc_media_player_set_xdrawable (_mediaPlayer, xdrawable); // Linux: libvlc_media_player_set_xdrawable (_mediaPlayer, xdrawable);
// Mac: libvlc_media_player_set_nsobject (_mediaPlayer, view); // Mac: libvlc_media_player_set_nsobject (_mediaPlayer, view);
_libvlc_media_player_set_hwnd(_mediaPlayer, ownerControl.Handle); // windows
//hack: sometimes vlc opens in it's own windows - this code seems to prevent this
for (int j = 0; j < 50; j++)
{
System.Threading.Thread.Sleep(10);
System.Windows.Forms.Application.DoEvents();
}
_libvlc_media_player_set_hwnd(_mediaPlayer, ownerControl.Handle); // windows _libvlc_media_player_set_hwnd(_mediaPlayer, ownerControl.Handle); // windows
if (onVideoEnded != null) if (onVideoEnded != null)