[gnome-subtitles] Fix Bug#605402 and Bug#453220 Misses put the menu sensitive code in the correct place



commit 125fb06b58c8904b4d11301cf2f5de30f3a871bc
Author: Valmir Sena <valmirse gmail com>
Date:   Thu Jun 10 15:23:35 2010 -0300

    Fix Bug#605402 and Bug#453220 Misses put the menu sensitive code in the correct place

 gnome-subtitles.mdp                                |  474 ++++++++++----------
 src/Glade/MainWindow.glade                         |   37 ++-
 src/GnomeSubtitles/Core/EventHandlers.cs           |   10 +-
 src/GnomeSubtitles/Ui/Menus.cs                     |    4 +
 .../Ui/VideoPreview/SubtitleOverlay.cs             |   51 +--
 .../Ui/VideoPreview/SubtitleTracker.cs             |  114 +++++
 src/GnomeSubtitles/Ui/VideoPreview/Video.cs        |   13 +
 src/GnomeSubtitles/Ui/View/SubtitleSelection.cs    |    8 +
 src/GnomeSubtitles/Ui/View/SubtitleView.cs         |   12 +
 src/GnomeSubtitles/Ui/WidgetNames.cs               |    2 +
 src/SubLib/Core/Search/SearchOperator.cs           |   34 ++-
 11 files changed, 470 insertions(+), 289 deletions(-)
---
diff --git a/gnome-subtitles.mdp b/gnome-subtitles.mdp
index 01d141b..3daad3f 100644
--- a/gnome-subtitles.mdp
+++ b/gnome-subtitles.mdp
@@ -1,253 +1,253 @@
-<Project name="gnome-subtitles" fileversion="2.0" language="C#" clr-version="Net_2_0" targetFramework="2.0" ctype="DotNetProject">
+<Project name="gnome-subtitles" fileversion="2.0" DefaultNamespace="gnomesubtitles" language="C#" clr-version="Net_2_0" targetFramework="2.0" ctype="DotNetProject">
   <Policies>
-    <TextStylePolicy FileWidth="120" TabWidth="4" TabsToSpaces="False" NoTabsAfterNonTabs="False" RemoveTrailingWhitespace="True" EolMarker="Unix" />
+    <TextStylePolicy FileWidth="120" TabWidth="4" RemoveTrailingWhitespace="True" EolMarker="Unix" inheritsSet="Mono" inheritsScope="text/plain" />
   </Policies>
   <Configurations active="Debug">
     <Configuration name="Debug" ctype="DotNetProjectConfiguration">
-      <Output directory="build" assemblyKeyFile="/home/noup/Workspace/gnome-subtitles/." assembly="gnome-subtitles" />
+      <Output directory="build" assembly="gnome-subtitles" assemblyKeyFile="/home/noup/Workspace/gnome-subtitles/." />
       <Build debugmode="True" target="WinExe" />
-      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
-      <EnvironmentVariables />
+      <Execution consolepause="True" runwithwarnings="True" runtime="MsNet" clr-version="Net_2_0" />
       <CodeGeneration compiler="Mcs" warninglevel="3" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
     </Configuration>
     <Configuration name="Release" ctype="DotNetProjectConfiguration">
       <Output directory="build" assembly="gnome-subtitles" />
       <Build debugmode="False" target="WinExe" />
-      <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
+      <Execution consolepause="True" runwithwarnings="True" runtime="MsNet" clr-version="Net_2_0" />
       <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
     </Configuration>
   </Configurations>
   <Contents>
-    <File name="data" subtype="Directory" buildaction="Compile" />
-    <File name="src" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Execution" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Edit" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/VideoPreview" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/VideoPreview/Exceptions" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/View" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Execution/Executable.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Execution/ExecutionContext.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/AboutDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/GladeDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/HeadersDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/SearchDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="data/gnome-subtitles.png" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="data/gnome-subtitles-logo.png" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/GnomeSubtitles/Dialog/TimingsAdjustDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/FileOpenDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/TimingsShiftDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/VideoOpenDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="data/video-set-subtitle-start-16x.png" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="data/video-set-subtitle-end-16x.png" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="data/video-set-subtitle-start-end-30x.png" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/GnomeSubtitles/Dialog/PreferencesDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/EncodingsDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Execution/BugReporter.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/FilePropertiesDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Config.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Base.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Util.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/Dialogs.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/FileTranslationOpenDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/Glade/AboutDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/Glade/EncodingsDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/Glade/FileOpenDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/Glade/FilePropertiesDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/Glade/FileSaveAsDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/Glade/HeadersDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/Glade/MainWindow.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/Glade/PreferencesDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/Glade/SearchDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/Glade/TimingsAdjustDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/Glade/TimingsShiftDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/Glade/VideoOpenDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/GnomeSubtitles/Dialog/SetLanguageDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/Glade/SetLanguageDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/GnomeSubtitles/Execution/gnome-subtitles.exe.config" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/GnomeSubtitles/Ui/Menus.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Status.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/WidgetNames.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/EncodingDescription.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Encodings.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/SpellLanguage.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/SpellLanguages.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Document.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Clipboards.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Search.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/MainUi.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/EventHandlers.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/AdjustTimingsCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/BaseCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/ChangeFrameRateCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/ChangeStyleCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/ChangeTimingCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/CommandActivatedArgs.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/CommandActivatedHandler.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/CommandManager.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/CommandTarget.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/DeleteSubtitlesCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/DeleteTextCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/DeleteTextContentCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/DeleteTranslationCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/FixedMultipleSelectionCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/FixedSingleSelectionCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/InsertSubtitleCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/InsertTextCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/InsertTextContentCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/InsertTranslationCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/MultipleSelectionCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/ReplaceAllCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/ShiftTimingsCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/SingleSelectionCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/VideoSetSubtitleTimingCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Edit/SubtitleEdit.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Edit/SubtitleEditSpinButtons.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Edit/SubtitleEditText.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Edit/SubtitleEditTextView.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Edit/SubtitleEditTranslation.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/VideoPreview/Player.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/VideoPreview/PlayerPositionWatcher.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/VideoPreview/Video.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/VideoPreview/VideoFiles.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/VideoPreview/VideoPosition.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/View/SelectionIntended.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/View/SelectionType.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/View/Subtitles.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/View/SubtitleSelection.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/View/SubtitleView.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/MessageDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/Util.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/BaseDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/VideoSeekToDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/Glade/VideoSeekToDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/GnomeSubtitles/Dialog/TimingsSynchronizeDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/Glade/TimingsSynchronizeDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="src/External/GStreamerPlaybin/Engine.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/GStreamerPlaybin/Events.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/VideoPreview/Exceptions/PlayerEngineException.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/VideoPreview/Exceptions/PlayerCouldNotInitiateEngineException.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/VideoPreview/SubtitleOverlay.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/SyncPoints.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/Command/SynchronizeTimingsCommand.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/DialogScope.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/Unmanaged" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/Unmanaged/BasicErrorDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/Unmanaged/ErrorDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/Unmanaged/FileOpenErrorDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/Unmanaged/FileSaveErrorDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/Unmanaged/SubtitleFileOpenErrorDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/Unmanaged/VideoErrorDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/SubtitleFileSaveAsDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/FileSaveAsDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/TranslationSaveAsDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/Unmanaged/SaveConfirmationDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/Unmanaged/WarningDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/SetTextLanguageDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Dialog/SetTranslationLanguageDialog.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/Big5Statistics.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/EUCJPStatistics.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/EUCKRStatistics.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/EUCTWStatistics.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/GB2312Statistics.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsBIG5Verifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsCP1252Verifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsDetector.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsEUCJPVerifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsEUCKRVerifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsEUCSampler.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsEUCStatistics.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsEUCTWVerifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsGB2312Verifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsGB18030Verifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsHZVerifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsICharsetDetectionObserver.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsICharsetDetector.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsISO2022CNVerifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsISO2022JPVerifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsISO2022KRVerifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsPSMDetector.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsSJISVerifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsUCS2BEVerifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsUCS2LEVerifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsUTF8Verifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/External/NCharDet/nsVerifier.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/Enumerations.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/FileProperties.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/Frames.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/Headers.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/IncompleteSubtitle.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/IncompleteSubtitleCollection.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/Style.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/Subtitle.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/SubtitleCollection.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/SubtitleConstants.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/SubtitleHeaders.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/SubtitleProperties.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/Subtitles.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/SubtitleText.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/SubtitleTypeInfo.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/SyncPoint.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/SyncPoints.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/Times.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Domain/Timing.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Search/SearchOperator.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Search/SubtitleSearchOptions.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Search/SubtitleSearchResults.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Timing/AdjustOperator.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Timing/FrameRateOperator.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Timing/ShiftOperator.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Timing/SynchronizeOperator.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Timing/SyncUtil.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Timing/TimingUtil.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/MatchEvaluationCounter.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/SubtitleFactory.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/SubtitleSaver.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Translations.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Exceptions/EncodingNotSupportedException.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Exceptions/UnknownEncodingException.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Exceptions/UnknownSubtitleFormatException.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/FileInputOutput.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/Input/ParsingProperties.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/Input/PlainTextParser.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/Input/SubtitleInput.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/Input/SubtitleParser.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/Output/SubtitleOutput.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/Output/VerboseConsole.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/BuiltInSubtitleFormats.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormat.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatAdobeEncoreDVD.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatAdvancedSubStationAlpha.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatAQTitle.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatDKSSubtitleFormat.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatKaraokeLyricsLRC.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatKaraokeLyricsVKT.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatMacSUB.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatMicroDVD.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatMPlayer.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatMPlayer2.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatMPSub.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatPanimator.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatPhoenixJapanimationSociety.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatPowerDivX.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSofni.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSubCreator1x.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSubRip.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSubStationAlpha.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSubViewer1.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSubViewer2.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/IO/SubtitleFormats/SubtitleFormatViPlaySubtitleFile.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/SubLib/Core/Search/SubtitleReplaceResult.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Core/DragDrop.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Component" subtype="Directory" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Component/EncodingComboBox.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Component/ComboBoxUtil.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Component/SubtitleFormatComboBox.cs" subtype="Code" buildaction="Compile" />
-    <File name="src/GnomeSubtitles/Ui/Component/NewlineTypeComboBox.cs" subtype="Code" buildaction="Compile" />
+    <File subtype="Directory" buildaction="Compile" name="data" />
+    <File subtype="Directory" buildaction="Compile" name="src" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles/Core" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles/Core/Command" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles/Dialog" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles/Execution" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles/Ui" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles/Ui/Edit" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles/Ui/VideoPreview" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles/Ui/VideoPreview/Exceptions" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles/Ui/View" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Execution/Executable.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Execution/ExecutionContext.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/AboutDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/GladeDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/HeadersDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/SearchDialog.cs" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="data/gnome-subtitles.png" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="data/gnome-subtitles-logo.png" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/TimingsAdjustDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/FileOpenDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/TimingsShiftDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/VideoOpenDialog.cs" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="data/video-set-subtitle-start-16x.png" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="data/video-set-subtitle-end-16x.png" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="data/video-set-subtitle-start-end-30x.png" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/PreferencesDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/EncodingsDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Execution/BugReporter.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/FilePropertiesDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Config.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Base.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Util.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/Dialogs.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/FileTranslationOpenDialog.cs" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/AboutDialog.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/EncodingsDialog.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/FileOpenDialog.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/FilePropertiesDialog.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/FileSaveAsDialog.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/HeadersDialog.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/MainWindow.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/PreferencesDialog.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/SearchDialog.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/TimingsAdjustDialog.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/TimingsShiftDialog.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/VideoOpenDialog.glade" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/SetLanguageDialog.cs" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/SetLanguageDialog.glade" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/GnomeSubtitles/Execution/gnome-subtitles.exe.config" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/Menus.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/Status.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/WidgetNames.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/EncodingDescription.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Encodings.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/SpellLanguage.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/SpellLanguages.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Document.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Clipboards.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Search.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/MainUi.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/EventHandlers.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/AdjustTimingsCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/BaseCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/ChangeFrameRateCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/ChangeStyleCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/ChangeTimingCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/CommandActivatedArgs.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/CommandActivatedHandler.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/CommandManager.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/CommandTarget.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/DeleteSubtitlesCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/DeleteTextCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/DeleteTextContentCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/DeleteTranslationCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/FixedMultipleSelectionCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/FixedSingleSelectionCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/InsertSubtitleCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/InsertTextCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/InsertTextContentCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/InsertTranslationCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/MultipleSelectionCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/ReplaceAllCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/ShiftTimingsCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/SingleSelectionCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/VideoSetSubtitleTimingCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/Edit/SubtitleEdit.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/Edit/SubtitleEditSpinButtons.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/Edit/SubtitleEditText.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/Edit/SubtitleEditTextView.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/Edit/SubtitleEditTranslation.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/VideoPreview/Player.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/VideoPreview/PlayerPositionWatcher.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/VideoPreview/Video.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/VideoPreview/VideoFiles.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/VideoPreview/VideoPosition.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/View/SelectionIntended.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/View/SelectionType.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/View/Subtitles.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/View/SubtitleSelection.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/View/SubtitleView.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/MessageDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/Util.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/BaseDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/VideoSeekToDialog.cs" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/VideoSeekToDialog.glade" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/TimingsSynchronizeDialog.cs" />
+    <File subtype="Code" buildaction="EmbedAsResource" name="src/Glade/TimingsSynchronizeDialog.glade" />
+    <File subtype="Code" buildaction="Compile" name="src/External/GStreamerPlaybin/Engine.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/GStreamerPlaybin/Events.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/VideoPreview/Exceptions/PlayerEngineException.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/VideoPreview/Exceptions/PlayerCouldNotInitiateEngineException.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/VideoPreview/SubtitleOverlay.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/SyncPoints.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/Command/SynchronizeTimingsCommand.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/DialogScope.cs" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles/Dialog/Unmanaged" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/Unmanaged/BasicErrorDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/Unmanaged/ErrorDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/Unmanaged/FileOpenErrorDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/Unmanaged/FileSaveErrorDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/Unmanaged/SubtitleFileOpenErrorDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/Unmanaged/VideoErrorDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/SubtitleFileSaveAsDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/FileSaveAsDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/TranslationSaveAsDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/Unmanaged/SaveConfirmationDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/Unmanaged/WarningDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/SetTextLanguageDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Dialog/SetTranslationLanguageDialog.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/Big5Statistics.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/EUCJPStatistics.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/EUCKRStatistics.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/EUCTWStatistics.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/GB2312Statistics.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsBIG5Verifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsCP1252Verifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsDetector.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsEUCJPVerifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsEUCKRVerifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsEUCSampler.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsEUCStatistics.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsEUCTWVerifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsGB2312Verifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsGB18030Verifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsHZVerifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsICharsetDetectionObserver.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsICharsetDetector.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsISO2022CNVerifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsISO2022JPVerifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsISO2022KRVerifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsPSMDetector.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsSJISVerifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsUCS2BEVerifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsUCS2LEVerifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsUTF8Verifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/External/NCharDet/nsVerifier.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/Enumerations.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/FileProperties.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/Frames.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/Headers.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/IncompleteSubtitle.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/IncompleteSubtitleCollection.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/Style.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/Subtitle.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/SubtitleCollection.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/SubtitleConstants.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/SubtitleHeaders.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/SubtitleProperties.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/Subtitles.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/SubtitleText.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/SubtitleTypeInfo.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/SyncPoint.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/SyncPoints.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/Times.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Domain/Timing.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Search/SearchOperator.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Search/SubtitleSearchOptions.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Search/SubtitleSearchResults.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Timing/AdjustOperator.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Timing/FrameRateOperator.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Timing/ShiftOperator.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Timing/SynchronizeOperator.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Timing/SyncUtil.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Timing/TimingUtil.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/MatchEvaluationCounter.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/SubtitleFactory.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/SubtitleSaver.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Translations.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Exceptions/EncodingNotSupportedException.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Exceptions/UnknownEncodingException.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Exceptions/UnknownSubtitleFormatException.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/FileInputOutput.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/Input/ParsingProperties.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/Input/PlainTextParser.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/Input/SubtitleInput.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/Input/SubtitleParser.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/Output/SubtitleOutput.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/Output/VerboseConsole.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/BuiltInSubtitleFormats.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormat.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatAdobeEncoreDVD.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatAdvancedSubStationAlpha.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatAQTitle.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatDKSSubtitleFormat.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatKaraokeLyricsLRC.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatKaraokeLyricsVKT.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatMacSUB.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatMicroDVD.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatMPlayer.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatMPlayer2.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatMPSub.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatPanimator.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatPhoenixJapanimationSociety.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatPowerDivX.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSofni.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSubCreator1x.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSubRip.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSubStationAlpha.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSubViewer1.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatSubViewer2.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/IO/SubtitleFormats/SubtitleFormatViPlaySubtitleFile.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/SubLib/Core/Search/SubtitleReplaceResult.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Core/DragDrop.cs" />
+    <File subtype="Directory" buildaction="Compile" name="src/GnomeSubtitles/Ui/Component" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/Component/EncodingComboBox.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/Component/ComboBoxUtil.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/Component/SubtitleFormatComboBox.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/Component/NewlineTypeComboBox.cs" />
+    <File subtype="Code" buildaction="Compile" name="src/GnomeSubtitles/Ui/VideoPreview/SubtitleTracker.cs" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
@@ -261,4 +261,4 @@
   <LanguageParameters StartupObject="GnomeSubtitles.Execution.Executable" ApplicationIcon="." ctype="CSharpProjectParameters" />
   <Deployment.LinuxDeployData generateScript="False" />
   <DeploymentInformation strategy="File" />
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Glade/MainWindow.glade b/src/Glade/MainWindow.glade
index 0e21fb7..da23853 100644
--- a/src/Glade/MainWindow.glade
+++ b/src/Glade/MainWindow.glade
@@ -248,8 +248,8 @@
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
                         <signal name="activate" handler="OnEditRedo"/>
-                        <accelerator key="Y" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                         <accelerator key="Z" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
+                        <accelerator key="Y" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                       </widget>
                     </child>
                     <child>
@@ -532,8 +532,8 @@
                         <property name="label" translatable="yes">Find Ne_xt</property>
                         <property name="use_underline">True</property>
                         <signal name="activate" handler="OnSearchFindNext"/>
-                        <accelerator key="F3" signal="activate"/>
                         <accelerator key="g" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+                        <accelerator key="F3" signal="activate"/>
                       </widget>
                     </child>
                     <child>
@@ -543,8 +543,8 @@
                         <property name="label" translatable="yes">Find Pre_vious</property>
                         <property name="use_underline">True</property>
                         <signal name="activate" handler="OnSearchFindPrevious"/>
-                        <accelerator key="F3" signal="activate" modifiers="GDK_SHIFT_MASK"/>
                         <accelerator key="g" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
+                        <accelerator key="F3" signal="activate" modifiers="GDK_SHIFT_MASK"/>
                       </widget>
                     </child>
                     <child>
@@ -803,8 +803,8 @@
                         <property name="use_underline">True</property>
                         <property name="use_stock">False</property>
                         <signal name="activate" handler="OnVideoPlayPause"/>
-                        <accelerator key="F5" signal="activate"/>
                         <accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+                        <accelerator key="F5" signal="activate"/>
                         <child internal-child="image">
                           <widget class="GtkImage" id="videoPlayPauseImage">
                             <property name="visible">True</property>
@@ -822,8 +822,8 @@
                         <property name="use_underline">True</property>
                         <property name="use_stock">False</property>
                         <signal name="activate" handler="OnVideoRewind"/>
-                        <accelerator key="F6" signal="activate"/>
                         <accelerator key="k" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+                        <accelerator key="F6" signal="activate"/>
                         <child internal-child="image">
                           <widget class="GtkImage" id="videoRewindImage">
                             <property name="visible">True</property>
@@ -841,8 +841,8 @@
                         <property name="use_underline">True</property>
                         <property name="use_stock">False</property>
                         <signal name="activate" handler="OnVideoForward"/>
-                        <accelerator key="F7" signal="activate"/>
                         <accelerator key="l" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+                        <accelerator key="F7" signal="activate"/>
                         <child internal-child="image">
                           <widget class="GtkImage" id="videoForwardImage">
                             <property name="visible">True</property>
@@ -882,6 +882,25 @@
                         <property name="label" translatable="yes">Seek _to Selection</property>
                         <property name="use_underline">True</property>
                         <signal name="activate" handler="OnVideoSeekToSelection"/>
+                        <accelerator key="r" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkMenuItem" id="videoSelectNearestSubtitle">
+                        <property name="visible">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="label" translatable="yes">Select Nearest Subtitle</property>
+                        <property name="use_underline">True</property>
+                        <signal name="activate" handler="OnVideoSelectNearestSubtitle"/>
+                        <accelerator key="j" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkCheckMenuItem" id="videoAutoSelectSubtitles">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Auto Select Subtitles</property>
+                        <property name="use_underline">True</property>
+                        <signal name="toggled" handler="OnVideoAutoSelectSubtitles"/>
                       </widget>
                     </child>
                     <child>
@@ -1332,9 +1351,6 @@
                         <property name="row_spacing">4</property>
                         <property name="homogeneous">True</property>
                         <child>
-                          <placeholder/>
-                        </child>
-                        <child>
                           <widget class="GtkButton" id="videoSetSubtitleStartButton">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -1394,6 +1410,9 @@
                             <property name="bottom_attach">2</property>
                           </packing>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
diff --git a/src/GnomeSubtitles/Core/EventHandlers.cs b/src/GnomeSubtitles/Core/EventHandlers.cs
index d6bd058..860572e 100644
--- a/src/GnomeSubtitles/Core/EventHandlers.cs
+++ b/src/GnomeSubtitles/Core/EventHandlers.cs
@@ -264,7 +264,15 @@ public class EventHandlers {
 	public void OnVideoSeekToSelection (object o, EventArgs args) {
 		Base.Ui.Video.SeekToSelection();	
 	}
-	
+		
+	public void OnVideoSelectNearestSubtitle(object o, EventArgs args) {
+		Base.Ui.Video.SelectNearestSubtitle();
+	}
+		
+	public void OnVideoAutoSelectSubtitles(object o, EventArgs args) {
+		Base.Ui.View.SetAutoSelectSubtitles();
+ 	}
+		
 	public void OnVideoSetSubtitleStart (object o, EventArgs args) {
 		if (Base.TimingMode == TimingMode.Times) {
 			TimeSpan time = Base.Ui.Video.Position.CurrentTime;
diff --git a/src/GnomeSubtitles/Ui/Menus.cs b/src/GnomeSubtitles/Ui/Menus.cs
index 4d2f608..8b849c4 100644
--- a/src/GnomeSubtitles/Ui/Menus.cs
+++ b/src/GnomeSubtitles/Ui/Menus.cs
@@ -284,13 +284,17 @@ public class Menus {
 	private void SetVideoSelectionDependentSensitivity (bool sensitivity) {
 		if (Core.Base.Ui.Video.IsLoaded && sensitivity) {
 			SetSensitivity(WidgetNames.VideoSeekToSelection, true);
+			SetSensitivity(WidgetNames.VideoSelectNearestSubtitle, true);
 			SetSensitivity(WidgetNames.VideoSetSubtitleStart, true);
 			SetSensitivity(WidgetNames.VideoSetSubtitleEnd, true);
+			SetSensitivity(WidgetNames.VideoAutoSelectSubtitles, true);
 		}
 		else {
 			SetSensitivity(WidgetNames.VideoSeekToSelection, false);
+			SetSensitivity(WidgetNames.VideoSelectNearestSubtitle, false);
 			SetSensitivity(WidgetNames.VideoSetSubtitleStart, false);
 			SetSensitivity(WidgetNames.VideoSetSubtitleEnd, false);
+			SetSensitivity(WidgetNames.VideoAutoSelectSubtitles, false);
 		}
 	}
 	
diff --git a/src/GnomeSubtitles/Ui/VideoPreview/SubtitleOverlay.cs b/src/GnomeSubtitles/Ui/VideoPreview/SubtitleOverlay.cs
index 3a2e66a..fd4ed1e 100644
--- a/src/GnomeSubtitles/Ui/VideoPreview/SubtitleOverlay.cs
+++ b/src/GnomeSubtitles/Ui/VideoPreview/SubtitleOverlay.cs
@@ -26,13 +26,10 @@ using System;
 namespace GnomeSubtitles.Ui.VideoPreview {
 
 public class SubtitleOverlay {
-	private Label label = null;
-	private SearchOperator searchOp = null;
+	private Label label = null;	
 	
 	/* Current subtitle */
-	private Subtitle subtitle = null;
-	private TimeSpan subtitleStart = TimeSpan.Zero;
-	private TimeSpan subtitleEnd = TimeSpan.Zero;
+	private Subtitle subtitle = null;	
 	private bool toShowText = true;
 	
 	public SubtitleOverlay () {
@@ -58,32 +55,18 @@ public class SubtitleOverlay {
 	public void Close () {
 		UnloadSubtitle();
 	}
-
-	
-	/* Private properties */
 	
-	private bool IsSubtitleLoaded {
-		get { return subtitle != null; }
-	}
 	
 	/* Private methods */
 	
-	private bool IsTimeInCurrentSubtitle (TimeSpan time) {
-		return IsSubtitleLoaded && (time >= subtitleStart) && (time <= subtitleEnd);	
-	}
-	
 	private void LoadSubtitle (int number) {
-		subtitle = Base.Document.Subtitles[number];
-		subtitleStart = subtitle.Times.Start;
-		subtitleEnd = subtitle.Times.End;
+		subtitle = Base.Document.Subtitles[number];		
 		SetText();
 		label.Visible = true;
 	}
 	
 	private void UnloadSubtitle () {
-		subtitle = null;
-		subtitleStart = TimeSpan.Zero;
-		subtitleEnd = TimeSpan.Zero;
+		subtitle = null;		
 		ClearText();
 		label.Visible = false;
 	}
@@ -114,31 +97,17 @@ public class SubtitleOverlay {
 	private void ClearText () {
 		label.Text = String.Empty;
 	}
-
 	
-	/* Event members */
-	
-	private void OnBaseInitFinished () {
-		Base.Ui.Video.Position.Changed += OnVideoPositionChanged;
+	/* Event members */		
 		
-		Base.DocumentLoaded += OnBaseDocumentLoaded;
-	}
 	
-	private void OnBaseDocumentLoaded (Document document) {
-		searchOp = new SearchOperator(document.Subtitles);
+	private void OnBaseInitFinished () {			
+			Base.Ui.Video.Tracker.SubtitleChanged += OnCurrentSubtitleChanged;		
 	}
 	
-	private void OnVideoPositionChanged (TimeSpan newPosition) {
-		if (!(Base.IsDocumentLoaded))
-			return;
-	
-		if (!(IsTimeInCurrentSubtitle(newPosition))) {
-			int foundSubtitle = searchOp.FindWithTime((float)newPosition.TotalSeconds); //TODO write method in SubLib that accepts TimeSpans
-			if (foundSubtitle == -1)
-				UnloadSubtitle();
-			else
-				LoadSubtitle(foundSubtitle);
-		}
+	private void OnCurrentSubtitleChanged(int indexSubtitle) {
+			if( indexSubtitle == -1 ) UnloadSubtitle();
+			else LoadSubtitle(indexSubtitle);		
 	}
 	
 }
diff --git a/src/GnomeSubtitles/Ui/VideoPreview/SubtitleTracker.cs b/src/GnomeSubtitles/Ui/VideoPreview/SubtitleTracker.cs
new file mode 100755
index 0000000..90dbc76
--- /dev/null
+++ b/src/GnomeSubtitles/Ui/VideoPreview/SubtitleTracker.cs
@@ -0,0 +1,114 @@
+using GnomeSubtitles.Core;
+using Gtk;
+using SubLib.Core.Domain;
+using SubLib.Core.Search;
+using System;
+
+namespace GnomeSubtitles.Ui.VideoPreview
+{
+
+
+public class SubtitleTracker{
+		
+		
+	private SearchOperator searchOp = null;
+	private TimeSpan subtitleStart = TimeSpan.Zero;
+	private TimeSpan subtitleEnd = TimeSpan.Zero;	
+	private int currentSubtitleIndex = 0;
+	private Subtitle subtitle = null;
+		
+	/* Delegates */
+	public delegate void VideoCurrentSubtitleChangedHandler (int indexSubtitle);
+		
+	/* Events */
+		
+	public event VideoCurrentSubtitleChangedHandler SubtitleChanged;
+
+	public SubtitleTracker ()
+	{
+		Base.InitFinished += OnBaseInitFinished;
+	}
+		
+	public int FindSubtitleNearPosition(TimeSpan position){
+		if (IsTimeInCurrentSubtitle(position)) 
+				return currentSubtitleIndex;
+		else {
+				int foundSubtitle = searchOp.FindNearTime((float)position.TotalSeconds);				
+				return foundSubtitle;
+		}
+
+ 	}
+		
+	public void Close(){
+		if( IsSubtitleLoaded )
+			UnSetCurrentSubtitle();
+	}
+	
+	/* Private properties */
+	
+	private bool IsSubtitleLoaded {
+		get { return subtitle != null; }
+	}
+		
+	/* Private methods */
+	
+	private bool IsTimeInCurrentSubtitle (TimeSpan time) {
+		return IsSubtitleLoaded && (time >= subtitleStart) && (time <= subtitleEnd);	
+	}
+	
+		
+	private void SetCurrentSubtitle (int index) {
+		
+		if( index != currentSubtitleIndex ){
+			subtitle = Base.Document.Subtitles[index];
+			subtitleStart = subtitle.Times.Start;
+			subtitleEnd = subtitle.Times.End;			
+			currentSubtitleIndex = index;			
+			}
+	}
+	
+	private void UnSetCurrentSubtitle () {
+		if( currentSubtitleIndex != -1 ){			
+			currentSubtitleIndex = -1;				
+			subtitle = null;
+			subtitleStart = TimeSpan.Zero;
+			subtitleEnd = TimeSpan.Zero;			
+		}
+	}
+		
+	private void EmitCurrentSubtitleChanged(int newIndex) {
+		if (SubtitleChanged != null)
+			SubtitleChanged(newIndex);
+	}
+		
+	/* Event members */
+	
+	private void OnBaseInitFinished () {
+		Base.Ui.Video.Position.Changed += OnVideoPositionChanged;		
+		Base.DocumentLoaded += OnBaseDocumentLoaded;
+	}
+	
+	private void OnBaseDocumentLoaded (Document document) {
+		searchOp = new SearchOperator(document.Subtitles);
+	}
+	
+		
+	private void OnVideoPositionChanged (TimeSpan newPosition) {
+		if (!(Base.IsDocumentLoaded))
+			return;
+	
+		if (!(IsTimeInCurrentSubtitle(newPosition))) {
+			int foundSubtitle = searchOp.FindWithTime((float)newPosition.TotalSeconds); //TODO write method in SubLib that accepts TimeSpans
+			if (foundSubtitle == -1)
+				UnSetCurrentSubtitle();			
+			else
+				SetCurrentSubtitle(foundSubtitle);
+			
+			EmitCurrentSubtitleChanged(currentSubtitleIndex);
+		}
+	}		
+	
+	
+	}
+	
+}
diff --git a/src/GnomeSubtitles/Ui/VideoPreview/Video.cs b/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
index 8236160..8aa7f00 100644
--- a/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
+++ b/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
@@ -36,6 +36,7 @@ public class Video {
 	private Player player = null;
 	private VideoPosition position = null;
 	private SubtitleOverlay overlay = null;
+	private SubtitleTracker tracker = null;
 	
 	private bool isLoaded = false;
 	private bool playPauseToggleIsSilent = false; //Used to indicate whether toggling the button should not issue the toggled signal
@@ -53,6 +54,7 @@ public class Video {
 		
 		position = new VideoPosition(player);
 		overlay = new SubtitleOverlay();
+		tracker = new SubtitleTracker();
 
 		SetCustomIcons();
 		Base.InitFinished += OnBaseInitFinished;
@@ -67,6 +69,10 @@ public class Video {
 	public SubtitleOverlay Overlay {
 		get { return overlay; }
 	}
+		
+	public SubtitleTracker Tracker {
+		get { return tracker; }
+	}
 	
 	public bool IsLoaded {
 		get { return isLoaded; }
@@ -114,8 +120,10 @@ public class Video {
 
 		player.Close();
 		overlay.Close();
+		tracker.Close();
 		position.Disable();
 		
+		
 		/* Update the frame */
 		frame.Child.Hide();
 		frame.Child.Show();
@@ -169,6 +177,11 @@ public class Video {
     	Seek(time);
 	}
 	
+	public void SelectNearestSubtitle () {		
+		int index = tracker.FindSubtitleNearPosition(position.CurrentTime);
+		Base.Ui.View.Selection.SelectToIndex(index);
+	}
+	
 	/* Private methods */
 
 	private void Play () {
diff --git a/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs b/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs
index aa531c5..7cec752 100644
--- a/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs
+++ b/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs
@@ -241,6 +241,14 @@ public class SubtitleSelection {
 		Core.Base.Ui.Edit.TextFocusOnSelection(start, end, textType);		
 	}
     
+	/// <summary>Selects the subtitle based in your index.</summary>
+    /// <remarks>The subtitle is only selected if it exists.</remarks>
+    public void SelectToIndex (int index) {
+    	if (Base.Document.Subtitles.Count > 0 && index > 0){			
+    		Select(Util.IntToPath(index), false, false);
+		}
+    }
+		
     /// <summary>Selects the first subtitle.</summary>
     /// <remarks>The subtitle is only selected if it exists.</remarks>
     public void SelectFirst () {
diff --git a/src/GnomeSubtitles/Ui/View/SubtitleView.cs b/src/GnomeSubtitles/Ui/View/SubtitleView.cs
index 5286059..d6938c6 100644
--- a/src/GnomeSubtitles/Ui/View/SubtitleView.cs
+++ b/src/GnomeSubtitles/Ui/View/SubtitleView.cs
@@ -70,6 +70,14 @@ public class SubtitleView {
     }
     
     /* Public methods */ 
+		
+	public void SetAutoSelectSubtitles(){
+		CheckMenuItem item = Base.GetWidget(WidgetNames.VideoAutoSelectSubtitles) as CheckMenuItem;
+		bool follow = item.Active;
+		if( follow ) Base.Ui.Video.Tracker.SubtitleChanged += OnCurrentSubtitleChanged;
+		else Base.Ui.Video.Tracker.SubtitleChanged -= OnCurrentSubtitleChanged;
+	}		
+
 	
 	/// <summary>Instructs the <see cref="TreeView" /> to redraw a row.</summary>
 	/// <remarks>This is useful when a row changes its width, for instance.</remarks>
@@ -378,6 +386,10 @@ public class SubtitleView {
 		if (SubtitleCountChanged != null)
 			SubtitleCountChanged(subtitles.Count);
 	}
+	
+	private void OnCurrentSubtitleChanged(int indexSubtitle) {			
+			if( indexSubtitle != -1 ) selection.SelectToIndex(indexSubtitle);		
+	}
 
     private void SetEmptyModel () {
     	tree.Model = new ListStore(typeof(Subtitle));
diff --git a/src/GnomeSubtitles/Ui/WidgetNames.cs b/src/GnomeSubtitles/Ui/WidgetNames.cs
index 6043140..d3503ab 100644
--- a/src/GnomeSubtitles/Ui/WidgetNames.cs
+++ b/src/GnomeSubtitles/Ui/WidgetNames.cs
@@ -79,6 +79,8 @@ public class WidgetNames {
 	public const string VideoForward = "videoForward";
 	public const string VideoSeekTo = "videoSeekTo";
 	public const string VideoSeekToSelection = "videoSeekToSelection";
+	public const string VideoSelectNearestSubtitle = "videoSelectNearestSubtitle";
+	public const string VideoAutoSelectSubtitles = "videoAutoSelectSubtitles";
 	public const string VideoSetSubtitleStart = "videoSetSubtitleStart";
 	public const string VideoSetSubtitleEnd = "videoSetSubtitleEnd";
 	
diff --git a/src/SubLib/Core/Search/SearchOperator.cs b/src/SubLib/Core/Search/SearchOperator.cs
index b312b8b..2255990 100644
--- a/src/SubLib/Core/Search/SearchOperator.cs
+++ b/src/SubLib/Core/Search/SearchOperator.cs
@@ -114,7 +114,39 @@ public class SearchOperator {
 		}
 		return -1; // No subtitles were found 
 	}
-
+		
+	/// <summary>Finds the subtitle more near of specified time position.</summary>
+	/// <param name="time">The time position, in seconds.</param>
+	/// <returns>The found subtitle number, or -1 if no subtitle was found.</returns>
+	public int FindNearTime (float time) {
+		SubtitleCollection collection = subtitles.Collection;
+		if( time < collection[0].Times.Start.Seconds ) return 0;
+		if (collection.Count == 0)
+			return -1;
+		
+		for (int subtitleNumber = 0 ; subtitleNumber < collection.Count ; subtitleNumber++) {
+			Subtitle subtitle = collection[subtitleNumber];
+			Subtitle nextSubtitle;
+			if( subtitleNumber != collection.Count -1 ) nextSubtitle = collection[subtitleNumber+1];
+			else nextSubtitle = collection[collection.Count-1];
+			
+			double start = subtitle.Times.Start.TotalSeconds;
+			if (time < start)
+				continue;
+			
+			double end = subtitle.Times.End.TotalSeconds;
+			if (time <= end)
+				return subtitleNumber;
+			
+			double nextSubtitleStart = nextSubtitle.Times.Start.TotalSeconds;
+			if( time > end && time < nextSubtitleStart ){					
+					if( time - end < nextSubtitleStart - time ) return subtitleNumber;
+					else return subtitleNumber+1;
+			}
+			
+		}
+		return -1; // No subtitles were found 
+	}
 	
 	/* Private members */
 	



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]