gnome-subtitles r1015 - in trunk: . src/GnomeSubtitles/Core src/GnomeSubtitles/Core/Command src/GnomeSubtitles/Dialog src/GnomeSubtitles/Exception src/GnomeSubtitles/Execution src/GnomeSubtitles/Ui src/GnomeSubtitles/Ui/Edit src/GnomeSubtitles/Ui/VideoPreview src/GnomeSubtitles/Ui/VideoPreview/Exception src/GnomeSubtitles/Ui/View
- From: pcastro svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-subtitles r1015 - in trunk: . src/GnomeSubtitles/Core src/GnomeSubtitles/Core/Command src/GnomeSubtitles/Dialog src/GnomeSubtitles/Exception src/GnomeSubtitles/Execution src/GnomeSubtitles/Ui src/GnomeSubtitles/Ui/Edit src/GnomeSubtitles/Ui/VideoPreview src/GnomeSubtitles/Ui/VideoPreview/Exception src/GnomeSubtitles/Ui/View
- Date: Sun, 22 Jun 2008 23:46:31 +0000 (UTC)
Author: pcastro
Date: Sun Jun 22 23:46:31 2008
New Revision: 1015
URL: http://svn.gnome.org/viewvc/gnome-subtitles?rev=1015&view=rev
Log:
Major refactoring - part 3. Renamed namespaces and classes.
Added:
trunk/src/GnomeSubtitles/Core/Base.cs
trunk/src/GnomeSubtitles/Execution/ExecutionContext.cs
Removed:
trunk/src/GnomeSubtitles/Core/Global.cs
trunk/src/GnomeSubtitles/Exception/
trunk/src/GnomeSubtitles/Execution/Execution.cs
Modified:
trunk/gnome-subtitles.mdp
trunk/src/GnomeSubtitles/Core/Clipboards.cs
trunk/src/GnomeSubtitles/Core/Command/AdjustTimingsCommand.cs
trunk/src/GnomeSubtitles/Core/Command/BaseCommand.cs
trunk/src/GnomeSubtitles/Core/Command/ChangeFrameRateCommand.cs
trunk/src/GnomeSubtitles/Core/Command/ChangeStyleCommand.cs
trunk/src/GnomeSubtitles/Core/Command/ChangeTimingCommand.cs
trunk/src/GnomeSubtitles/Core/Command/CommandActivatedArgs.cs
trunk/src/GnomeSubtitles/Core/Command/CommandActivatedHandler.cs
trunk/src/GnomeSubtitles/Core/Command/CommandManager.cs
trunk/src/GnomeSubtitles/Core/Command/CommandTarget.cs
trunk/src/GnomeSubtitles/Core/Command/DeleteSubtitlesCommand.cs
trunk/src/GnomeSubtitles/Core/Command/DeleteTextCommand.cs
trunk/src/GnomeSubtitles/Core/Command/DeleteTextContentCommand.cs
trunk/src/GnomeSubtitles/Core/Command/DeleteTranslationCommand.cs
trunk/src/GnomeSubtitles/Core/Command/FixedMultipleSelectionCommand.cs
trunk/src/GnomeSubtitles/Core/Command/FixedSingleSelectionCommand.cs
trunk/src/GnomeSubtitles/Core/Command/InsertSubtitleCommand.cs
trunk/src/GnomeSubtitles/Core/Command/InsertTextCommand.cs
trunk/src/GnomeSubtitles/Core/Command/InsertTextContentCommand.cs
trunk/src/GnomeSubtitles/Core/Command/InsertTranslationCommand.cs
trunk/src/GnomeSubtitles/Core/Command/MultipleSelectionCommand.cs
trunk/src/GnomeSubtitles/Core/Command/ReplaceAllCommand.cs
trunk/src/GnomeSubtitles/Core/Command/ShiftTimingsCommand.cs
trunk/src/GnomeSubtitles/Core/Command/SingleSelectionCommand.cs
trunk/src/GnomeSubtitles/Core/Command/VideoSetSubtitleTimingCommand.cs
trunk/src/GnomeSubtitles/Core/Document.cs
trunk/src/GnomeSubtitles/Core/EventHandlers.cs
trunk/src/GnomeSubtitles/Core/Search.cs
trunk/src/GnomeSubtitles/Core/SpellLanguages.cs
trunk/src/GnomeSubtitles/Dialog/AboutDialog.cs
trunk/src/GnomeSubtitles/Dialog/EncodingsDialog.cs
trunk/src/GnomeSubtitles/Dialog/ErrorDialog.cs
trunk/src/GnomeSubtitles/Dialog/FileOpenDialog.cs
trunk/src/GnomeSubtitles/Dialog/FilePropertiesDialog.cs
trunk/src/GnomeSubtitles/Dialog/FileSaveAsDialog.cs
trunk/src/GnomeSubtitles/Dialog/FileTranslationOpenDialog.cs
trunk/src/GnomeSubtitles/Dialog/GladeDialog.cs
trunk/src/GnomeSubtitles/Dialog/HeadersDialog.cs
trunk/src/GnomeSubtitles/Dialog/PreferencesDialog.cs
trunk/src/GnomeSubtitles/Dialog/ReportBugWindow.cs
trunk/src/GnomeSubtitles/Dialog/SaveConfirmationDialog.cs
trunk/src/GnomeSubtitles/Dialog/SearchDialog.cs
trunk/src/GnomeSubtitles/Dialog/SetLanguageDialog.cs
trunk/src/GnomeSubtitles/Dialog/SubtitleFileChooserDialog.cs
trunk/src/GnomeSubtitles/Dialog/TimingsAdjustDialog.cs
trunk/src/GnomeSubtitles/Dialog/TimingsShiftDialog.cs
trunk/src/GnomeSubtitles/Dialog/VideoFileOpenErrorDialog.cs
trunk/src/GnomeSubtitles/Dialog/VideoOpenDialog.cs
trunk/src/GnomeSubtitles/Execution/BugReporter.cs
trunk/src/GnomeSubtitles/Execution/Executable.cs
trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEdit.cs
trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditSpinButtons.cs
trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditText.cs
trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditTextView.cs
trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditTranslation.cs
trunk/src/GnomeSubtitles/Ui/MainUi.cs
trunk/src/GnomeSubtitles/Ui/Menus.cs
trunk/src/GnomeSubtitles/Ui/Status.cs
trunk/src/GnomeSubtitles/Ui/VideoPreview/Exception/PlayerCouldNotOpenVideoException.cs
trunk/src/GnomeSubtitles/Ui/VideoPreview/Player.cs
trunk/src/GnomeSubtitles/Ui/VideoPreview/PlayerPositionWatcher.cs
trunk/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoFiles.cs
trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoPosition.cs
trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoSubtitle.cs
trunk/src/GnomeSubtitles/Ui/View/CellRendererCenteredText.cs
trunk/src/GnomeSubtitles/Ui/View/SelectionIntended.cs
trunk/src/GnomeSubtitles/Ui/View/SelectionType.cs
trunk/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs
trunk/src/GnomeSubtitles/Ui/View/SubtitleView.cs
trunk/src/GnomeSubtitles/Ui/View/Subtitles.cs
Modified: trunk/gnome-subtitles.mdp
==============================================================================
--- trunk/gnome-subtitles.mdp (original)
+++ trunk/gnome-subtitles.mdp Sun Jun 22 23:46:31 2008
@@ -4,41 +4,35 @@
<Output directory="build" assemblyKeyFile="." assembly="gnome-subtitles" />
<Build debugmode="True" target="WinExe" />
<Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
- <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="GnomeSubtitles.Executable" generatexmldocumentation="False" win32Icon="." ctype="CSharpCompilerParameters" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="GnomeSubtitles.Execution.Executable" generatexmldocumentation="False" win32Icon="." 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" />
- <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="GnomeSubtitles.Executable" generatexmldocumentation="False" win32Icon="." ctype="CSharpCompilerParameters" />
+ <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="GnomeSubtitles.Execution.Executable" generatexmldocumentation="False" win32Icon="." 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/Exception" 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/Execution.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/AdjustTimingsCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/ChangeFrameRateCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/ChangeStyleCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/ChangeTimingCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/Command.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/CommandManager.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/DeleteSubtitlesCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/FixedMultipleSelectionCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/FixedSingleSelectionCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/InsertSubtitleCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/MultipleSelectionCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/ShiftTimingsCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/SingleSelectionCommand.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="src/GnomeSubtitles/Dialog/SubtitleFileChooserDialog.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/ReplaceAllCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="data" subtype="Directory" 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/ReportBugWindow.cs" subtype="Code" buildaction="Compile" />
@@ -49,7 +43,6 @@
<File name="src/GnomeSubtitles/Dialog/FileSaveAsDialog.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="src/GnomeSubtitles/Command/VideoSetSubtitleTimingCommand.cs" subtype="Code" buildaction="Compile" />
<File name="src/GnomeSubtitles/Dialog/SubtitleFileOpenErrorDialog.cs" subtype="Code" buildaction="Compile" />
<File name="src/GnomeSubtitles/Dialog/VideoFileOpenErrorDialog.cs" subtype="Code" buildaction="Compile" />
<File name="data/video-set-subtitle-start-16x.png" subtype="Code" buildaction="EmbedAsResource" />
@@ -60,18 +53,9 @@
<File name="src/GnomeSubtitles/Dialog/FilePropertiesDialog.cs" subtype="Code" buildaction="Compile" />
<File name="src/GnomeSubtitles/Dialog/ErrorDialog.cs" subtype="Code" buildaction="Compile" />
<File name="src/GnomeSubtitles/Dialog/FileSaveErrorDialog.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/CommandTarget.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/CommandActivatedArgs.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/CommandActivatedHandler.cs" subtype="Code" buildaction="Compile" />
<File name="src/GnomeSubtitles/Core/Config.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Core/Global.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/Command/InsertTextContentCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/InsertTextCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/InsertTranslationCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/DeleteTextContentCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/DeleteTextCommand.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Command/DeleteTranslationCommand.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" />
@@ -92,38 +76,60 @@
<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" subtype="Directory" buildaction="Compile" />
<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/Ui/SubtitleEdit/SubtitleEdit.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/SubtitleEdit/SubtitleEditSpinButtons.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/SubtitleEdit/SubtitleEditText.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/SubtitleEdit/SubtitleEditTextView.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/SubtitleEdit/SubtitleEditTranslation.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/SubtitleView/CellRendererCenteredText.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/SubtitleView/SelectionIntended.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/SubtitleView/SelectionType.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/SubtitleView/SubtitleSelection.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/SubtitleView/SubtitleView.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/Video/Video.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/Video/VideoFiles.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/Video/VideoPosition.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/Video/VideoSubtitle.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/SubtitleView/Subtitles.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/Video/Player.cs" subtype="Code" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/Video/PlayerPositionWatcher.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/Ui/Video/Exception" subtype="Directory" buildaction="Compile" />
- <File name="src/GnomeSubtitles/Ui/Video/Exception/PlayerCouldNotOpenVideoException.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/VideoPreview/VideoSubtitle.cs" subtype="Code" buildaction="Compile" />
+ <File name="src/GnomeSubtitles/Ui/VideoPreview/Exception/PlayerCouldNotOpenVideoException.cs" subtype="Code" buildaction="Compile" />
+ <File name="src/GnomeSubtitles/Ui/View/CellRendererCenteredText.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" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
Added: trunk/src/GnomeSubtitles/Core/Base.cs
==============================================================================
--- (empty file)
+++ trunk/src/GnomeSubtitles/Core/Base.cs Sun Jun 22 23:46:31 2008
@@ -0,0 +1,206 @@
+/*
+ * This file is part of Gnome Subtitles.
+ * Copyright (C) 2006-2008 Pedro Castro
+ *
+ * Gnome Subtitles is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Gnome Subtitles is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+using GnomeSubtitles.Core.Command;
+using GnomeSubtitles.Dialog;
+using GnomeSubtitles.Execution;
+using GnomeSubtitles.Ui;
+using Gtk;
+using Mono.Unix;
+using SubLib;
+using System;
+using System.IO;
+using System.Text;
+
+namespace GnomeSubtitles.Core {
+
+public class Base {
+ private static Glade.XML glade = null;
+
+ private static MainUi ui = null;
+ private static ExecutionContext executionContext = null;
+ private static EventHandlers handlers = null;
+ private static CommandManager commandManager = null;
+ private static Clipboards clipboards = null;
+ private static Config config = null;
+ private static Dialogs dialogs = null;
+ private static SpellLanguages spellLanguages = null;
+
+ private static Document document = null;
+ private static TimingMode timingMode = TimingMode.Times;
+
+
+ /* Public properties */
+
+ public static MainUi Ui {
+ get { return ui; }
+ }
+
+ public static ExecutionContext ExecutionContext {
+ get { return executionContext; }
+ }
+
+ public static EventHandlers Handlers {
+ get { return handlers; }
+ }
+
+ public static CommandManager CommandManager {
+ get { return commandManager; }
+ }
+
+ public static Clipboards Clipboards {
+ get { return clipboards; }
+ }
+
+ public static Config Config {
+ get { return config; }
+ }
+
+ public static Dialogs Dialogs {
+ get { return dialogs; }
+ }
+
+ public static SpellLanguages SpellLanguages {
+ get { return spellLanguages; }
+ }
+
+ public static Document Document {
+ get { return document; }
+ }
+
+ public static bool IsDocumentLoaded {
+ get { return document != null; }
+ }
+
+ public static TimingMode TimingMode {
+ get { return timingMode; }
+ set {
+ if (timingMode != value) {
+ timingMode = value;
+ ui.UpdateFromTimingMode(value);
+ }
+ }
+ }
+
+ public static bool TimingModeIsFrames {
+ get { return timingMode == TimingMode.Frames; }
+ }
+
+ public static bool TimingModeIsTimes {
+ get { return timingMode == TimingMode.Times; }
+ }
+
+
+ /* Public methods */
+
+ /// <summary>Runs the main GUI, after initialization.</summary>
+ /// <returns>Whether running the application completed without fatal errors.</returns>
+ public static bool Run (ExecutionContext executionContext) {
+ try {
+ if (!Init(executionContext))
+ throw new Exception("The Base environment was already initialized.");
+
+ ui.Start();
+ executionContext.RunProgram();
+
+ return true;
+ }
+ catch (Exception exception) {
+ Kill();
+ BugReporter.Report(exception);
+ return false;
+ }
+ }
+
+ /// <summary>Quits the program.</summary>
+ public static void Quit () {
+ executionContext.QuitProgram();
+ }
+
+ public static void CreateDocumentNew (string path) {
+ bool wasLoaded = IsDocumentLoaded;
+ document = new Document(path, wasLoaded);
+
+ CommandManager.Clear();
+ Ui.UpdateFromDocumentModified(false);
+ Ui.UpdateFromNewDocument(wasLoaded);
+ }
+
+ public static void CreateDocumentOpen (string path, Encoding encoding) {
+ bool wasLoaded = IsDocumentLoaded;
+ document = new Document(path, encoding, wasLoaded);
+
+ CommandManager.Clear();
+ TimingMode = document.TextFile.TimingMode;
+ Ui.UpdateFromDocumentModified(false);
+ Ui.UpdateFromNewDocument(wasLoaded);
+ }
+
+ public static Widget GetWidget (string name) {
+ return glade.GetWidget(name);
+ }
+
+ /* Private members */
+
+ /// <summary>Initializes the base program structure.</summary>
+ /// <remarks>Nothing is done if initialization has already occured. The core value is checked for this,
+ /// if it's null then initialization hasn't occured yet.</remarks>
+ /// <returns>Whether initialization succeeded.</returns>
+ private static bool Init (ExecutionContext newExecutionContext) {
+ if ((executionContext != null) && (executionContext.Initialized))
+ return false;
+
+ executionContext = newExecutionContext;
+ executionContext.Init();
+
+ /* Initialize Command manager */
+ commandManager = new CommandManager();
+
+ /* Initialize handlers */
+ handlers = new EventHandlers();
+
+ /* Initialize misc */
+ clipboards = new Clipboards();
+ config = new Config();
+ dialogs = new Dialogs();
+ spellLanguages = new SpellLanguages();
+
+ /* Initialize the GUI */
+ ui = new MainUi(handlers, out glade);
+ clipboards.WatchPrimaryChanges = true;
+ Catalog.Init(ExecutionContext.TranslationDomain, ExecutionContext.SystemShareLocaleDir);
+
+ return true;
+ }
+
+ /// <summary>Kills the window in the most quick and unfriendly way.</summary>
+ private static void Kill () {
+ try {
+ clipboards.WatchPrimaryChanges = false;
+ executionContext.QuitProgram();
+ ui.Kill();
+ }
+ catch (Exception) {
+ ; //Nothing to do if there were errors while killing the window
+ }
+ }
+
+}
+
+}
Modified: trunk/src/GnomeSubtitles/Core/Clipboards.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Clipboards.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Clipboards.cs Sun Jun 22 23:46:31 2008
@@ -49,24 +49,24 @@
}
public void OnOwnerChange (object o, OwnerChangeArgs args) {
- Window window = Global.GUI.Window;
+ Window window = Base.Ui.Window;
if ((!window.IsActive) || (args.Event.Owner == 0) || (!ValidWidgetHasFocus()))
- Global.GUI.Menus.SetCutCopySensitivity(false);
+ Base.Ui.Menus.SetCutCopySensitivity(false);
else {
- Global.GUI.Menus.SetCutCopySensitivity(true);
+ Base.Ui.Menus.SetCutCopySensitivity(true);
}
}
public bool ValidWidgetHasFocus () {
SpinButton start, end, duration;
TextView textEdit, translationEdit;
- Global.GUI.Edit.GetEditableWidgets (out start, out end, out duration, out textEdit, out translationEdit);
+ Base.Ui.Edit.GetEditableWidgets (out start, out end, out duration, out textEdit, out translationEdit);
return start.HasFocus || end.HasFocus || duration.HasFocus || textEdit.HasFocus || translationEdit.HasFocus;
}
public void Copy () {
- Widget widget = Global.GUI.Window.Focus;
+ Widget widget = Base.Ui.Window.Focus;
if (widget is SpinButton)
(widget as SpinButton).CopyClipboard();
else if (widget is TextView)
@@ -74,7 +74,7 @@
}
public void Cut () {
- Widget widget = Global.GUI.Window.Focus;
+ Widget widget = Base.Ui.Window.Focus;
if (widget is SpinButton)
(widget as SpinButton).CutClipboard();
else if (widget is TextView)
@@ -82,7 +82,7 @@
}
public void Paste () {
- Widget widget = Global.GUI.Window.Focus;
+ Widget widget = Base.Ui.Window.Focus;
if (widget is SpinButton)
(widget as SpinButton).PasteClipboard();
else if (widget is TextView)
Modified: trunk/src/GnomeSubtitles/Core/Command/AdjustTimingsCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/AdjustTimingsCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/AdjustTimingsCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using GnomeSubtitles.Ui.SubtitleView;
+using GnomeSubtitles.Ui.View;
using Mono.Unix;
using System;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public class AdjustTimingsCommand : FixedMultipleSelectionCommand {
private static string description = Catalog.GetString("Adjusting timings");
@@ -58,7 +58,7 @@
}
private void AdjustAllSubtitlesTime () {
- Subtitles subtitles = Global.Document.Subtitles;
+ Subtitles subtitles = Base.Document.Subtitles;
TimeSpan oldFirstTime = subtitles[0].Times.Start;
TimeSpan oldLastTime = subtitles[subtitles.Count - 1].Times.Start;
@@ -70,7 +70,7 @@
}
private void AdjustAllSubtitlesFrames () {
- Subtitles subtitles = Global.Document.Subtitles;
+ Subtitles subtitles = Base.Document.Subtitles;
int oldFirstFrame = subtitles[0].Frames.Start;
int oldLastFrame = subtitles[subtitles.Count - 1].Frames.Start;
@@ -82,7 +82,7 @@
}
private void AdjustSubtitlesTime () {
- Subtitles subtitles = Global.Document.Subtitles;
+ Subtitles subtitles = Base.Document.Subtitles;
int firstSubtitle = Util.PathToInt(FirstPath);
int lastSubtitle = Util.PathToInt(LastPath);
@@ -97,7 +97,7 @@
}
private void AdjustSubtitlesFrames () {
- Subtitles subtitles = Global.Document.Subtitles;
+ Subtitles subtitles = Base.Document.Subtitles;
int firstSubtitle = Util.PathToInt(Paths[0]);
int lastSubtitle = Util.PathToInt(Paths[Paths.Length - 1]);
Modified: trunk/src/GnomeSubtitles/Core/Command/BaseCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/BaseCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/BaseCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public abstract class Command {
private string description;
Modified: trunk/src/GnomeSubtitles/Core/Command/ChangeFrameRateCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/ChangeFrameRateCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/ChangeFrameRateCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,9 +17,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Ui.View;
using Mono.Unix;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public abstract class ChangeFrameRateCommand : FixedMultipleSelectionCommand {
private float storedFrameRate = 0;
@@ -49,15 +50,15 @@
}
protected override float GetFrameRate () {
- return Global.Document.Subtitles.Properties.OriginalFrameRate;
+ return Base.Document.Subtitles.Properties.OriginalFrameRate;
}
protected override void SetFrameRate (float frameRate) {
- Global.Document.Subtitles.ChangeOriginalFrameRate(frameRate);
+ Base.Document.Subtitles.ChangeOriginalFrameRate(frameRate);
}
protected override void UpdateMenuItem () {
- Global.GUI.Menus.UpdateActiveInputFrameRateMenuItem();
+ Base.Ui.Menus.UpdateActiveInputFrameRateMenuItem();
}
}
@@ -68,15 +69,15 @@
}
protected override float GetFrameRate () {
- return Global.Document.Subtitles.Properties.CurrentFrameRate;
+ return Base.Document.Subtitles.Properties.CurrentFrameRate;
}
protected override void SetFrameRate (float frameRate) {
- Global.Document.Subtitles.ChangeFrameRate(frameRate);
+ Base.Document.Subtitles.ChangeFrameRate(frameRate);
}
protected override void UpdateMenuItem () {
- Global.GUI.Menus.UpdateActiveVideoFrameRateMenuItem();
+ Base.Ui.Menus.UpdateActiveVideoFrameRateMenuItem();
}
}
Modified: trunk/src/GnomeSubtitles/Core/Command/ChangeStyleCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/ChangeStyleCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/ChangeStyleCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Ui.View;
using Gtk;
using Mono.Unix;
using SubLib;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public abstract class ChangeStyleCommand : FixedMultipleSelectionCommand {
private bool styleValue;
@@ -32,7 +33,7 @@
protected override bool ChangeValues () {
foreach (TreePath path in Paths) {
- Subtitle subtitle = Global.Document.Subtitles[path];
+ Subtitle subtitle = Base.Document.Subtitles[path];
SetStyle(subtitle, styleValue);
}
ToggleStyleValue();
Modified: trunk/src/GnomeSubtitles/Core/Command/ChangeTimingCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/ChangeTimingCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/ChangeTimingCommand.cs Sun Jun 22 23:46:31 2008
@@ -21,7 +21,7 @@
using SubLib;
using System;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public abstract class ChangeTimingCommand : FixedSingleSelectionCommand {
private TimeSpan storedTime;
@@ -31,12 +31,12 @@
protected Subtitle subtitle = null;
public ChangeTimingCommand (int frames, string description): base(description, true, true) {
- this.subtitle = Global.Document.Subtitles[Path];
+ this.subtitle = Base.Document.Subtitles[Path];
this.storedFrames = frames;
}
public ChangeTimingCommand (TimeSpan time, string description): base(description, true, true) {
- this.subtitle = Global.Document.Subtitles[Path];
+ this.subtitle = Base.Document.Subtitles[Path];
this.storedTime = time;
}
Modified: trunk/src/GnomeSubtitles/Core/Command/CommandActivatedArgs.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/CommandActivatedArgs.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/CommandActivatedArgs.cs Sun Jun 22 23:46:31 2008
@@ -19,7 +19,7 @@
using System;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public class CommandActivatedArgs : EventArgs {
private CommandTarget target;
Modified: trunk/src/GnomeSubtitles/Core/Command/CommandActivatedHandler.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/CommandActivatedHandler.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/CommandActivatedHandler.cs Sun Jun 22 23:46:31 2008
@@ -19,7 +19,7 @@
using System;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public delegate void CommandActivatedHandler (object o, CommandActivatedArgs args);
Modified: trunk/src/GnomeSubtitles/Core/Command/CommandManager.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/CommandManager.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/CommandManager.cs Sun Jun 22 23:46:31 2008
@@ -20,10 +20,10 @@
using Mono.Unix;
using System;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public class CommandManager {
- private int limit = 40;
+ private int limit = -1;
private Command[] commands = null;
private int undoCount = 0;
@@ -33,6 +33,13 @@
public event EventHandler UndoToggled;
public event EventHandler RedoToggled;
public event CommandActivatedHandler CommandActivated;
+
+ #region Constants
+ private const int defaultLimit = 40;
+ #endregion
+
+ public CommandManager () : this(defaultLimit) {
+ }
public CommandManager (int undoLimit) {
limit = undoLimit;
Modified: trunk/src/GnomeSubtitles/Core/Command/CommandTarget.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/CommandTarget.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/CommandTarget.cs Sun Jun 22 23:46:31 2008
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
/// <summary>
/// Represents the target of a command.
Modified: trunk/src/GnomeSubtitles/Core/Command/DeleteSubtitlesCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/DeleteSubtitlesCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/DeleteSubtitlesCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Ui.View;
using Gtk;
using Mono.Unix;
using SubLib;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public class DeleteSubtitlesCommand : MultipleSelectionCommand {
private static string description = Catalog.GetString("Deleting Subtitles");
@@ -33,12 +34,12 @@
public override bool Execute () {
- Global.GUI.View.Remove(Paths);
+ Base.Ui.View.Remove(Paths);
return true;
}
public override void Undo () {
- Global.GUI.View.Insert(subtitles, Paths, Focus);
+ Base.Ui.View.Insert(subtitles, Paths, Focus);
}
public override void Redo () {
@@ -52,7 +53,7 @@
subtitles = new Subtitle[count];
for (int index = 0 ; index < count ; index++) {
TreePath path = Paths[index];
- subtitles[index] = Global.Document.Subtitles[path];
+ subtitles[index] = Base.Document.Subtitles[path];
}
}
Modified: trunk/src/GnomeSubtitles/Core/Command/DeleteTextCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/DeleteTextCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/DeleteTextCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using GnomeSubtitles.Ui.SubtitleEdit;
+using GnomeSubtitles.Ui.Edit;
using Mono.Unix;
using SubLib;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public class DeleteTextCommand : DeleteTextContentCommand {
private static string description = Catalog.GetString("Editing Text"); //Must be equal to InsertTextCommand
@@ -30,7 +30,7 @@
}
protected override SubtitleEditTextView GetTextView () {
- return Global.GUI.Edit.TextEdit;
+ return Base.Ui.Edit.TextEdit;
}
}
Modified: trunk/src/GnomeSubtitles/Core/Command/DeleteTextContentCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/DeleteTextContentCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/DeleteTextContentCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,12 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using GnomeSubtitles.Ui.SubtitleEdit;
+using GnomeSubtitles.Ui.Edit;
using Mono.Unix;
using SubLib;
using System;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public abstract class DeleteTextContentCommand : FixedSingleSelectionCommand {
private int index; //The start offset of the deleted text
@@ -66,14 +66,14 @@
}
public override void Undo () {
- Global.GUI.View.Selection.Select(Path, true, false);
+ Base.Ui.View.Selection.Select(Path, true, false);
SubtitleEditTextView textView = GetTextView();
textView.InsertText(index, text);
PostProcess();
}
public override void Redo () {
- Global.GUI.View.Selection.Select(Path, true, false);
+ Base.Ui.View.Selection.Select(Path, true, false);
SubtitleEditTextView textView = GetTextView();
textView.DeleteText(index, index + text.Length);
PostProcess();
@@ -82,7 +82,7 @@
/* Protected members */
protected override void PostProcess () {
- Global.GUI.View.RedrawPath(Path);
+ Base.Ui.View.RedrawPath(Path);
}
protected int GetIndex () {
Modified: trunk/src/GnomeSubtitles/Core/Command/DeleteTranslationCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/DeleteTranslationCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/DeleteTranslationCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using GnomeSubtitles.Ui.SubtitleEdit;
+using GnomeSubtitles.Ui.Edit;
using Mono.Unix;
using SubLib;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public class DeleteTranslationCommand : DeleteTextContentCommand {
private static string description = Catalog.GetString("Editing Translation"); //Must be equal to InsertTranslationCommand
@@ -31,7 +31,7 @@
}
protected override SubtitleEditTextView GetTextView () {
- return Global.GUI.Edit.TranslationEdit;
+ return Base.Ui.Edit.TranslationEdit;
}
}
Modified: trunk/src/GnomeSubtitles/Core/Command/FixedMultipleSelectionCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/FixedMultipleSelectionCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/FixedMultipleSelectionCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,10 +17,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using GnomeSubtitles.Ui.SubtitleView;
+using GnomeSubtitles.Ui.View;
using Gtk;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
/// <summary>Represents a <see cref="Command" /> in which the selection never changes during execution/undo/redo.</summary>
public abstract class FixedMultipleSelectionCommand : MultipleSelectionCommand {
@@ -50,18 +50,18 @@
switch (SelectionType) {
case SelectionType.All:
- Global.GUI.View.Selection.SelectAll();
+ Base.Ui.View.Selection.SelectAll();
break;
case SelectionType.Range:
- Global.GUI.View.Selection.SelectRange(Paths, Focus, true);
+ Base.Ui.View.Selection.SelectRange(Paths, Focus, true);
break;
case SelectionType.Simple:
- Global.GUI.View.Selection.ScrollToFocus(Focus, true);
+ Base.Ui.View.Selection.ScrollToFocus(Focus, true);
break;
}
- Global.GUI.View.Refresh();
+ Base.Ui.View.Refresh();
if (reselect)
- Global.GUI.UpdateFromSelection();
+ Base.Ui.UpdateFromSelection();
PostProcess();
return true;
@@ -72,17 +72,17 @@
switch (SelectionType) {
case SelectionType.All:
- Global.GUI.View.Selection.SelectAll();
+ Base.Ui.View.Selection.SelectAll();
break;
case SelectionType.Range:
- Global.GUI.View.Selection.SelectRange(Paths, Focus, true);
+ Base.Ui.View.Selection.SelectRange(Paths, Focus, true);
break;
case SelectionType.Simple:
- Global.GUI.View.Selection.Select(Paths, Focus, true);
+ Base.Ui.View.Selection.Select(Paths, Focus, true);
break;
}
- Global.GUI.View.Refresh();
+ Base.Ui.View.Refresh();
PostProcess();
}
Modified: trunk/src/GnomeSubtitles/Core/Command/FixedSingleSelectionCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/FixedSingleSelectionCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/FixedSingleSelectionCommand.cs Sun Jun 22 23:46:31 2008
@@ -19,7 +19,7 @@
using Gtk;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public abstract class FixedSingleSelectionCommand : SingleSelectionCommand {
private bool reselect = false;
@@ -34,10 +34,10 @@
return false;
if (reselect)
- Global.GUI.View.Selection.Select(Path, true, true);
+ Base.Ui.View.Selection.Select(Path, true, true);
else {
- Global.GUI.View.Selection.ScrollToFocus(Path, true);
- Global.GUI.View.Refresh();
+ Base.Ui.View.Selection.ScrollToFocus(Path, true);
+ Base.Ui.View.Refresh();
}
PostProcess();
@@ -46,7 +46,7 @@
public override void Undo () {
ChangeValues();
- Global.GUI.View.Selection.Select(Path, true, true);
+ Base.Ui.View.Selection.Select(Path, true, true);
PostProcess();
}
Modified: trunk/src/GnomeSubtitles/Core/Command/InsertSubtitleCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/InsertSubtitleCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/InsertSubtitleCommand.cs Sun Jun 22 23:46:31 2008
@@ -21,7 +21,7 @@
using Mono.Unix;
using SubLib;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public abstract class InsertSubtitleCommand : SingleSelectionCommand {
private static string description = Catalog.GetString("Inserting Subtitle");
@@ -42,17 +42,17 @@
public override bool Execute () {
InsertNew();
- subtitle = Global.Document.Subtitles[newPath];
+ subtitle = Base.Document.Subtitles[newPath];
return true;
}
public override void Undo () {
bool selectNext = ((Path != null) && (Path.Compare(newPath) == 1));
- Global.GUI.View.Remove(newPath, selectNext);
+ Base.Ui.View.Remove(newPath, selectNext);
}
public override void Redo () {
- Global.GUI.View.Insert(subtitle, newPath);
+ Base.Ui.View.Insert(subtitle, newPath);
}
/* Methods to be extended */
@@ -64,7 +64,7 @@
public class InsertSubtitleAfterCommand : InsertSubtitleCommand {
- public InsertSubtitleAfterCommand () : base(Global.GUI.View.Selection.LastPath) {
+ public InsertSubtitleAfterCommand () : base(Base.Ui.View.Selection.LastPath) {
}
protected override TreePath GetNewPath () {
@@ -72,14 +72,14 @@
}
protected override void InsertNew () {
- Global.GUI.View.InsertNewAfter(Path);
+ Base.Ui.View.InsertNewAfter(Path);
}
}
public class InsertSubtitleBeforeCommand : InsertSubtitleCommand {
- public InsertSubtitleBeforeCommand () : base(Global.GUI.View.Selection.FirstPath) {
+ public InsertSubtitleBeforeCommand () : base(Base.Ui.View.Selection.FirstPath) {
}
protected override TreePath GetNewPath () {
@@ -87,7 +87,7 @@
}
protected override void InsertNew () {
- Global.GUI.View.InsertNewBefore(Path);
+ Base.Ui.View.InsertNewBefore(Path);
}
}
@@ -102,7 +102,7 @@
}
protected override void InsertNew () {
- Global.GUI.View.InsertNewAt(NewPath);
+ Base.Ui.View.InsertNewAt(NewPath);
}
}
Modified: trunk/src/GnomeSubtitles/Core/Command/InsertTextCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/InsertTextCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/InsertTextCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using GnomeSubtitles.Ui.SubtitleEdit;
+using GnomeSubtitles.Ui.Edit;
using Mono.Unix;
using SubLib;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public class InsertTextCommand : InsertTextContentCommand {
private static string description = Catalog.GetString("Editing Text"); //Must be equal to DeleteTextCommand
@@ -30,7 +30,7 @@
}
protected override SubtitleEditTextView GetTextView () {
- return Global.GUI.Edit.TextEdit;
+ return Base.Ui.Edit.TextEdit;
}
}
Modified: trunk/src/GnomeSubtitles/Core/Command/InsertTextContentCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/InsertTextContentCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/InsertTextContentCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,12 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using GnomeSubtitles.Ui.SubtitleEdit;
+using GnomeSubtitles.Ui.Edit;
using Mono.Unix;
using SubLib;
using System;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public abstract class InsertTextContentCommand : FixedSingleSelectionCommand {
private int index; //The offset where the text was inserted
@@ -59,14 +59,14 @@
}
public override void Undo () {
- Global.GUI.View.Selection.Select(Path, true, false);
+ Base.Ui.View.Selection.Select(Path, true, false);
SubtitleEditTextView textView = GetTextView();
textView.DeleteText(index, index + text.Length);
PostProcess();
}
public override void Redo () {
- Global.GUI.View.Selection.Select(Path, true, false);
+ Base.Ui.View.Selection.Select(Path, true, false);
SubtitleEditTextView textView = GetTextView();
textView.InsertText(index, text);
PostProcess();
@@ -75,7 +75,7 @@
/* Protected members */
protected override void PostProcess () {
- Global.GUI.View.RedrawPath(Path);
+ Base.Ui.View.RedrawPath(Path);
}
protected int GetIndex () {
Modified: trunk/src/GnomeSubtitles/Core/Command/InsertTranslationCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/InsertTranslationCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/InsertTranslationCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using GnomeSubtitles.Ui.SubtitleEdit;
+using GnomeSubtitles.Ui.Edit;
using Mono.Unix;
using SubLib;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public class InsertTranslationCommand : InsertTextContentCommand {
private static string description = Catalog.GetString("Editing Translation"); //Must be equal to DeleteTranslationCommand
@@ -31,7 +31,7 @@
}
protected override SubtitleEditTextView GetTextView () {
- return Global.GUI.Edit.TranslationEdit;
+ return Base.Ui.Edit.TranslationEdit;
}
}
Modified: trunk/src/GnomeSubtitles/Core/Command/MultipleSelectionCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/MultipleSelectionCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/MultipleSelectionCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,10 +17,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using GnomeSubtitles.Ui.SubtitleView;
+using GnomeSubtitles.Ui.View;
using Gtk;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public abstract class MultipleSelectionCommand : Command {
private TreePath[] paths = null;
@@ -40,20 +40,20 @@
if (setPaths) {
switch (selectionIntended) {
case SelectionIntended.Simple:
- this.paths = Global.GUI.View.Selection.Paths;
- this.focus = Global.GUI.View.Selection.Focus;
+ this.paths = Base.Ui.View.Selection.Paths;
+ this.focus = Base.Ui.View.Selection.Focus;
break;
case SelectionIntended.Range:
- this.paths = Global.GUI.View.Selection.Range;
- this.focus = Global.GUI.View.Selection.Focus;
+ this.paths = Base.Ui.View.Selection.Range;
+ this.focus = Base.Ui.View.Selection.Focus;
break;
case SelectionIntended.SimpleToFirst:
- this.paths = Global.GUI.View.Selection.PathsToFirst;
- this.focus = Global.GUI.View.Selection.Focus;
+ this.paths = Base.Ui.View.Selection.PathsToFirst;
+ this.focus = Base.Ui.View.Selection.Focus;
break;
case SelectionIntended.SimpleToLast:
- this.paths = Global.GUI.View.Selection.PathsToLast;
- this.focus = Global.GUI.View.Selection.Focus;
+ this.paths = Base.Ui.View.Selection.PathsToLast;
+ this.focus = Base.Ui.View.Selection.Focus;
break;
}
}
Modified: trunk/src/GnomeSubtitles/Core/Command/ReplaceAllCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/ReplaceAllCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/ReplaceAllCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,13 +17,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Ui.View;
using Gtk;
using Mono.Unix;
using SubLib;
using System;
using System.Text.RegularExpressions;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public class ReplaceAllCommand : MultipleSelectionCommand {
private static string description = Catalog.GetString("Replacing All");
@@ -41,7 +42,7 @@
public override bool Execute () {
- int count = Global.Document.Subtitles.ReplaceAll(regex, replacement, out subtitles, out texts);
+ int count = Base.Document.Subtitles.ReplaceAll(regex, replacement, out subtitles, out texts);
if (count == 0)
return false;
@@ -49,21 +50,21 @@
if (Paths.Length > 0)
Focus = Paths[0];
- Global.GUI.View.Selection.Select(Paths, Focus, true);
+ Base.Ui.View.Selection.Select(Paths, Focus, true);
return true;
}
public override void Undo () {
for (int position = 0 ; position < subtitles.Length ; position++) {
int index = subtitles[position];
- Subtitle subtitle = Global.Document.Subtitles[index];
+ Subtitle subtitle = Base.Document.Subtitles[index];
string oldText = subtitle.Text.Get();
string newText = texts[position];
subtitle.Text.Set(newText);
texts[position] = oldText;
}
- Global.GUI.View.Selection.Select(Paths, Focus, true);
+ Base.Ui.View.Selection.Select(Paths, Focus, true);
}
public override void Redo () {
Modified: trunk/src/GnomeSubtitles/Core/Command/ShiftTimingsCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/ShiftTimingsCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/ShiftTimingsCommand.cs Sun Jun 22 23:46:31 2008
@@ -17,13 +17,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using GnomeSubtitles.Ui.SubtitleView;
+using GnomeSubtitles.Ui.View;
using Gtk;
using Mono.Unix;
using SubLib;
using System;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public class ShiftTimingsCommand : FixedMultipleSelectionCommand {
private static string description = Catalog.GetString("Shifting timings");
@@ -64,18 +64,18 @@
/* Private Members */
private void ShiftTimesAll () {
- Global.Document.Subtitles.ShiftTimings(time);
+ Base.Document.Subtitles.ShiftTimings(time);
time = time.Negate();
}
private void ShiftFramesAll () {
- Global.Document.Subtitles.ShiftTimings(frames);
+ Base.Document.Subtitles.ShiftTimings(frames);
frames = -frames;
}
private void ShiftTimesSimple () {
foreach (TreePath path in Paths) {
- Subtitle subtitle = Global.Document.Subtitles[path];
+ Subtitle subtitle = Base.Document.Subtitles[path];
subtitle.Times.Shift(time);
}
time = time.Negate();
@@ -83,7 +83,7 @@
private void ShiftFramesSimple () {
foreach (TreePath path in Paths) {
- Subtitle subtitle = Global.Document.Subtitles[path];
+ Subtitle subtitle = Base.Document.Subtitles[path];
subtitle.Frames.Shift(frames);
}
frames = -frames;
@@ -93,7 +93,7 @@
int firstSubtitle = Util.PathToInt(FirstPath);
int lastSubtitle = Util.PathToInt(LastPath);
- Global.Document.Subtitles.ShiftTimings(time, firstSubtitle, lastSubtitle);
+ Base.Document.Subtitles.ShiftTimings(time, firstSubtitle, lastSubtitle);
time = time.Negate();
}
@@ -101,7 +101,7 @@
int firstSubtitle = Util.PathToInt(FirstPath);
int lastSubtitle = Util.PathToInt(LastPath);
- Global.Document.Subtitles.ShiftTimings(frames, firstSubtitle, lastSubtitle);
+ Base.Document.Subtitles.ShiftTimings(frames, firstSubtitle, lastSubtitle);
frames = -frames;
}
}
Modified: trunk/src/GnomeSubtitles/Core/Command/SingleSelectionCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/SingleSelectionCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/SingleSelectionCommand.cs Sun Jun 22 23:46:31 2008
@@ -19,12 +19,12 @@
using Gtk;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public abstract class SingleSelectionCommand : Command {
private TreePath path = null;
- public SingleSelectionCommand (string description, bool canGroup) : this(description, canGroup, Global.GUI.View.Selection.Path) {
+ public SingleSelectionCommand (string description, bool canGroup) : this(description, canGroup, Base.Ui.View.Selection.Path) {
}
public SingleSelectionCommand (string description, bool canGroup, TreePath path) : base(description, canGroup) {
Modified: trunk/src/GnomeSubtitles/Core/Command/VideoSetSubtitleTimingCommand.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Command/VideoSetSubtitleTimingCommand.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Command/VideoSetSubtitleTimingCommand.cs Sun Jun 22 23:46:31 2008
@@ -20,7 +20,7 @@
using Mono.Unix;
using System;
-namespace GnomeSubtitles.Command {
+namespace GnomeSubtitles.Core.Command {
public class VideoSetSubtitleStartCommand : ChangeStartCommand {
private static string description = Catalog.GetString("Setting Subtitle Start");
Modified: trunk/src/GnomeSubtitles/Core/Document.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Document.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Document.cs Sun Jun 22 23:46:31 2008
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using GnomeSubtitles.Command;
+using GnomeSubtitles.Core.Command;
using Mono.Unix;
using SubLib;
using System.IO;
@@ -26,7 +26,7 @@
namespace GnomeSubtitles.Core {
public class Document {
- private Subtitles subtitles = null;
+ private Ui.View.Subtitles subtitles = null;
private bool wasTextModified = false;
private bool wasTranslationModified = false;
@@ -58,7 +58,7 @@
get { return translationFile != null; }
}
- public Subtitles Subtitles {
+ public Ui.View.Subtitles Subtitles {
get { return subtitles; }
}
@@ -87,7 +87,7 @@
textFile = saver.FileProperties;
canTextBeSaved = true;
- Global.GUI.Menus.SetActiveTimingMode(textFile.TimingMode);
+ Base.Ui.Menus.SetActiveTimingMode(textFile.TimingMode);
ClearTextModified();
return true;
@@ -98,13 +98,13 @@
ClearTranslationStatus();
CreateNewTranslationFileProperties();
- Global.GUI.UpdateFromNewTranslationDocument();
+ Base.Ui.UpdateFromNewTranslationDocument();
}
public void CloseTranslation () {
RemoveTranslationFromSubtitles();
ClearTranslationStatus();
- Global.GUI.UpdateFromCloseTranslation();
+ Base.Ui.UpdateFromCloseTranslation();
}
public void OpenTranslation (string path, Encoding encoding) {
@@ -124,7 +124,7 @@
canTranslationBeSaved = true;
translationFile = newTranslationFile;
- Global.GUI.UpdateFromNewTranslationDocument();
+ Base.Ui.UpdateFromNewTranslationDocument();
}
public bool SaveTranslation (FileProperties newFileProperties) {
@@ -141,11 +141,11 @@
public void UpdateFromCommandActivated (CommandTarget target) {
if ((target == CommandTarget.Normal) && (!wasTextModified)) {
wasTextModified = true;
- Global.GUI.UpdateFromDocumentModified(true);
+ Base.Ui.UpdateFromDocumentModified(true);
}
else if ((target == CommandTarget.Translation) && (!wasTranslationModified)) {
wasTranslationModified = true;
- Global.GUI.UpdateFromDocumentModified(true);
+ Base.Ui.UpdateFromDocumentModified(true);
}
}
@@ -157,7 +157,7 @@
SubtitleFactory factory = new SubtitleFactory();
factory.Verbose = true;
- subtitles = new Subtitles(factory.New());
+ subtitles = new Ui.View.Subtitles(factory.New());
textFile = new FileProperties(path);
}
@@ -176,7 +176,7 @@
return;
}
- subtitles = new Subtitles(openedSubtitles);
+ subtitles = new Ui.View.Subtitles(openedSubtitles);
textFile = factory.FileProperties;
if (textFile.SubtitleType != SubtitleType.Unknown)
@@ -186,13 +186,13 @@
private void ClearTextModified () {
wasTextModified = false;
if (!wasTranslationModified) //Update the GUI if translation is also not in modified state
- Global.GUI.UpdateFromDocumentModified(false);
+ Base.Ui.UpdateFromDocumentModified(false);
}
private void ClearTranslationModified () {
wasTranslationModified = false;
if (!wasTextModified) //Update the GUI if text is also not in modified state
- Global.GUI.UpdateFromDocumentModified(false);
+ Base.Ui.UpdateFromDocumentModified(false);
}
private void CreateNewTranslationFileProperties () {
@@ -211,7 +211,7 @@
translationFile = null;
canTranslationBeSaved = false;
- Global.CommandManager.ClearTarget(CommandTarget.Translation);
+ Base.CommandManager.ClearTarget(CommandTarget.Translation);
ClearTranslationModified();
}
Modified: trunk/src/GnomeSubtitles/Core/EventHandlers.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/EventHandlers.cs (original)
+++ trunk/src/GnomeSubtitles/Core/EventHandlers.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core.Command;
+using GnomeSubtitles.Dialog;
+using GnomeSubtitles.Ui;
using Gnome;
using Gtk;
using Mono.Unix;
@@ -35,39 +38,39 @@
/* File Menu */
public void OnFileNew (object o, EventArgs args) {
- Global.GUI.New(String.Empty);
+ Base.Ui.New(String.Empty);
}
public void OnFileOpen (object o, EventArgs args) {
- Global.GUI.Open();
+ Base.Ui.Open();
}
public void OnFileSave (object o, EventArgs args) {
- Global.GUI.Save();
+ Base.Ui.Save();
}
public void OnFileSaveAs (object o, EventArgs args) {
- Global.GUI.SaveAs();
+ Base.Ui.SaveAs();
}
public void OnFileTranslationNew (object o, EventArgs args) {
- Global.GUI.TranslationNew();
+ Base.Ui.TranslationNew();
}
public void OnFileTranslationOpen (object o, EventArgs args) {
- Global.GUI.TranslationOpen();
+ Base.Ui.TranslationOpen();
}
public void OnFileTranslationSave (object o, EventArgs args) {
- Global.GUI.TranslationSave();
+ Base.Ui.TranslationSave();
}
public void OnFileTranslationSaveAs (object o, EventArgs args) {
- Global.GUI.TranslationSaveAs();
+ Base.Ui.TranslationSaveAs();
}
public void OnFileTranslationClose (object o, EventArgs args) {
- Global.GUI.TranslationClose();
+ Base.Ui.TranslationClose();
}
public void OnFileHeaders (object o, EventArgs args) {
@@ -79,61 +82,61 @@
}
public void OnFileQuit (object o, EventArgs args) {
- Global.GUI.Quit();
+ Base.Ui.Quit();
}
/* Edit Menu */
public void OnEditUndo (object o, EventArgs args) {
- Global.CommandManager.Undo();
+ Base.CommandManager.Undo();
}
public void OnEditRedo (object o, EventArgs args) {
- Global.CommandManager.Redo();
+ Base.CommandManager.Redo();
}
public void OnEditCopy (object o, EventArgs args) {
- Global.Clipboards.Copy();
+ Base.Clipboards.Copy();
}
public void OnEditCut (object o, EventArgs args) {
- Global.Clipboards.Cut();
+ Base.Clipboards.Cut();
}
public void OnEditPaste (object o, EventArgs args) {
- Global.Clipboards.Paste();
+ Base.Clipboards.Paste();
}
public void OnEditFormatBold (object o, EventArgs args) {
bool newBoldValue = ((o is CheckMenuItem) ? (o as CheckMenuItem).Active : (o as ToggleToolButton).Active);
- Global.CommandManager.Execute(new ChangeBoldStyleCommand(newBoldValue));
+ Base.CommandManager.Execute(new ChangeBoldStyleCommand(newBoldValue));
}
public void OnEditFormatItalic (object o, EventArgs args) {
bool newItalicValue = ((o is CheckMenuItem) ? (o as CheckMenuItem).Active : (o as ToggleToolButton).Active);
- Global.CommandManager.Execute(new ChangeItalicStyleCommand(newItalicValue));
+ Base.CommandManager.Execute(new ChangeItalicStyleCommand(newItalicValue));
}
public void OnEditFormatUnderline (object o, EventArgs args) {
bool newUnderlineValue = ((o is CheckMenuItem) ? (o as CheckMenuItem).Active : (o as ToggleToolButton).Active);
- Global.CommandManager.Execute(new ChangeUnderlineStyleCommand(newUnderlineValue));
+ Base.CommandManager.Execute(new ChangeUnderlineStyleCommand(newUnderlineValue));
}
public void OnEditInsertSubtitleBefore (object o, EventArgs args) {
- Global.CommandManager.Execute(new InsertSubtitleBeforeCommand());
+ Base.CommandManager.Execute(new InsertSubtitleBeforeCommand());
}
public void OnEditInsertSubtitleAfter (object o, EventArgs args) {
- if (Global.Document.Subtitles.Count == 0)
- Global.CommandManager.Execute(new InsertFirstSubtitleCommand());
+ if (Base.Document.Subtitles.Count == 0)
+ Base.CommandManager.Execute(new InsertFirstSubtitleCommand());
else
- Global.CommandManager.Execute(new InsertSubtitleAfterCommand());
+ Base.CommandManager.Execute(new InsertSubtitleAfterCommand());
}
public void OnEditDeleteSubtitles (object o, EventArgs args) {
- if (Global.GUI.View.Selection.Count > 0)
- Global.CommandManager.Execute(new DeleteSubtitlesCommand());
+ if (Base.Ui.View.Selection.Count > 0)
+ Base.CommandManager.Execute(new DeleteSubtitlesCommand());
}
public void OnEditPreferences (object o, EventArgs args) {
@@ -144,48 +147,48 @@
public void OnViewTimes (object o, EventArgs args) {
if ((o as RadioMenuItem).Active)
- Global.TimingMode = TimingMode.Times;
+ Base.TimingMode = TimingMode.Times;
}
public void OnViewFrames (object o, EventArgs args) {
if ((o as RadioMenuItem).Active)
- Global.TimingMode = TimingMode.Frames;
+ Base.TimingMode = TimingMode.Frames;
}
public void OnViewVideo (object o, EventArgs args) {
if ((o as CheckMenuItem).Active)
- Global.GUI.Video.Show();
+ Base.Ui.Video.Show();
else
- Global.GUI.Video.Hide();
+ Base.Ui.Video.Hide();
}
public void OnViewVideoSubtitlesText (object o, EventArgs args) {
if ((o as RadioMenuItem).Active)
- Global.GUI.Video.Subtitle.ToShowText = true;
+ Base.Ui.Video.Subtitle.ToShowText = true;
}
public void OnViewVideoSubtitlesTranslation (object o, EventArgs args) {
if ((o as RadioMenuItem).Active)
- Global.GUI.Video.Subtitle.ToShowText = false;
+ Base.Ui.Video.Subtitle.ToShowText = false;
}
/* Search Menu */
public void OnSearchFind (object o, EventArgs args) {
- Global.GUI.View.Search.ShowFind();
+ Base.Ui.View.Search.ShowFind();
}
public void OnSearchFindNext (object o, EventArgs args) {
- Global.GUI.View.Search.FindNext();
+ Base.Ui.View.Search.FindNext();
}
public void OnSearchFindPrevious (object o, EventArgs args) {
- Global.GUI.View.Search.FindPrevious();
+ Base.Ui.View.Search.FindPrevious();
}
public void OnSearchReplace (object o, EventArgs args) {
- Global.GUI.View.Search.ShowReplace();
+ Base.Ui.View.Search.ShowReplace();
}
/* Timings Menu */
@@ -194,7 +197,7 @@
RadioMenuItem menuItem = o as RadioMenuItem;
if (menuItem.Active) {
float frameRate = Menus.FrameRateFromMenuItem((menuItem.Child as Label).Text);
- Global.CommandManager.Execute(new ChangeInputFrameRateCommand(frameRate));
+ Base.CommandManager.Execute(new ChangeInputFrameRateCommand(frameRate));
}
}
@@ -202,7 +205,7 @@
RadioMenuItem menuItem = o as RadioMenuItem;
if (menuItem.Active) {
float frameRate = Menus.FrameRateFromMenuItem((menuItem.Child as Label).Text);
- Global.CommandManager.Execute(new ChangeVideoFrameRateCommand(frameRate));
+ Base.CommandManager.Execute(new ChangeVideoFrameRateCommand(frameRate));
}
}
@@ -211,56 +214,56 @@
}
public void OnTimingsShift (object o, EventArgs args) {
- Global.Dialogs.TimingsShiftDialog.Show();
+ Base.Dialogs.TimingsShiftDialog.Show();
}
/* Video Menu */
public void OnVideoOpen (object o, EventArgs args) {
- Global.GUI.OpenVideo();
+ Base.Ui.OpenVideo();
}
public void OnVideoClose (object o, EventArgs args) {
- Global.GUI.CloseVideo();
+ Base.Ui.CloseVideo();
}
public void OnVideoPlayPause (object o, EventArgs args) {
- ToggleButton button = Global.GetWidget(WidgetNames.VideoPlayPauseButton) as ToggleButton;
+ ToggleButton button = Base.GetWidget(WidgetNames.VideoPlayPauseButton) as ToggleButton;
button.Active = !button.Active; //Toggle() only emits the Toggled event
}
public void OnVideoRewind (object o, EventArgs args) {
- Global.GUI.Video.Rewind();
+ Base.Ui.Video.Rewind();
}
public void OnVideoForward (object o, EventArgs args) {
- Global.GUI.Video.Forward();
+ Base.Ui.Video.Forward();
}
public void OnVideoSeekToSelection (object o, EventArgs args) {
- Global.GUI.Video.SeekToSelection();
+ Base.Ui.Video.SeekToSelection();
}
public void OnVideoSetSubtitleStart (object o, EventArgs args) {
- if (Global.TimingMode == TimingMode.Times) {
- TimeSpan time = Global.GUI.Video.Position.CurrentTime;
- Global.CommandManager.Execute(new VideoSetSubtitleStartCommand(time));
+ if (Base.TimingMode == TimingMode.Times) {
+ TimeSpan time = Base.Ui.Video.Position.CurrentTime;
+ Base.CommandManager.Execute(new VideoSetSubtitleStartCommand(time));
}
else {
- int frames = Global.GUI.Video.Position.CurrentFrames;
- Global.CommandManager.Execute(new VideoSetSubtitleStartCommand(frames));
+ int frames = Base.Ui.Video.Position.CurrentFrames;
+ Base.CommandManager.Execute(new VideoSetSubtitleStartCommand(frames));
}
}
public void OnVideoSetSubtitleEnd (object o, EventArgs args) {
- if (Global.TimingMode == TimingMode.Times) {
- TimeSpan time = Global.GUI.Video.Position.CurrentTime;
- Global.CommandManager.Execute(new VideoSetSubtitleEndCommand(time));
+ if (Base.TimingMode == TimingMode.Times) {
+ TimeSpan time = Base.Ui.Video.Position.CurrentTime;
+ Base.CommandManager.Execute(new VideoSetSubtitleEndCommand(time));
}
else {
- int frames = Global.GUI.Video.Position.CurrentFrames;
- Global.CommandManager.Execute(new VideoSetSubtitleEndCommand(frames));
+ int frames = Base.Ui.Video.Position.CurrentFrames;
+ Base.CommandManager.Execute(new VideoSetSubtitleEndCommand(frames));
}
}
@@ -268,7 +271,7 @@
public void OnToolsAutocheckSpelling (object o, EventArgs args) {
bool enabled = (o as CheckMenuItem).Active;
- Global.SpellLanguages.Enabled = enabled;
+ Base.SpellLanguages.Enabled = enabled;
}
public void OnToolsSetTextLanguage (object o, EventArgs args) {
@@ -285,7 +288,7 @@
public void OnHelpContents (object o, EventArgs args) {
try {
const string filename = "gnome-subtitles.xml";
- Gnome.Help.DisplayDesktopOnScreen(Gnome.Program.Get(), Global.Execution.SystemHelpDir, filename, null, Global.GUI.Window.Screen);
+ Gnome.Help.DisplayDesktopOnScreen(Gnome.Program.Get(), Base.ExecutionContext.SystemHelpDir, filename, null, Base.Ui.Window.Screen);
}
catch (Exception e) {
System.Console.Error.WriteLine(e);
@@ -302,27 +305,27 @@
}
public void OnHelpAbout (object o, EventArgs args) {
- new AboutDialog().Show();
+ new Dialog.AboutDialog().Show();
}
/* Window */
public void OnWindowDelete (object o, DeleteEventArgs args) {
- Global.GUI.Quit();
+ Base.Ui.Quit();
args.RetVal = true;
}
public void OnSizeAllocated (object o, SizeAllocatedArgs args) {
- Global.Config.PrefsWindowWidth = args.Allocation.Width;
- Global.Config.PrefsWindowHeight = args.Allocation.Height;
+ Base.Config.PrefsWindowWidth = args.Allocation.Width;
+ Base.Config.PrefsWindowHeight = args.Allocation.Height;
}
/* Subtitle View */
public void OnRowActivated (object o, RowActivatedArgs args) {
- Global.GUI.Video.SeekToSelection();
+ Base.Ui.Video.SeekToSelection();
}
public void OnSubtitleViewKeyPressed (object o, KeyPressEventArgs args) {
@@ -337,24 +340,24 @@
/* Command Manager */
private void OnUndoToggled (object o, EventArgs args) {
- Global.GUI.Menus.UpdateFromUndoToggled();
+ Base.Ui.Menus.UpdateFromUndoToggled();
}
private void OnRedoToggled (object o, EventArgs args) {
- Global.GUI.Menus.UpdateFromRedoToggled();
+ Base.Ui.Menus.UpdateFromRedoToggled();
}
private void OnCommandActivated (object o, CommandActivatedArgs args) {
- Global.GUI.Menus.UpdateFromCommandActivated();
- Global.Document.UpdateFromCommandActivated(args.Target);
+ Base.Ui.Menus.UpdateFromCommandActivated();
+ Base.Document.UpdateFromCommandActivated(args.Target);
}
/* Private members */
private void ConnectSignals () {
- Global.CommandManager.UndoToggled += OnUndoToggled;
- Global.CommandManager.RedoToggled += OnRedoToggled;
- Global.CommandManager.CommandActivated += OnCommandActivated;
+ Base.CommandManager.UndoToggled += OnUndoToggled;
+ Base.CommandManager.RedoToggled += OnRedoToggled;
+ Base.CommandManager.CommandActivated += OnCommandActivated;
}
}
Modified: trunk/src/GnomeSubtitles/Core/Search.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/Search.cs (original)
+++ trunk/src/GnomeSubtitles/Core/Search.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core.Command;
+using GnomeSubtitles.Dialog;
using Gtk;
using SubLib;
using System;
@@ -43,7 +45,7 @@
}
public bool Find () {
- Global.GUI.Menus.EnableFindNextPrevious();
+ Base.Ui.Menus.EnableFindNextPrevious();
if (dialog.Backwards)
return FindPrevious();
@@ -68,13 +70,13 @@
return Find();
string replacement = dialog.Replacement;
- Global.GUI.Edit.ReplaceSelection(replacement);
+ Base.Ui.Edit.ReplaceSelection(replacement);
return Find();
}
public void ReplaceAll () {
- Global.CommandManager.Execute(new ReplaceAllCommand(dialog.ForwardRegex, dialog.Replacement));
+ Base.CommandManager.Execute(new ReplaceAllCommand(dialog.ForwardRegex, dialog.Replacement));
}
/// <summary>Does some cleanup to make sure the dialog is like a brand new one.</summary>
@@ -89,7 +91,7 @@
#region Private methods
private void InitDialog (bool showReplace) {
- dialog = Global.Dialogs.SearchDialog;
+ dialog = Base.Dialogs.SearchDialog;
dialog.Show(showReplace);
}
@@ -113,7 +115,7 @@
/* Search */
SubtitleSearchOptions options = new SubtitleSearchOptions(regex, textType, subtitle, index, dialog.Wrap, backwards);
- SubtitleSearchResults results = Global.Document.Subtitles.Find(options);
+ SubtitleSearchResults results = Base.Document.Subtitles.Find(options);
/* If no text was found, return */
if (results == null)
@@ -122,7 +124,7 @@
/* Text was found, selecting it */
int start, end;
GetIndexesToSelect(results.Index, results.Index + results.Length, backwards, out start, out end);
- Global.GUI.View.Selection.Select(Util.IntToPath(results.Subtitle), true, true, start, end, results.TextType);
+ Base.Ui.View.Selection.Select(Util.IntToPath(results.Subtitle), true, true, start, end, results.TextType);
return true;
}
@@ -133,8 +135,8 @@
/// <remarks>If no subtitle is being edited, both indexes are set to zero.
/// If no text is selected, both indexes are set to the position of the cursor.</remarks>
private void GetTextContentSelectionIndexes (out int start, out int end, out SubtitleTextType textType) {
- if (Global.GUI.Edit.Enabled && Global.GUI.Edit.TextOrTranslationIsFocus)
- Global.GUI.Edit.GetTextSelectionBounds(out start, out end, out textType);
+ if (Base.Ui.Edit.Enabled && Base.Ui.Edit.TextOrTranslationIsFocus)
+ Base.Ui.Edit.GetTextSelectionBounds(out start, out end, out textType);
else {
start = 0;
end = 0;
@@ -155,7 +157,7 @@
/// <summary>The currently focused subtitle, or 0 if none is.</summary>
private int GetFocusedSubtitle() {
- TreePath focus = Global.GUI.View.Selection.Focus;
+ TreePath focus = Base.Ui.View.Selection.Focus;
if (focus != null)
return Util.PathToInt(focus);
else
@@ -163,7 +165,7 @@
}
private bool SelectionMatchesSearch () {
- string selection = Global.GUI.Edit.SelectedTextContent;
+ string selection = Base.Ui.Edit.SelectedTextContent;
if (selection == String.Empty)
return false;
Modified: trunk/src/GnomeSubtitles/Core/SpellLanguages.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/SpellLanguages.cs (original)
+++ trunk/src/GnomeSubtitles/Core/SpellLanguages.cs Sun Jun 22 23:46:31 2008
@@ -87,7 +87,7 @@
set {
if (value != enabled) {
enabled = value;
- Global.Config.PrefsSpellCheckAutocheck = value;
+ Base.Config.PrefsSpellCheckAutocheck = value;
EmitToggleEnabled();
}
}
@@ -140,7 +140,7 @@
EmitLanguageChanged(textType);
if (!isEmpty)
- Global.GUI.Menus.SetToolsAutocheckSpellingSensitivity(true);
+ Base.Ui.Menus.SetToolsAutocheckSpellingSensitivity(true);
}
/* LibEnchant imports */
@@ -179,22 +179,22 @@
}
private void GetActiveLanguagesFromConfig () {
- string activeTextLanguage = Global.Config.PrefsSpellCheckActiveTextLanguage;
+ string activeTextLanguage = Base.Config.PrefsSpellCheckActiveTextLanguage;
this.activeTextLanguageIndex = GetLanguageIndex(activeTextLanguage);
- string activeTranslationLanguage = Global.Config.PrefsSpellCheckActiveTranslationLanguage;
+ string activeTranslationLanguage = Base.Config.PrefsSpellCheckActiveTranslationLanguage;
this.activeTranslationLanguageIndex = GetLanguageIndex(activeTranslationLanguage);
}
private void GetEnabledFromConfig () {
- this.enabled = Global.Config.PrefsSpellCheckAutocheck;
+ this.enabled = Base.Config.PrefsSpellCheckAutocheck;
}
private void SetActiveLanguageInConfig (SubtitleTextType textType, string activeLanguage) {
if (textType == SubtitleTextType.Text)
- Global.Config.PrefsSpellCheckActiveTextLanguage = activeLanguage;
+ Base.Config.PrefsSpellCheckActiveTextLanguage = activeLanguage;
else
- Global.Config.PrefsSpellCheckActiveTranslationLanguage = activeLanguage;
+ Base.Config.PrefsSpellCheckActiveTranslationLanguage = activeLanguage;
}
private int GetLanguageIndex (string languageID) {
Modified: trunk/src/GnomeSubtitles/Dialog/AboutDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/AboutDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/AboutDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Gtk;
using System;
@@ -57,8 +58,8 @@
#pragma warning disable 618 //TODO Name has been deprecated
private void SetInfo () {
dialog.Name = "Gnome Subtitles"; //TODO Deprecated property, need to change to ProgramName. Scheduled for substitution when gtk# 2.12 is available in all major distros.
- dialog.Comments += "\n\nUsing SubLib " + Global.Execution.SubLibVersion;
- dialog.Version = Global.Execution.Version;
+ dialog.Comments += "\n\nUsing SubLib " + Base.ExecutionContext.SubLibVersion;
+ dialog.Version = Base.ExecutionContext.Version;
dialog.Logo = new Gdk.Pixbuf(null, logoFilename);
}
Modified: trunk/src/GnomeSubtitles/Dialog/EncodingsDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/EncodingsDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/EncodingsDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Dialog;
using Glade;
using Gtk;
using Mono.Unix;
@@ -70,7 +72,7 @@
private void FillShownEncodings () {
SetColumns(shownTreeView);
- chosenNames = Global.Config.PrefsEncodingsShownInMenu;
+ chosenNames = Base.Config.PrefsEncodingsShownInMenu;
ListStore store = new ListStore(typeof(string), typeof(string));
foreach (string shownEncoding in chosenNames) {
@@ -173,7 +175,7 @@
private void UpdateShownEncodingsPrefs () {
chosenNames = GetShownNames();
- Global.Config.PrefsEncodingsShownInMenu = chosenNames;
+ Base.Config.PrefsEncodingsShownInMenu = chosenNames;
}
Modified: trunk/src/GnomeSubtitles/Dialog/ErrorDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/ErrorDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/ErrorDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Dialog;
using Gtk;
using Mono.Unix;
using System;
Modified: trunk/src/GnomeSubtitles/Dialog/FileOpenDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/FileOpenDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/FileOpenDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Ui.VideoPreview;
using Glade;
using Gtk;
using Mono.Unix;
@@ -62,7 +64,7 @@
videoLabel.Visible = true;
videoComboBox.Visible = true;
- autoChooseVideoFile = Global.Config.PrefsVideoAutoChooseFile;
+ autoChooseVideoFile = Base.Config.PrefsVideoAutoChooseFile;
videoComboBox.RowSeparatorFunc = SeparatorFunc;
dialog.CurrentFolderChanged += OnCurrentFolderChanged;
@@ -84,8 +86,8 @@
/* Protected members */
protected virtual string GetStartFolder () {
- if (Global.IsDocumentLoaded && Global.Document.TextFile.IsPathRooted)
- return Global.Document.TextFile.Directory;
+ if (Base.IsDocumentLoaded && Base.Document.TextFile.IsPathRooted)
+ return Base.Document.TextFile.Directory;
else
return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
}
Modified: trunk/src/GnomeSubtitles/Dialog/FilePropertiesDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/FilePropertiesDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/FilePropertiesDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Glade;
using Gtk;
using Mono.Unix;
@@ -46,7 +47,7 @@
/* Private methods */
private void FillLabelValues () {
- FileProperties properties = Global.Document.TextFile;
+ FileProperties properties = Base.Document.TextFile;
FillName(properties.Filename);
FillPath(properties.Directory);
Modified: trunk/src/GnomeSubtitles/Dialog/FileSaveAsDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/FileSaveAsDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/FileSaveAsDialog.cs Sun Jun 22 23:46:31 2008
@@ -18,6 +18,7 @@
*/
using Glade;
+using GnomeSubtitles.Core;
using Gtk;
using Mono.Unix;
using SubLib;
@@ -69,7 +70,7 @@
protected override int GetFixedEncoding () {
try {
- return Global.Document.TextFile.Encoding.CodePage;
+ return Base.Document.TextFile.Encoding.CodePage;
}
catch (NullReferenceException) {
return -1;
@@ -87,7 +88,7 @@
}
private void UpdateContents () {
- FileProperties fileProperties = (textType == SubtitleTextType.Text ? Global.Document.TextFile : Global.Document.TranslationFile);
+ FileProperties fileProperties = (textType == SubtitleTextType.Text ? Base.Document.TextFile : Base.Document.TranslationFile);
if (fileProperties.IsPathRooted)
dialog.SetCurrentFolder(fileProperties.Directory);
@@ -112,7 +113,7 @@
}
private void SetActiveFormat () {
- SubtitleType subtitleType = Global.Document.TextFile.SubtitleType; //The type of the subtitle file
+ SubtitleType subtitleType = Base.Document.TextFile.SubtitleType; //The type of the subtitle file
int position = FindSubtitleTypePosition(subtitleType);
if (position != -1) {
formatComboBox.Active = position;
@@ -120,7 +121,7 @@
}
/* The current subtitle type was not found, trying the most common based on the TimingMode */
- TimingMode timingMode = Global.TimingMode;
+ TimingMode timingMode = Base.TimingMode;
/* If timing mode is Frames, set to MicroDVD */
if (timingMode == TimingMode.Frames) {
@@ -220,7 +221,7 @@
private void SetActiveNewlineType () {
NewlineType systemNewline = GetSystemNewlineType();
- NewlineType documentNewline = Global.Document.TextFile.NewlineType;
+ NewlineType documentNewline = Base.Document.TextFile.NewlineType;
NewlineType newlineToMakeActive = (documentNewline != NewlineType.Unknown ? documentNewline : systemNewline);
int item = GetNewlineTypePosition(newlineToMakeActive);
newlineTypeComboBox.Active = item;
Modified: trunk/src/GnomeSubtitles/Dialog/FileTranslationOpenDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/FileTranslationOpenDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/FileTranslationOpenDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Mono.Unix;
namespace GnomeSubtitles.Dialog {
@@ -29,8 +30,8 @@
/* Public members */
protected override string GetStartFolder () {
- if (Global.IsDocumentLoaded && Global.Document.IsTranslationLoaded && Global.Document.TranslationFile.IsPathRooted)
- return Global.Document.TranslationFile.Directory;
+ if (Base.IsDocumentLoaded && Base.Document.IsTranslationLoaded && Base.Document.TranslationFile.IsPathRooted)
+ return Base.Document.TranslationFile.Directory;
else
return base.GetStartFolder();
}
Modified: trunk/src/GnomeSubtitles/Dialog/GladeDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/GladeDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/GladeDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,8 +17,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-using System;
+using GnomeSubtitles.Core;
using Gtk;
+using System;
namespace GnomeSubtitles.Dialog {
@@ -26,7 +27,7 @@
private Glade.XML glade = null;
/* protected variables */
- protected Dialog dialog = null;
+ protected Gtk.Dialog dialog = null;
protected bool actionDone = false;
@@ -81,16 +82,16 @@
/// <remarks>Constructing creates the dialog from its filename, autoconnects the handlers,
/// sets the icon and also sets the dialog as transient for the main window.</summary>
protected void Init (string filename, bool persistent, bool autoconnect) {
- glade = new Glade.XML(null, filename, null, Global.Execution.TranslationDomain);
+ glade = new Glade.XML(null, filename, null, Base.ExecutionContext.TranslationDomain);
if (autoconnect)
Autoconnect();
else
glade.BindFields(this);
- dialog = glade.GetWidget("dialog") as Dialog;
+ dialog = glade.GetWidget("dialog") as Gtk.Dialog;
- Window window = Global.GUI.Window;
+ Window window = Core.Base.Ui.Window;
dialog.TransientFor = window;
dialog.Icon = window.Icon;
Modified: trunk/src/GnomeSubtitles/Dialog/HeadersDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/HeadersDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/HeadersDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using System;
using Glade;
using Gtk;
@@ -95,7 +96,7 @@
public HeadersDialog () : base(gladeFilename) {
- headers = Global.Document.Subtitles.Properties.Headers;
+ headers = Base.Document.Subtitles.Properties.Headers;
LoadHeaders();
}
Modified: trunk/src/GnomeSubtitles/Dialog/PreferencesDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/PreferencesDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/PreferencesDialog.cs Sun Jun 22 23:46:31 2008
@@ -18,6 +18,7 @@
*/
using Glade;
+using GnomeSubtitles.Core;
using Gtk;
using System;
@@ -41,7 +42,7 @@
/* Private members */
private void LoadValues () {
- videoAutoChooseFileCheckButton.Active = Global.Config.PrefsVideoAutoChooseFile;
+ videoAutoChooseFileCheckButton.Active = Base.Config.PrefsVideoAutoChooseFile;
}
/* Event handlers */
@@ -53,7 +54,7 @@
}
private void OnVideoAutoChooseFileToggled (object o, EventArgs args) {
- Global.Config.PrefsVideoAutoChooseFile = videoAutoChooseFileCheckButton.Active;
+ Base.Config.PrefsVideoAutoChooseFile = videoAutoChooseFileCheckButton.Active;
}
}
Modified: trunk/src/GnomeSubtitles/Dialog/ReportBugWindow.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/ReportBugWindow.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/ReportBugWindow.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Glade;
using Gtk;
using SubLib;
@@ -36,7 +37,7 @@
public BugReportWindow (Exception exception, string bugInfo) {
Application.Init();
- Glade.XML glade = new Glade.XML(null, gladeFilename, null, Global.Execution.TranslationDomain);
+ Glade.XML glade = new Glade.XML(null, gladeFilename, null, Base.ExecutionContext.TranslationDomain);
glade.Autoconnect(this);
bugTextView.Buffer.Text = bugInfo;
Modified: trunk/src/GnomeSubtitles/Dialog/SaveConfirmationDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/SaveConfirmationDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/SaveConfirmationDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Gtk;
using Mono.Unix;
using SubLib;
@@ -37,8 +38,8 @@
this.textType = textType;
string message = "<span weight=\"bold\" size=\"larger\">" + primaryText + "</span>\n\n" + secondaryText;
- string fileName = (textType == SubtitleTextType.Text ? Global.Document.TextFile.Filename : Global.Document.TranslationFile.Filename);
- dialog = new MessageDialog(Global.GUI.Window, DialogFlags.Modal, MessageType.Warning,
+ string fileName = (textType == SubtitleTextType.Text ? Base.Document.TextFile.Filename : Base.Document.TranslationFile.Filename);
+ dialog = new MessageDialog(Core.Base.Ui.Window, DialogFlags.Modal, MessageType.Warning,
ButtonsType.None, message, fileName);
dialog.AddButton(rejectLabel, ResponseType.Reject);
@@ -64,9 +65,9 @@
toClose = true;
else if (response == ResponseType.Accept) {
if (textType == SubtitleTextType.Text)
- toClose = Global.GUI.Save();
+ toClose = Core.Base.Ui.Save();
else
- toClose = Global.GUI.TranslationSave();
+ toClose = Core.Base.Ui.TranslationSave();
}
}
Modified: trunk/src/GnomeSubtitles/Dialog/SearchDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/SearchDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/SearchDialog.cs Sun Jun 22 23:46:31 2008
@@ -166,7 +166,7 @@
/// <summary>Sets the text in the Find entry.</summary>
/// <remarks>Updating the text will select it and grab the focus to the entry.</remarks>
private void SetFindEntryText () {
- string currentSelection = Global.GUI.Edit.SelectedTextContent;
+ string currentSelection = Core.Base.Ui.Edit.SelectedTextContent;
string textToUse = (currentSelection != String.Empty ? currentSelection : text);
findEntry.Text = textToUse;
findEntry.SelectRegion(0, textToUse.Length);
@@ -192,7 +192,7 @@
private void Find () {
HandleValuesChange();
- bool found = Global.GUI.View.Search.Find();
+ bool found = Core.Base.Ui.View.Search.Find();
if (found)
buttonReplace.Sensitive = true;
}
@@ -200,7 +200,7 @@
private void Replace () {
HandleValuesChange();
- bool foundNext = Global.GUI.View.Search.Replace();
+ bool foundNext = Core.Base.Ui.View.Search.Replace();
if (!foundNext) //No other text was found to replace, after replacing this one
buttonReplace.Sensitive = false;
}
@@ -208,7 +208,7 @@
private void ReplaceAll () {
HandleValuesChange();
- Global.GUI.View.Search.ReplaceAll();
+ Core.Base.Ui.View.Search.ReplaceAll();
}
private void UpdateRegex() {
Modified: trunk/src/GnomeSubtitles/Dialog/SetLanguageDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/SetLanguageDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/SetLanguageDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Glade;
using Gtk;
using Mono.Unix;
@@ -61,7 +62,7 @@
languagesTreeView.AppendColumn(col);
store = new ListStore(typeof(string));
- foreach (SpellLanguage language in Global.SpellLanguages.Languages) {
+ foreach (SpellLanguage language in Base.SpellLanguages.Languages) {
store.AppendValues(language.Name);
}
@@ -81,7 +82,7 @@
}
private int GetActiveLanguageIndex (SubtitleTextType textType, int count) {
- int activeLanguageIndex = Global.SpellLanguages.GetActiveLanguageIndex(textType);
+ int activeLanguageIndex = Base.SpellLanguages.GetActiveLanguageIndex(textType);
/* Set active language to the first if invalid */
if ((activeLanguageIndex == -1) || (activeLanguageIndex >= count))
activeLanguageIndex = 0;
@@ -91,7 +92,7 @@
private void SetSpellLanguage () {
int selectedLanguageIndex = GetSelectedLanguageIndex();
- Global.SpellLanguages.SetActiveLanguageIndex(textType, selectedLanguageIndex);
+ Base.SpellLanguages.SetActiveLanguageIndex(textType, selectedLanguageIndex);
}
private int GetSelectedLanguageIndex () {
Modified: trunk/src/GnomeSubtitles/Dialog/SubtitleFileChooserDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/SubtitleFileChooserDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/SubtitleFileChooserDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Glade;
using Gtk;
using Mono.Unix;
@@ -70,7 +71,7 @@
protected void SetEncodingComboBox () {
AddInitialEncodingComboBoxItems(encodingComboBox);
encodingComboBox.RowSeparatorFunc = SeparatorFunc;
- FillEncodingComboBox(Global.Config.PrefsEncodingsShownInMenu);
+ FillEncodingComboBox(Base.Config.PrefsEncodingsShownInMenu);
}
protected bool SeparatorFunc (TreeModel model, TreeIter iter) {
Modified: trunk/src/GnomeSubtitles/Dialog/TimingsAdjustDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/TimingsAdjustDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/TimingsAdjustDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Core.Command;
+using GnomeSubtitles.Ui.View;
using Glade;
using Gtk;
using Mono.Unix;
@@ -47,7 +50,7 @@
public TimingsAdjustDialog () : base(gladeFilename){
- timingMode = Global.TimingMode;
+ timingMode = Base.TimingMode;
SetSpinButtons();
UpdateForTimingMode();
SetApplyToSelectionSensitivity();
@@ -71,7 +74,7 @@
}
private void SetApplyToAll () {
- SubtitleCollection collection = Global.Document.Subtitles.Collection;
+ SubtitleCollection collection = Base.Document.Subtitles.Collection;
int firstNo = 1;
int lastNo = collection.Count;
@@ -79,8 +82,8 @@
}
private void SetApplyToSelection () {
- TreePath firstPath = Global.GUI.View.Selection.FirstPath;
- TreePath lastPath = Global.GUI.View.Selection.LastPath;
+ TreePath firstPath = Core.Base.Ui.View.Selection.FirstPath;
+ TreePath lastPath = Core.Base.Ui.View.Selection.LastPath;
int firstNo = firstPath.Indices[0] + 1;
int lastNo = lastPath.Indices[0] + 1;
@@ -89,13 +92,13 @@
}
private void SetApplyToSelectionSensitivity () {
- int selectionCount = Global.GUI.View.Selection.Count;
+ int selectionCount = Core.Base.Ui.View.Selection.Count;
if (selectionCount < 2)
selectedSubtitlesRadioButton.Sensitive = false;
}
private void UpdateInputValues (int firstNo, int lastNo) {
- SubtitleCollection collection = Global.Document.Subtitles.Collection;
+ SubtitleCollection collection = Base.Document.Subtitles.Collection;
Subtitle firstSubtitle = collection.Get(firstNo - 1);
Subtitle lastSubtitle = collection.Get(lastNo - 1);
@@ -135,12 +138,12 @@
if (timingMode == TimingMode.Times) {
TimeSpan firstTime = TimeSpan.Parse(firstSubtitleNewStartSpinButton.Text);
TimeSpan lastTime = TimeSpan.Parse(lastSubtitleNewStartSpinButton.Text);
- Global.CommandManager.Execute(new AdjustTimingsCommand(firstTime, lastTime, selectionIntended));
+ Base.CommandManager.Execute(new AdjustTimingsCommand(firstTime, lastTime, selectionIntended));
}
else {
int firstFrame = (int)firstSubtitleNewStartSpinButton.Value;
int lastFrame = (int)lastSubtitleNewStartSpinButton.Value;
- Global.CommandManager.Execute(new AdjustTimingsCommand(firstFrame, lastFrame, selectionIntended));
+ Base.CommandManager.Execute(new AdjustTimingsCommand(firstFrame, lastFrame, selectionIntended));
}
}
Close();
Modified: trunk/src/GnomeSubtitles/Dialog/TimingsShiftDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/TimingsShiftDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/TimingsShiftDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Core.Command;
+using GnomeSubtitles.Ui.View;
using Glade;
using Gtk;
using Mono.Unix;
@@ -52,7 +55,7 @@
/* Private methods */
private void UpdateContents (bool initializing) {
- UpdateFromTimingMode(Global.TimingMode, initializing);
+ UpdateFromTimingMode(Base.TimingMode, initializing);
UpdateFromSelection();
UpdateSpinButtonValue();
}
@@ -75,7 +78,7 @@
}
private void UpdateFromSelection () {
- bool sensitive = (Global.GUI.View.Selection.Count == 1);
+ bool sensitive = (Core.Base.Ui.View.Selection.Count == 1);
fromFirstSubtitleToSelectionRadioButton.Sensitive = sensitive;
fromSelectionToLastSubtitleRadioButton.Sensitive = sensitive;
@@ -84,23 +87,23 @@
}
private void UpdateSpinButtonValue () {
- if (!Global.GUI.Video.IsLoaded) {
+ if (!Core.Base.Ui.Video.IsLoaded) {
SetSpinButtonValue(0);
return;
}
- TreePath path = Global.GUI.View.Selection.FirstPath;
- Subtitle subtitle = Global.Document.Subtitles[path];
+ TreePath path = Core.Base.Ui.View.Selection.FirstPath;
+ Subtitle subtitle = Base.Document.Subtitles[path];
double subtitlePosition = 0;
double videoPosition = 0;
- if (Global.TimingModeIsTimes) {
+ if (Base.TimingModeIsTimes) {
subtitlePosition = subtitle.Times.Start.TotalMilliseconds;
- videoPosition = Global.GUI.Video.Position.CurrentTime.TotalMilliseconds;
+ videoPosition = Core.Base.Ui.Video.Position.CurrentTime.TotalMilliseconds;
}
else {
subtitlePosition = subtitle.Frames.Start;
- videoPosition = Global.GUI.Video.Position.CurrentFrames;
+ videoPosition = Core.Base.Ui.Video.Position.CurrentFrames;
}
double difference = videoPosition - subtitlePosition;
@@ -134,11 +137,11 @@
if (timingMode == TimingMode.Times) {
TimeSpan time = TimeSpan.Parse(spinButton.Text);
- Global.CommandManager.Execute(new ShiftTimingsCommand(time, selectionIntended));
+ Base.CommandManager.Execute(new ShiftTimingsCommand(time, selectionIntended));
}
else {
int frames = (int)spinButton.Value;
- Global.CommandManager.Execute(new ShiftTimingsCommand(frames, selectionIntended));
+ Base.CommandManager.Execute(new ShiftTimingsCommand(frames, selectionIntended));
}
}
Hide();
Modified: trunk/src/GnomeSubtitles/Dialog/VideoFileOpenErrorDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/VideoFileOpenErrorDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/VideoFileOpenErrorDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Ui.VideoPreview.Exception;
using Mono.Unix;
using System;
Modified: trunk/src/GnomeSubtitles/Dialog/VideoOpenDialog.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Dialog/VideoOpenDialog.cs (original)
+++ trunk/src/GnomeSubtitles/Dialog/VideoOpenDialog.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Gtk;
using Mono.Unix;
using System;
@@ -35,8 +36,8 @@
public VideoOpenDialog () : base(gladeFilename) {
dialog = base.dialog as FileChooserDialog;
- if (Global.IsDocumentLoaded && Global.Document.TextFile.IsPathRooted)
- dialog.SetCurrentFolder(Global.Document.TextFile.Directory);
+ if (Base.IsDocumentLoaded && Base.Document.TextFile.IsPathRooted)
+ dialog.SetCurrentFolder(Base.Document.TextFile.Directory);
else
dialog.SetCurrentFolder(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
Modified: trunk/src/GnomeSubtitles/Execution/BugReporter.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Execution/BugReporter.cs (original)
+++ trunk/src/GnomeSubtitles/Execution/BugReporter.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Dialog;
using System;
using System.ComponentModel;
using System.Diagnostics;
@@ -52,12 +54,12 @@
}
private static string GetBugInfo (Exception exception) {
- return "Gnome Subtitles version: " + Global.Execution.Version + "\n"
- + "SubLib version: " + Global.Execution.SubLibVersion + "\n"
- + "GtkSharp version: " + Global.Execution.GtkSharpVersion + "\n"
- + "GnomeSharp version: " + Global.Execution.GnomeSharpVersion + "\n"
- + "GladeSharp version: " + Global.Execution.GladeSharpVersion + "\n"
- + "GConfSharp version: " + Global.Execution.GConfSharpVersion + "\n\n"
+ return "Gnome Subtitles version: " + Base.ExecutionContext.Version + "\n"
+ + "SubLib version: " + Base.ExecutionContext.SubLibVersion + "\n"
+ + "GtkSharp version: " + Base.ExecutionContext.GtkSharpVersion + "\n"
+ + "GnomeSharp version: " + Base.ExecutionContext.GnomeSharpVersion + "\n"
+ + "GladeSharp version: " + Base.ExecutionContext.GladeSharpVersion + "\n"
+ + "GConfSharp version: " + Base.ExecutionContext.GConfSharpVersion + "\n\n"
+ "Stack trace:" + "\n"
+ exception.ToString();
}
Modified: trunk/src/GnomeSubtitles/Execution/Executable.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Execution/Executable.cs (original)
+++ trunk/src/GnomeSubtitles/Execution/Executable.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using System;
using System.Runtime.InteropServices;
using System.Text;
@@ -64,9 +65,9 @@
}
public static void Main (string[] args) {
- Execution execution = new Execution(args);
- SetProcessName(execution.ExecutableName);
- Global.Run(execution);
+ ExecutionContext executionContext = new ExecutionContext(args);
+ SetProcessName(executionContext.ExecutableName);
+ Base.Run(executionContext);
}
#endregion
Added: trunk/src/GnomeSubtitles/Execution/ExecutionContext.cs
==============================================================================
--- (empty file)
+++ trunk/src/GnomeSubtitles/Execution/ExecutionContext.cs Sun Jun 22 23:46:31 2008
@@ -0,0 +1,155 @@
+/*
+ * This file is part of Gnome Subtitles.
+ * Copyright (C) 2006-2008 Pedro Castro
+ *
+ * Gnome Subtitles is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Gnome Subtitles is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+using Gnome;
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace GnomeSubtitles.Execution {
+
+public class ExecutionContext {
+ private Program program = null;
+ private bool initialized = false;
+
+ #region Constant strings
+
+ private const string applicationName = "Gnome Subtitles";
+ private const string applicationID = "gnome-subtitles";
+ private const string subLibAssemblyName = "sublib";
+
+ #endregion
+
+ private string[] args = null;
+
+ public ExecutionContext (string[] args) {
+ this.args = args;
+ }
+
+ #region Public properties
+
+ public bool Initialized {
+ get { return initialized; }
+ }
+
+ public string ApplicationName {
+ get { return applicationName; }
+ }
+
+ public string ApplicationID {
+ get { return applicationID; }
+ }
+
+ public string ExecutableName {
+ get { return applicationID; }
+ }
+
+ public string Version {
+ get { return RemoveTrailingZeros(Assembly.GetExecutingAssembly().GetName().Version.ToString()); }
+ }
+
+ public string SubLibVersion {
+ get { return RemoveTrailingZeros(Assembly.ReflectionOnlyLoad(subLibAssemblyName).GetName().Version.ToString()); }
+ }
+
+ public string GtkSharpVersion {
+ get { return RemoveTrailingZeros(Assembly.Load("gtk-sharp").GetName().Version.ToString()); }
+ }
+
+ public string GnomeSharpVersion {
+ get { return RemoveTrailingZeros(Assembly.Load("gnome-sharp").GetName().Version.ToString()); }
+ }
+
+ public string GladeSharpVersion {
+ get { return RemoveTrailingZeros(Assembly.Load("glade-sharp").GetName().Version.ToString()); }
+ }
+
+ public string GConfSharpVersion {
+ get { return RemoveTrailingZeros(Assembly.Load("gconf-sharp").GetName().Version.ToString()); }
+ }
+
+ public string[] Args {
+ get { return args; }
+ set { args = value; }
+ }
+
+ public string SystemShareDir {
+ get {
+ string path = program.LocateFile(FileDomain.Datadir, String.Empty, true, null);
+ if ((path != null) && (path != String.Empty))
+ return path;
+ else
+ return program.GnomeDatadir;
+ }
+ }
+
+ public string SystemShareLocaleDir {
+ get { return Path.Combine(SystemShareDir, "locale"); }
+ }
+
+ public string SystemHelpDir {
+ get {
+ string path = program.LocateFile(FileDomain.Help, applicationID, true, null);
+ if ((path != null) && (path != String.Empty))
+ return path;
+ else {
+ return Path.Combine(SystemShareDir,
+ Path.Combine("gnome",
+ Path.Combine("help", applicationID)));
+ }
+ }
+ }
+
+ public string TranslationDomain {
+ get { return applicationID; }
+ }
+
+ #endregion
+
+ #region Public methods
+
+ public void Init () {
+ program = new Program(applicationID, Version, Gnome.Modules.UI, args);
+ initialized = true;
+ }
+
+ public void RunProgram () {
+ program.Run();
+ }
+
+ public void QuitProgram () {
+ program.Quit();
+ }
+
+ #endregion
+
+ #region Private methods
+
+ private string RemoveTrailingZeros (string version) {
+ while (version.EndsWith(".0")) {
+ version = version.Remove(version.Length - 2);
+ }
+ return version;
+ }
+
+ #endregion
+
+}
+
+}
Modified: trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEdit.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEdit.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEdit.cs Sun Jun 22 23:46:31 2008
@@ -17,12 +17,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Gtk;
using System;
using System.Collections;
using SubLib;
-namespace GnomeSubtitles.Ui.SubtitleEdit {
+namespace GnomeSubtitles.Ui.Edit {
public class SubtitleEdit {
@@ -37,10 +38,10 @@
public SubtitleEdit() {
- hBox = Global.GetWidget(WidgetNames.SubtitleEdit) as HBox;
+ hBox = Base.GetWidget(WidgetNames.SubtitleEdit) as HBox;
spinButtons = new SubtitleEditSpinButtons();
- textEdit = new SubtitleEditText(Global.GetWidget(WidgetNames.SubtitleEditText) as TextView);
- translationEdit = new SubtitleEditTranslation(Global.GetWidget(WidgetNames.SubtitleEditTranslation) as TextView);
+ textEdit = new SubtitleEditText(Base.GetWidget(WidgetNames.SubtitleEditText) as TextView);
+ translationEdit = new SubtitleEditTranslation(Base.GetWidget(WidgetNames.SubtitleEditTranslation) as TextView);
ConnectSignals();
}
@@ -99,7 +100,7 @@
}
public void UpdateFromNewDocument (bool wasLoaded) {
- spinButtons.UpdateFromTimingMode(Global.TimingMode, subtitle);
+ spinButtons.UpdateFromTimingMode(Base.TimingMode, subtitle);
translationEdit.Visible = false;
}
Modified: trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditSpinButtons.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditSpinButtons.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditSpinButtons.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Core.Command;
using Gtk;
using SubLib;
using System;
-namespace GnomeSubtitles.Ui.SubtitleEdit {
+namespace GnomeSubtitles.Ui.Edit {
public class SubtitleEditSpinButtons {
private TimingMode timingMode = TimingMode.Frames; //Need to store to prevent from connecting more than 1 handler to the spin buttons. Default is Frames because it's going to be set to Times in the constructor.
@@ -34,9 +36,9 @@
public SubtitleEditSpinButtons () {
/* Assign */
- startSpinButton = Global.GetWidget(WidgetNames.StartSpinButton) as SpinButton;
- endSpinButton = Global.GetWidget(WidgetNames.EndSpinButton) as SpinButton;
- durationSpinButton = Global.GetWidget(WidgetNames.DurationSpinButton) as SpinButton;
+ startSpinButton = Base.GetWidget(WidgetNames.StartSpinButton) as SpinButton;
+ endSpinButton = Base.GetWidget(WidgetNames.EndSpinButton) as SpinButton;
+ durationSpinButton = Base.GetWidget(WidgetNames.DurationSpinButton) as SpinButton;
/* Initialize */
startSpinButton.WidthRequest = Util.SpinButtonTimeWidth(startSpinButton); //Only need to set one of the spin buttons' width
@@ -169,24 +171,24 @@
}
private void OnStartValueChanged (object o, EventArgs args) {
- if (Global.TimingModeIsFrames)
- Global.CommandManager.Execute(new ChangeStartCommand((int)startSpinButton.Value));
+ if (Base.TimingModeIsFrames)
+ Base.CommandManager.Execute(new ChangeStartCommand((int)startSpinButton.Value));
else
- Global.CommandManager.Execute(new ChangeStartCommand(TimeSpan.FromMilliseconds(startSpinButton.Value)));
+ Base.CommandManager.Execute(new ChangeStartCommand(TimeSpan.FromMilliseconds(startSpinButton.Value)));
}
private void OnEndValueChanged (object o, EventArgs args) {
- if (Global.TimingModeIsFrames)
- Global.CommandManager.Execute(new ChangeEndCommand((int)endSpinButton.Value));
+ if (Base.TimingModeIsFrames)
+ Base.CommandManager.Execute(new ChangeEndCommand((int)endSpinButton.Value));
else
- Global.CommandManager.Execute(new ChangeEndCommand(TimeSpan.FromMilliseconds(endSpinButton.Value)));
+ Base.CommandManager.Execute(new ChangeEndCommand(TimeSpan.FromMilliseconds(endSpinButton.Value)));
}
private void OnDurationValueChanged (object o, EventArgs args) {
- if (Global.TimingModeIsFrames)
- Global.CommandManager.Execute(new ChangeDurationCommand((int)durationSpinButton.Value));
+ if (Base.TimingModeIsFrames)
+ Base.CommandManager.Execute(new ChangeDurationCommand((int)durationSpinButton.Value));
else
- Global.CommandManager.Execute(new ChangeDurationCommand(TimeSpan.FromMilliseconds(durationSpinButton.Value)));
+ Base.CommandManager.Execute(new ChangeDurationCommand(TimeSpan.FromMilliseconds(durationSpinButton.Value)));
}
private void OnTimeInput (object o, InputArgs args) {
Modified: trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditText.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditText.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditText.cs Sun Jun 22 23:46:31 2008
@@ -17,10 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Core.Command;
using Gtk;
using SubLib;
-namespace GnomeSubtitles.Ui.SubtitleEdit {
+namespace GnomeSubtitles.Ui.Edit {
public class SubtitleEditText : SubtitleEditTextView {
@@ -40,19 +42,19 @@
}
protected override void ExecuteInsertCommand (int index, string text) {
- Global.CommandManager.Execute(new InsertTextCommand(index, text));
+ Base.CommandManager.Execute(new InsertTextCommand(index, text));
}
protected override void ExecuteDeleteCommand (int index, string text, int cursor) {
- Global.CommandManager.Execute(new DeleteTextCommand(index, text, cursor));
+ Base.CommandManager.Execute(new DeleteTextCommand(index, text, cursor));
}
protected override SpellLanguage GetSpellActiveLanguage () {
- return Global.SpellLanguages.ActiveTextLanguage;
+ return Base.SpellLanguages.ActiveTextLanguage;
}
protected override void ConnectLanguageChangedSignal () {
- Global.SpellLanguages.TextLanguageChanged += OnSpellLanguageChanged;
+ Base.SpellLanguages.TextLanguageChanged += OnSpellLanguageChanged;
}
}
Modified: trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditTextView.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditTextView.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditTextView.cs Sun Jun 22 23:46:31 2008
@@ -17,13 +17,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Gtk;
using SubLib;
using System;
using System.Collections;
using System.Runtime.InteropServices;
-namespace GnomeSubtitles.Ui.SubtitleEdit {
+namespace GnomeSubtitles.Ui.Edit {
public abstract class SubtitleEditTextView {
private TextView textView = null;
@@ -91,7 +92,7 @@
/// <summary>The visibility of the scrolled window this <see cref="TextView" /> is inside of.</summary>
public bool Visible {
- set { Global.GetWidget(WidgetNames.SubtitleEditTranslationScrolledWindow).Visible = value; }
+ set { Base.GetWidget(WidgetNames.SubtitleEditTranslationScrolledWindow).Visible = value; }
}
public bool OverwriteStatus {
@@ -300,11 +301,11 @@
GetLineColumn(out line, out column);
/* Update the status bar */
- Global.GUI.Status.SetPosition(GetTextType(), line, column);
+ Core.Base.Ui.Status.SetPosition(GetTextType(), line, column);
}
private void UpdateOverwriteStatus () {
- Global.GUI.Status.Overwrite = textView.Overwrite;
+ Core.Base.Ui.Status.Overwrite = textView.Overwrite;
}
private void PlaceCursor (int index) {
@@ -367,12 +368,12 @@
UpdateLineColStatus();
UpdateOverwriteStatus();
- Global.GUI.Menus.SetPasteSensitivity(true);
+ Core.Base.Ui.Menus.SetPasteSensitivity(true);
}
private void OnFocusOut (object o, FocusOutEventArgs args) {
- Global.GUI.Menus.SetPasteSensitivity(false);
- Global.GUI.Status.ClearEditRelatedStatus();
+ Core.Base.Ui.Menus.SetPasteSensitivity(false);
+ Core.Base.Ui.Status.ClearEditRelatedStatus();
}
private void OnToggleOverwrite (object o, EventArgs args) {
@@ -385,7 +386,7 @@
}
private void OnSpellToggleEnabled (object o, EventArgs args) {
- bool enabled = Global.SpellLanguages.Enabled;
+ bool enabled = Base.SpellLanguages.Enabled;
if (enabled) {
GtkSpellAttach();
SpellLanguage language = GetSpellActiveLanguage();
@@ -408,12 +409,12 @@
if ((modifier & controlModifier) == controlModifier) { //Control was pressed
switch (key) {
case Gdk.Key.Page_Up:
- Global.GUI.View.Selection.SelectPrevious();
+ Core.Base.Ui.View.Selection.SelectPrevious();
GrabFocus();
args.RetVal = true;
break;
case Gdk.Key.Page_Down:
- Global.GUI.View.Selection.SelectNext();
+ Core.Base.Ui.View.Selection.SelectNext();
GrabFocus();
args.RetVal = true;
break;
@@ -436,7 +437,7 @@
TextView.Destroyed += OnDestroyed;
/* Spell signals */
- Global.SpellLanguages.ToggleEnabled += OnSpellToggleEnabled;
+ Base.SpellLanguages.ToggleEnabled += OnSpellToggleEnabled;
ConnectLanguageChangedSignal();
}
@@ -448,7 +449,7 @@
/* Protected members */
protected void OnSpellLanguageChanged (object o, EventArgs args) {
- if (Global.SpellLanguages.Enabled) {
+ if (Base.SpellLanguages.Enabled) {
SpellLanguage language = GetSpellActiveLanguage();
GtkSpellSetLanguage(language);
}
Modified: trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditTranslation.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditTranslation.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/Edit/SubtitleEditTranslation.cs Sun Jun 22 23:46:31 2008
@@ -17,10 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Core.Command;
using Gtk;
using SubLib;
-namespace GnomeSubtitles.Ui.SubtitleEdit {
+namespace GnomeSubtitles.Ui.Edit {
public class SubtitleEditTranslation : SubtitleEditTextView {
@@ -40,19 +42,19 @@
}
protected override void ExecuteInsertCommand (int index, string text) {
- Global.CommandManager.Execute(new InsertTranslationCommand(index, text));
+ Base.CommandManager.Execute(new InsertTranslationCommand(index, text));
}
protected override void ExecuteDeleteCommand (int index, string text, int cursor) {
- Global.CommandManager.Execute(new DeleteTranslationCommand(index, text, cursor));
+ Base.CommandManager.Execute(new DeleteTranslationCommand(index, text, cursor));
}
protected override SpellLanguage GetSpellActiveLanguage () {
- return Global.SpellLanguages.ActiveTranslationLanguage;
+ return Base.SpellLanguages.ActiveTranslationLanguage;
}
protected override void ConnectLanguageChangedSignal () {
- Global.SpellLanguages.TranslationLanguageChanged += OnSpellLanguageChanged;
+ Base.SpellLanguages.TranslationLanguageChanged += OnSpellLanguageChanged;
}
}
Modified: trunk/src/GnomeSubtitles/Ui/MainUi.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/MainUi.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/MainUi.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Core.Command;
+using GnomeSubtitles.Dialog;
+using GnomeSubtitles.Ui.Edit;
+using GnomeSubtitles.Ui.VideoPreview;
+using GnomeSubtitles.Ui.View;
using Gtk;
using Mono.Unix;
using SubLib;
@@ -39,11 +45,11 @@
private const string iconFilename = "gnome-subtitles.png";
public MainUi (EventHandlers handlers, out Glade.XML glade) {
- glade = new Glade.XML(null, gladeFilename, null, Global.Execution.TranslationDomain);
+ glade = new Glade.XML(null, gladeFilename, null, Base.ExecutionContext.TranslationDomain);
window = glade.GetWidget("window") as Window;
window.Icon = new Gdk.Pixbuf(null, iconFilename);
- window.SetDefaultSize(Global.Config.PrefsWindowWidth, Global.Config.PrefsWindowHeight);
+ window.SetDefaultSize(Base.Config.PrefsWindowWidth, Base.Config.PrefsWindowHeight);
video = new Video();
view = new SubtitleView();
@@ -88,10 +94,10 @@
/// <summary>Starts the GUI</summary>
/// <remarks>A file is opened if it was specified as argument. If it wasn't, a blank start is performed.</summary>
public void Start () {
- string[] args = Global.Execution.Args;
+ string[] args = Base.ExecutionContext.Args;
if (args.Length > 0) {
string subtitleFile = args[0];
- string videoFile = Global.Config.PrefsVideoAutoChooseFile ? VideoFiles.FindMatchingVideo(subtitleFile) : String.Empty;
+ string videoFile = Base.Config.PrefsVideoAutoChooseFile ? VideoFiles.FindMatchingVideo(subtitleFile) : String.Empty;
Open(subtitleFile, -1, videoFile);
}
else
@@ -102,7 +108,7 @@
public void Quit () {
if (ToCloseAfterWarning()) {
video.Quit();
- Global.Quit();
+ Base.Quit();
}
}
@@ -123,10 +129,10 @@
path = Catalog.GetString("Unsaved Subtitles");
}
- Global.CreateDocumentNew(path);
+ Base.CreateDocumentNew(path);
- if (Global.Document.Subtitles.Count == 0) {
- Global.CommandManager.Execute(new InsertFirstSubtitleCommand());
+ if (Base.Document.Subtitles.Count == 0) {
+ Base.CommandManager.Execute(new InsertFirstSubtitleCommand());
}
}
@@ -164,8 +170,8 @@
/// <remarks>If the document hasn't been saved before, a SaveAs is executed.</remarks>
/// <returns>Whether the file was saved or not.</returns>
public bool Save () {
- if (Global.Document.CanTextBeSaved) { //Check if document can be saved or needs a SaveAs
- Save(Global.Document.TextFile);
+ if (Base.Document.CanTextBeSaved) { //Check if document can be saved or needs a SaveAs
+ Save(Base.Document.TextFile);
return true;
}
else
@@ -176,7 +182,7 @@
/// <remarks>After saving, the timing mode is set to the timing mode of the subtitle format using when saving.</remarks>
/// <returns>Whether the file was saved or not.</returns>
public bool SaveAs () {
- FileSaveAsDialog dialog = Global.Dialogs.FileSaveAsDialog;
+ FileSaveAsDialog dialog = Base.Dialogs.FileSaveAsDialog;
FileProperties properties = ShowSaveAsDialog(dialog);
if (properties != null) {
Save(properties);
@@ -192,7 +198,7 @@
if (!ToCreateNewTranslationAfterWarning())
return;
- Global.Document.NewTranslation();
+ Base.Document.NewTranslation();
}
/// <summary>Shows the open translation dialog and possibly opens a file.</summary>
@@ -213,8 +219,8 @@
/// <remarks>If the translation hasn't been saved before, a TranslationSaveAs is executed.</remarks>
/// <returns>Whether the translation file was saved or not.</returns>
public bool TranslationSave () {
- if (Global.Document.CanTranslationBeSaved) { //Check if translation can be saved or needs a SaveAs
- SaveTranslation(Global.Document.TranslationFile);
+ if (Base.Document.CanTranslationBeSaved) { //Check if translation can be saved or needs a SaveAs
+ SaveTranslation(Base.Document.TranslationFile);
return true;
}
else
@@ -224,7 +230,7 @@
/// <summary>Executes a translation SaveAs operation.</summary>
/// <returns>Whether the translation file was saved or not.</returns>
public bool TranslationSaveAs () {
- FileSaveAsDialog dialog = Global.Dialogs.TranslationSaveAsDialog;
+ FileSaveAsDialog dialog = Base.Dialogs.TranslationSaveAsDialog;
FileProperties properties = ShowSaveAsDialog(dialog);
if (properties != null) {
SaveTranslation(properties);
@@ -240,13 +246,13 @@
if (!ToCloseTranslationAfterWarning())
return;
- Global.Document.CloseTranslation();
+ Base.Document.CloseTranslation();
}
public void UpdateFromDocumentModified (bool modified) {
string prefix = (modified ? "*" : String.Empty);
- window.Title = prefix + Global.Document.TextFile.Filename +
- " - " + Global.Execution.ApplicationName;
+ window.Title = prefix + Base.Document.TextFile.Filename +
+ " - " + Base.ExecutionContext.ApplicationName;
}
public void UpdateFromNewDocument (bool wasLoaded) {
@@ -291,7 +297,7 @@
/// <summary>Updates the various parts of the GUI based on the current subtitle count.</summary>
public void UpdateFromSubtitleCount () {
- int count = Global.Document.Subtitles.Collection.Count;
+ int count = Base.Document.Subtitles.Collection.Count;
menus.UpdateFromSubtitleCount(count);
}
@@ -306,7 +312,7 @@
private void Open (string path, int codePage, string videoFilename) {
try {
Encoding encoding = CodePageToEncoding(codePage);
- Global.CreateDocumentOpen(path, encoding);
+ Base.CreateDocumentOpen(path, encoding);
view.Selection.SelectFirst();
if (videoFilename != String.Empty)
@@ -344,7 +350,7 @@
private void OpenTranslation (string path, int codePage) {
try {
Encoding encoding = (codePage == -1 ? null : Encoding.GetEncoding(codePage));
- Global.Document.OpenTranslation(path, encoding);
+ Base.Document.OpenTranslation(path, encoding);
}
catch (Exception exception) {
SubtitleFileOpenErrorDialog errorDialog = new SubtitleFileOpenErrorDialog(path, exception);
@@ -375,7 +381,7 @@
private void Save (FileProperties fileProperties) {
try {
- Global.Document.Save(fileProperties);
+ Base.Document.Save(fileProperties);
}
catch (Exception exception) {
FileSaveErrorDialog errorDialog = new FileSaveErrorDialog(fileProperties.Path, exception);
@@ -388,7 +394,7 @@
private void SaveTranslation (FileProperties fileProperties) {
try {
- Global.Document.SaveTranslation(fileProperties);
+ Base.Document.SaveTranslation(fileProperties);
}
catch (Exception exception) {
FileSaveErrorDialog errorDialog = new FileSaveErrorDialog(fileProperties.Path, exception); //TODO check messages for translation
@@ -412,7 +418,7 @@
Encoding encoding = Encoding.GetEncoding(dialog.ChosenEncoding.CodePage);
SubtitleType subtitleType = dialog.SubtitleType;
NewlineType newlineType = dialog.NewlineType;
- TimingMode timingMode = Global.TimingMode;
+ TimingMode timingMode = Base.TimingMode;
return new FileProperties(path, encoding, subtitleType, timingMode, newlineType);
}
@@ -446,12 +452,12 @@
/// <summary>Whether there are unsaved normal changes.</summary>
private bool ExistTextUnsavedChanges () {
- return Global.IsDocumentLoaded && Global.Document.WasTextModified;
+ return Base.IsDocumentLoaded && Base.Document.WasTextModified;
}
/// <summary>Whether there are unsaved translation changes.</summary>
private bool ExistTranslationUnsavedChanges () {
- return Global.IsDocumentLoaded && Global.Document.IsTranslationLoaded && Global.Document.WasTranslationModified;
+ return Base.IsDocumentLoaded && Base.Document.IsTranslationLoaded && Base.Document.WasTranslationModified;
}
/// <summary>Whether the program should be closed, after choosing the respective confirmation dialog.</summary>
Modified: trunk/src/GnomeSubtitles/Ui/Menus.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/Menus.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/Menus.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Core.Command;
using Gtk;
using Mono.Unix;
using SubLib;
@@ -46,12 +48,12 @@
public void UpdateFromNewDocument (bool wasLoaded) {
SetNewDocumentSensitivity(wasLoaded);
- SetSubtitleCountDependentSensitivity(Global.Document.Subtitles.Collection.Count);
+ SetSubtitleCountDependentSensitivity(Base.Document.Subtitles.Collection.Count);
SetFrameRateMenus();
- SetActiveTimingMode(Global.TimingMode);
+ SetActiveTimingMode(Base.TimingMode);
SetToolsAutocheckSpellingSensitivity(true);
- SetCheckMenuItemActivity(WidgetNames.ToolsAutocheckSpelling, Global.SpellLanguages.Enabled);
+ SetCheckMenuItemActivity(WidgetNames.ToolsAutocheckSpelling, Base.SpellLanguages.Enabled);
}
public void UpdateFromNewTranslationDocument () {
@@ -85,20 +87,20 @@
}
public void UpdateFromUndoToggled() {
- Widget button = Global.GetWidget(WidgetNames.UndoButton);
+ Widget button = Base.GetWidget(WidgetNames.UndoButton);
button.Sensitive = !button.Sensitive;
- MenuItem menuItem = Global.GetWidget(WidgetNames.EditUndo) as MenuItem;
+ MenuItem menuItem = Base.GetWidget(WidgetNames.EditUndo) as MenuItem;
menuItem.Sensitive = !menuItem.Sensitive;
if (!menuItem.Sensitive)
(menuItem.Child as Label).Text = Catalog.GetString("Undo");
}
public void UpdateFromRedoToggled () {
- Widget button = Global.GetWidget(WidgetNames.RedoButton);
+ Widget button = Base.GetWidget(WidgetNames.RedoButton);
button.Sensitive = !button.Sensitive;
- MenuItem menuItem = Global.GetWidget(WidgetNames.EditRedo) as MenuItem;
+ MenuItem menuItem = Base.GetWidget(WidgetNames.EditRedo) as MenuItem;
menuItem.Sensitive = !menuItem.Sensitive;
if (!menuItem.Sensitive)
(menuItem.Child as Label).Text = Catalog.GetString("Redo");
@@ -138,13 +140,13 @@
}
public void UpdateActiveInputFrameRateMenuItem () {
- float inputFrameRate = Global.Document.Subtitles.Properties.OriginalFrameRate;
- SetCheckMenuItemActivity(InputFrameRateMenuItem(inputFrameRate), true, Global.Handlers.OnTimingsInputFrameRate);
+ float inputFrameRate = Base.Document.Subtitles.Properties.OriginalFrameRate;
+ SetCheckMenuItemActivity(InputFrameRateMenuItem(inputFrameRate), true, Base.Handlers.OnTimingsInputFrameRate);
}
public void UpdateActiveVideoFrameRateMenuItem () {
- float videoFrameRate = Global.Document.Subtitles.Properties.CurrentFrameRate;
- SetCheckMenuItemActivity(VideoFrameRateMenuItem(videoFrameRate), true, Global.Handlers.OnTimingsVideoFrameRate);
+ float videoFrameRate = Base.Document.Subtitles.Properties.CurrentFrameRate;
+ SetCheckMenuItemActivity(VideoFrameRateMenuItem(videoFrameRate), true, Base.Handlers.OnTimingsVideoFrameRate);
}
public void EnableFindNextPrevious () {
@@ -270,7 +272,7 @@
}
private void SetBlankActivity () {
- SetCheckMenuItemActivity(WidgetNames.ToolsAutocheckSpelling, Global.SpellLanguages.Enabled);
+ SetCheckMenuItemActivity(WidgetNames.ToolsAutocheckSpelling, Base.SpellLanguages.Enabled);
}
private void SetNewDocumentSensitivity (bool wasLoaded) {
@@ -340,7 +342,7 @@
}
private void SetFrameRateMenus () {
- if (Global.TimingMode == TimingMode.Frames) {
+ if (Base.TimingMode == TimingMode.Frames) {
SetMenuSensitivity(WidgetNames.TimingsInputFrameRate, true);
SetMenuSensitivity(WidgetNames.TimingsVideoFrameRate, true);
}
@@ -354,12 +356,12 @@
}
private void SetStylesActivity (bool bold, bool italic, bool underline) {
- SetCheckMenuItemActivity(WidgetNames.EditFormatBold, bold, Global.Handlers.OnEditFormatBold);
- SetCheckMenuItemActivity(WidgetNames.EditFormatItalic, italic, Global.Handlers.OnEditFormatItalic);
- SetCheckMenuItemActivity(WidgetNames.EditFormatUnderline, underline, Global.Handlers.OnEditFormatUnderline);
- SetToggleToolButtonActivity(WidgetNames.BoldButton, bold, Global.Handlers.OnEditFormatBold);
- SetToggleToolButtonActivity(WidgetNames.ItalicButton, italic, Global.Handlers.OnEditFormatItalic);
- SetToggleToolButtonActivity(WidgetNames.UnderlineButton, underline, Global.Handlers.OnEditFormatUnderline);
+ SetCheckMenuItemActivity(WidgetNames.EditFormatBold, bold, Base.Handlers.OnEditFormatBold);
+ SetCheckMenuItemActivity(WidgetNames.EditFormatItalic, italic, Base.Handlers.OnEditFormatItalic);
+ SetCheckMenuItemActivity(WidgetNames.EditFormatUnderline, underline, Base.Handlers.OnEditFormatUnderline);
+ SetToggleToolButtonActivity(WidgetNames.BoldButton, bold, Base.Handlers.OnEditFormatBold);
+ SetToggleToolButtonActivity(WidgetNames.ItalicButton, italic, Base.Handlers.OnEditFormatItalic);
+ SetToggleToolButtonActivity(WidgetNames.UnderlineButton, underline, Base.Handlers.OnEditFormatUnderline);
}
@@ -377,14 +379,14 @@
SetSensitivity(WidgetNames.VideoForward, sensitivity);
/* Set video menu dependent sensitivity if there is 1 selected subtitle. */
- if ((Global.GUI.View.Selection.Count == 1) && sensitivity)
+ if ((Core.Base.Ui.View.Selection.Count == 1) && sensitivity)
SetVideoSelectionDependentSensitivity(true);
else
SetVideoSelectionDependentSensitivity(false);
}
private void SetStylesSensitivity (bool sensitivity) {
- if (Global.GetWidget(WidgetNames.EditFormatBold).Sensitive != sensitivity) {
+ if (Base.GetWidget(WidgetNames.EditFormatBold).Sensitive != sensitivity) {
SetSensitivity(WidgetNames.EditFormatBold, sensitivity);
SetSensitivity(WidgetNames.EditFormatItalic, sensitivity);
SetSensitivity(WidgetNames.EditFormatUnderline, sensitivity);
@@ -398,7 +400,7 @@
/// <param name="sensitivity">Whether to set the menu items sensitive.</param>
/// <remarks>The menu items are only set sensitive if the video is loaded.</remarks>
private void SetVideoSelectionDependentSensitivity (bool sensitivity) {
- if (Global.GUI.Video.IsLoaded && sensitivity) {
+ if (Core.Base.Ui.Video.IsLoaded && sensitivity) {
SetSensitivity(WidgetNames.VideoSeekToSelection, true);
SetSensitivity(WidgetNames.VideoSetSubtitleStart, true);
SetSensitivity(WidgetNames.VideoSetSubtitleEnd, true);
@@ -411,9 +413,9 @@
}
private void SetViewVideoSubtitlesSensitivity () {
- bool isVideoLoaded = Global.GUI.Video.IsLoaded;
- bool textSensitivity = isVideoLoaded && Global.IsDocumentLoaded;
- bool translationSensitivity = isVideoLoaded && textSensitivity && Global.Document.IsTranslationLoaded;
+ bool isVideoLoaded = Core.Base.Ui.Video.IsLoaded;
+ bool textSensitivity = isVideoLoaded && Base.IsDocumentLoaded;
+ bool translationSensitivity = isVideoLoaded && textSensitivity && Base.Document.IsTranslationLoaded;
SetViewVideoSubtitlesSensitivity(textSensitivity, translationSensitivity);
}
@@ -423,38 +425,38 @@
}
private void SetCheckMenuItemActivity (string menuItemName, bool isActive) {
- (Global.GetWidget(menuItemName) as CheckMenuItem).Active = isActive;
+ (Base.GetWidget(menuItemName) as CheckMenuItem).Active = isActive;
}
private void SetCheckMenuItemActivity (string menuItemName, bool isActive, EventHandler handler) {
- CheckMenuItem menuItem = Global.GetWidget(menuItemName) as CheckMenuItem;
+ CheckMenuItem menuItem = Base.GetWidget(menuItemName) as CheckMenuItem;
menuItem.Toggled -= handler;
menuItem.Active = isActive;
menuItem.Toggled += handler;
}
private void SetToggleToolButtonActivity (string toggleToolButtonName, bool isActive, EventHandler handler) {
- ToggleToolButton toggleToolButton = Global.GetWidget(toggleToolButtonName) as ToggleToolButton;
+ ToggleToolButton toggleToolButton = Base.GetWidget(toggleToolButtonName) as ToggleToolButton;
toggleToolButton.Toggled -= handler;
toggleToolButton.Active = isActive;
toggleToolButton.Toggled += handler;
}
private void SetSensitivity (string widgetName, bool isSensitive) {
- Widget widget = Global.GetWidget(widgetName);
+ Widget widget = Base.GetWidget(widgetName);
if (widget != null)
widget.Sensitive = isSensitive;
}
private void SetMenuSensitivity (string menuItemName, bool sensitivity) {
- MenuItem menuItem = Global.GetWidget(menuItemName) as MenuItem;
+ MenuItem menuItem = Base.GetWidget(menuItemName) as MenuItem;
Menu menu = menuItem.Submenu as Menu;
foreach (Widget widget in menu)
widget.Sensitive = sensitivity;
}
private void GetGlobalStyles (TreePath[] paths, out bool bold, out bool italic, out bool underline) {
- Subtitles subtitles = Global.Document.Subtitles;
+ Ui.View.Subtitles subtitles = Base.Document.Subtitles;
bold = true;
italic = true;
underline = true;
@@ -494,44 +496,44 @@
}
private string GetMenuItemText (string menuItemName) {
- MenuItem menuItem = Global.GetWidget(menuItemName) as MenuItem;
+ MenuItem menuItem = Base.GetWidget(menuItemName) as MenuItem;
Label label = menuItem.Child as Label;
return label.Text;
}
private void SetMenuItemText (string menuItemName, string text) {
- MenuItem menuItem = Global.GetWidget(menuItemName) as MenuItem;
+ MenuItem menuItem = Base.GetWidget(menuItemName) as MenuItem;
Label label = menuItem.Child as Label;
label.Text = text;
}
private void SetToolbarHomogeneity () {
- Toolbar toolbar = Global.GetWidget(WidgetNames.Toolbar) as Toolbar;
+ Toolbar toolbar = Base.GetWidget(WidgetNames.Toolbar) as Toolbar;
Widget[] toolItems = toolbar.Children;
foreach (Widget item in toolItems)
(item as ToolItem).Homogeneous = false;
}
private void UpdateUndoRedoMessages () {
- CommandManager commandManager = Global.CommandManager;
+ CommandManager commandManager = Base.CommandManager;
/* Update undo messages */
- ToolButton undoButton = Global.GetWidget(WidgetNames.UndoButton) as ToolButton;
+ ToolButton undoButton = Base.GetWidget(WidgetNames.UndoButton) as ToolButton;
if (commandManager.CanUndo) {
string undoDescription = commandManager.UndoDescription;
SetTooltip(undoButton, undoDescription);
- MenuItem undoMenuItem = Global.GetWidget(WidgetNames.EditUndo) as MenuItem;
+ MenuItem undoMenuItem = Base.GetWidget(WidgetNames.EditUndo) as MenuItem;
(undoMenuItem.Child as Label).Text = undoDescription;
}
else
ClearTooltip(undoButton);
/* Update redo messages */
- ToolButton redoButton = Global.GetWidget(WidgetNames.RedoButton) as ToolButton;
+ ToolButton redoButton = Base.GetWidget(WidgetNames.RedoButton) as ToolButton;
if (commandManager.CanRedo) {
string redoDescription = commandManager.RedoDescription;
SetTooltip(redoButton, redoDescription);
- MenuItem redoMenuItem = Global.GetWidget(WidgetNames.EditRedo) as MenuItem;
+ MenuItem redoMenuItem = Base.GetWidget(WidgetNames.EditRedo) as MenuItem;
(redoMenuItem.Child as Label).Text = redoDescription;
}
else
Modified: trunk/src/GnomeSubtitles/Ui/Status.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/Status.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/Status.cs Sun Jun 22 23:46:31 2008
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Gtk;
using Mono.Unix;
using SubLib;
@@ -29,9 +30,9 @@
private Statusbar overwriteStatus = null;
public Status () {
- //messageStatus = Global.GetWidget(WidgetNames.MessageStatusbar) as Gtk.Statusbar;
- positionStatus = Global.GetWidget(WidgetNames.PositionStatusbar) as Gtk.Statusbar;
- overwriteStatus = Global.GetWidget(WidgetNames.OverwriteStatusbar) as Gtk.Statusbar;
+ //messageStatus = Base.GetWidget(WidgetNames.MessageStatusbar) as Gtk.Statusbar;
+ positionStatus = Base.GetWidget(WidgetNames.PositionStatusbar) as Gtk.Statusbar;
+ overwriteStatus = Base.GetWidget(WidgetNames.OverwriteStatusbar) as Gtk.Statusbar;
}
/* Public properties */
Modified: trunk/src/GnomeSubtitles/Ui/VideoPreview/Exception/PlayerCouldNotOpenVideoException.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/VideoPreview/Exception/PlayerCouldNotOpenVideoException.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/VideoPreview/Exception/PlayerCouldNotOpenVideoException.cs Sun Jun 22 23:46:31 2008
@@ -19,7 +19,7 @@
using System;
-namespace GnomeSubtitles.Ui.Video.Exception {
+namespace GnomeSubtitles.Ui.VideoPreview.Exception {
public class PlayerCouldNotOpenVideoException : ApplicationException {
Modified: trunk/src/GnomeSubtitles/Ui/VideoPreview/Player.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/VideoPreview/Player.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/VideoPreview/Player.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Ui.VideoPreview.Exception;
using GStreamer;
using Gtk;
using System;
-namespace GnomeSubtitles.Ui.Video {
+namespace GnomeSubtitles.Ui.VideoPreview {
/* Delegates */
public delegate void PlayerErrorCaughtFunc (string message); //Represents a function that handles a caught error
Modified: trunk/src/GnomeSubtitles/Ui/VideoPreview/PlayerPositionWatcher.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/VideoPreview/PlayerPositionWatcher.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/VideoPreview/PlayerPositionWatcher.cs Sun Jun 22 23:46:31 2008
@@ -21,7 +21,7 @@
using System;
using System.IO;
-namespace GnomeSubtitles.Ui.Video {
+namespace GnomeSubtitles.Ui.VideoPreview {
/* Delegates */
public delegate TimeSpan PlayerGetTimeFunc (); //Represents a function that gets a time from the player
Modified: trunk/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/VideoPreview/Video.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/VideoPreview/Video.cs Sun Jun 22 23:46:31 2008
@@ -17,12 +17,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Dialog;
using Gtk;
using SubLib;
using System;
using System.Text.RegularExpressions;
-namespace GnomeSubtitles.Ui.Video {
+namespace GnomeSubtitles.Ui.VideoPreview {
public class Video {
private HBox videoArea = null;
@@ -40,7 +42,7 @@
private const string videoSetSubtitleEndIconFilename = "video-set-subtitle-end-16x.png";
public Video () {
- videoArea = Global.GetWidget(WidgetNames.VideoAreaHBox) as HBox;
+ videoArea = Base.GetWidget(WidgetNames.VideoAreaHBox) as HBox;
/* Create the video Frame */
frame = new AspectFrame(null, 0.5f, 0.5f, 1.6f, false);
@@ -50,7 +52,7 @@
videoFrameEventBox.ModifyBg(StateType.Normal, videoFrameEventBox.Style.Black);
/* Attach the video frame */
- Table videoImageTable = Global.GetWidget("videoImageTable") as Table;
+ Table videoImageTable = Base.GetWidget("videoImageTable") as Table;
videoImageTable.Attach(videoFrameEventBox, 0, 1, 0, 1);
videoImageTable.ShowAll();
@@ -106,7 +108,7 @@
position.Enable();
frame.Ratio = player.AspectRatio;
- Global.GUI.Menus.AddFrameRateVideoTag(player.FrameRate);
+ Core.Base.Ui.Menus.AddFrameRateVideoTag(player.FrameRate);
isLoaded = true;
}
@@ -131,7 +133,7 @@
SilentDisablePlayPauseButton();
SetControlsSensitivity(false);
- Global.GUI.Menus.RemoveFrameRateVideoTag(oldFrameRate);
+ Core.Base.Ui.Menus.RemoveFrameRateVideoTag(oldFrameRate);
}
public void UpdateFromTimingMode (TimingMode newMode) {
@@ -169,7 +171,7 @@
}
public void SeekToSelection () { //TODO check out
- Subtitle subtitle = Global.GUI.View.Selection.Subtitle;
+ Subtitle subtitle = Core.Base.Ui.View.Selection.Subtitle;
TimeSpan time = subtitle.Times.Start;
Seek(time);
}
@@ -193,32 +195,32 @@
private void SetCustomIcons () {
/* Set the icon for the SetSubtitleStart button */
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(null, videoSetSubtitleStartIconFilename);
- Image image = Global.GetWidget(WidgetNames.VideoSetSubtitleStartButtonImage) as Image;
+ Image image = Base.GetWidget(WidgetNames.VideoSetSubtitleStartButtonImage) as Image;
image.FromPixbuf = pixbuf;
/* Set the icon for the SetSubtitleEnd button */
pixbuf = new Gdk.Pixbuf(null, videoSetSubtitleEndIconFilename);
- image = Global.GetWidget(WidgetNames.VideoSetSubtitleEndButtonImage) as Image;
+ image = Base.GetWidget(WidgetNames.VideoSetSubtitleEndButtonImage) as Image;
image.FromPixbuf = pixbuf;
}
private void SetControlsSensitivity (bool sensitivity) {
- Global.GetWidget(WidgetNames.VideoTimingsVBox).Sensitive = sensitivity;
- Global.GetWidget(WidgetNames.VideoPlaybackHBox).Sensitive = sensitivity;
+ Base.GetWidget(WidgetNames.VideoTimingsVBox).Sensitive = sensitivity;
+ Base.GetWidget(WidgetNames.VideoPlaybackHBox).Sensitive = sensitivity;
- if ((Global.GUI.View.Selection.Count == 1) && sensitivity)
+ if ((Core.Base.Ui.View.Selection.Count == 1) && sensitivity)
SetSelectionDependentControlsSensitivity(true);
else
SetSelectionDependentControlsSensitivity(false);
}
private void SetSelectionDependentControlsSensitivity (bool sensitivity) {
- Global.GetWidget(WidgetNames.VideoSetSubtitleStartButton).Sensitive = sensitivity;
- Global.GetWidget(WidgetNames.VideoSetSubtitleEndButton).Sensitive = sensitivity;
+ Base.GetWidget(WidgetNames.VideoSetSubtitleStartButton).Sensitive = sensitivity;
+ Base.GetWidget(WidgetNames.VideoSetSubtitleEndButton).Sensitive = sensitivity;
}
private void SilentDisablePlayPauseButton () {
- ToggleButton button = Global.GetWidget(WidgetNames.VideoPlayPauseButton) as ToggleButton;
+ ToggleButton button = Base.GetWidget(WidgetNames.VideoPlayPauseButton) as ToggleButton;
if (button.Active) {
playPauseToggleIsSilent = true;
button.Active = false;
@@ -228,7 +230,7 @@
/* Event members */
private void ConnectPlayPauseButtonSignals () {
- ToggleButton button = Global.GetWidget(WidgetNames.VideoPlayPauseButton) as ToggleButton;
+ ToggleButton button = Base.GetWidget(WidgetNames.VideoPlayPauseButton) as ToggleButton;
button.Toggled += OnPlayPauseButtonToggled;
}
@@ -245,7 +247,7 @@
}
private void OnPlayerEndReached (object o, EventArgs args) {
- ToggleButton playPauseButton = Global.GetWidget(WidgetNames.VideoPlayPauseButton) as ToggleButton;
+ ToggleButton playPauseButton = Base.GetWidget(WidgetNames.VideoPlayPauseButton) as ToggleButton;
playPauseButton.Active = false;
}
Modified: trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoFiles.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoFiles.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoFiles.cs Sun Jun 22 23:46:31 2008
@@ -22,7 +22,7 @@
using System.IO;
using System.Text.RegularExpressions;
-namespace GnomeSubtitles.Ui.Video {
+namespace GnomeSubtitles.Ui.VideoPreview {
public class VideoFiles {
private static Regex videoFilesRegex = new Regex(@"^.*\.((avi)|(mpeg)|(mpg)|(mp4)|(ogm)|(divx)|(xvid)|(mov)|(ogg))$");
Modified: trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoPosition.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoPosition.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoPosition.cs Sun Jun 22 23:46:31 2008
@@ -17,12 +17,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Gtk;
using Mono.Unix;
using SubLib;
using System;
-namespace GnomeSubtitles.Ui.Video {
+namespace GnomeSubtitles.Ui.VideoPreview {
public class VideoPosition {
private Player player = null;
@@ -47,10 +48,10 @@
public event VideoPositionChangedHandler Changed;
public VideoPosition (Player player) {
- slider = Global.GetWidget(WidgetNames.VideoSlider) as HScale;
- positionLabel = Global.GetWidget(WidgetNames.VideoPositionLabel) as Label;
- positionValueLabel = Global.GetWidget(WidgetNames.VideoPositionValueLabel) as Label;
- lengthValueLabel = Global.GetWidget(WidgetNames.VideoLengthValueLabel) as Label;
+ slider = Base.GetWidget(WidgetNames.VideoSlider) as HScale;
+ positionLabel = Base.GetWidget(WidgetNames.VideoPositionLabel) as Label;
+ positionValueLabel = Base.GetWidget(WidgetNames.VideoPositionValueLabel) as Label;
+ lengthValueLabel = Base.GetWidget(WidgetNames.VideoLengthValueLabel) as Label;
this.player = player;
player.OnPositionChanged = OnPlayerPositionChanged;
@@ -163,7 +164,7 @@
}
private void UpdatePositionValueLabel (TimeSpan newPosition) {
- if (Global.TimingMode == TimingMode.Times)
+ if (Base.TimingMode == TimingMode.Times)
positionValueLabel.Text = Util.TimeSpanToText(newPosition);
else {
double frames = (newPosition == TimeSpan.Zero ? 0 : SubLib.Synchronization.TimeToFrames(newPosition, player.FrameRate));
@@ -178,7 +179,7 @@
private void SetLength (TimeSpan length) {
SetSliderLength(length);
- UpdateLengthLabel(Global.TimingMode, length);
+ UpdateLengthLabel(Base.TimingMode, length);
}
private void UpdateLengthLabel (TimingMode timingMode, TimeSpan length) {
Modified: trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoSubtitle.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoSubtitle.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/VideoPreview/VideoSubtitle.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Gtk;
using SubLib;
using System;
-namespace GnomeSubtitles.Ui.Video {
+namespace GnomeSubtitles.Ui.VideoPreview {
//TODO change name to SubtitleOverlay
public class VideoSubtitle {
@@ -34,10 +35,10 @@
private bool toShowText = true;
public VideoSubtitle (VideoPosition position) {
- EventBox box = Global.GetWidget(WidgetNames.VideoSubtitleLabelEventBox) as EventBox;
+ EventBox box = Base.GetWidget(WidgetNames.VideoSubtitleLabelEventBox) as EventBox;
box.ModifyBg(StateType.Normal, box.Style.Black);
- label = Global.GetWidget(WidgetNames.VideoSubtitleLabel) as Label;
+ label = Base.GetWidget(WidgetNames.VideoSubtitleLabel) as Label;
label.ModifyFg(StateType.Normal, new Gdk.Color(255, 255, 0));
position.Changed += OnVideoPositionChanged;
@@ -59,11 +60,11 @@
/* Event members */
private void OnVideoPositionChanged (TimeSpan newPosition) {
- if (!(Global.IsDocumentLoaded))
+ if (!(Base.IsDocumentLoaded))
return;
if (!(IsTimeInCurrentSubtitle(newPosition))) {
- int foundSubtitle = Global.Document.Subtitles.FindWithTime((float)newPosition.TotalSeconds); //TODO write method in SubLib that accepts TimeSpans
+ int foundSubtitle = Base.Document.Subtitles.FindWithTime((float)newPosition.TotalSeconds); //TODO write method in SubLib that accepts TimeSpans
if (foundSubtitle == -1)
UnloadSubtitle();
else
@@ -84,7 +85,7 @@
}
private void LoadSubtitle (int number) {
- subtitle = Global.Document.Subtitles[number];
+ subtitle = Base.Document.Subtitles[number];
subtitleStart = subtitle.Times.Start;
subtitleEnd = subtitle.Times.End;
SetText();
Modified: trunk/src/GnomeSubtitles/Ui/View/CellRendererCenteredText.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/View/CellRendererCenteredText.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/View/CellRendererCenteredText.cs Sun Jun 22 23:46:31 2008
@@ -20,7 +20,7 @@
using Gdk;
using Gtk;
-namespace GnomeSubtitles.Ui.SubtitleView {
+namespace GnomeSubtitles.Ui.View {
/// <summary>Provides a cell renderer that centers text with multiple lines.</summary>
//TODO It looks like the Alignment property can now be used. It requires GTK# 2.10.
Modified: trunk/src/GnomeSubtitles/Ui/View/SelectionIntended.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/View/SelectionIntended.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/View/SelectionIntended.cs Sun Jun 22 23:46:31 2008
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-namespace GnomeSubtitles.Ui.SubtitleView {
+namespace GnomeSubtitles.Ui.View {
/// <summary>
/// Represents an intended selection.
Modified: trunk/src/GnomeSubtitles/Ui/View/SelectionType.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/View/SelectionType.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/View/SelectionType.cs Sun Jun 22 23:46:31 2008
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-namespace GnomeSubtitles.Ui.SubtitleView {
+namespace GnomeSubtitles.Ui.View {
/// <summary>
/// Represents a selection type.
Modified: trunk/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Gtk;
using System;
using SubLib;
-namespace GnomeSubtitles.Ui.SubtitleView {
+namespace GnomeSubtitles.Ui.View {
public class SubtitleSelection {
@@ -112,7 +113,7 @@
TreePath[] range = new TreePath[2];
range[0] = firstPath;
- int count = Global.Document.Subtitles.Count;
+ int count = Base.Document.Subtitles.Count;
range[1] = Util.IntToPath(count - 1);
return range;
}
@@ -120,7 +121,7 @@
/// <summary>The selected subtitle. If there is more than one selected, the first is returned.</summary>
public Subtitle Subtitle {
- get { return Global.Document.Subtitles[Path]; }
+ get { return Base.Document.Subtitles[Path]; }
}
/// <summary>The number of selected paths.</summary>
@@ -211,20 +212,20 @@
return;
}
Select(path, align, reselect);
- Global.GUI.Edit.TextFocusOnSelection(start, end, textType);
+ Core.Base.Ui.Edit.TextFocusOnSelection(start, end, textType);
}
/// <summary>Selects the first subtitle.</summary>
/// <remarks>The subtitle is only selected if it exists.</remarks>
public void SelectFirst () {
- if (Global.Document.Subtitles.Count > 0)
+ if (Base.Document.Subtitles.Count > 0)
Select(TreePath.NewFirst(), false, false);
}
/// <summary>Selects the last subtitle.</summary>
/// <remarks>The subtitle is only selected if it exists.</remarks>
public void SelectLast () {
- int count = Global.Document.Subtitles.Count;
+ int count = Base.Document.Subtitles.Count;
if (count > 0)
Select(Util.IntToPath(count - 1), false, false);
}
@@ -237,7 +238,7 @@
return;
}
TreePath path = LastPath;
- if (path.Indices[0] == (Global.Document.Subtitles.Count - 1)) //this is the last existing path
+ if (path.Indices[0] == (Base.Document.Subtitles.Count - 1)) //this is the last existing path
return;
TreePath next = Util.PathNext(path);
@@ -287,7 +288,7 @@
}
private void OnSelectionChanged (object o, EventArgs args) {
- Global.GUI.UpdateFromSelection();
+ Base.Ui.UpdateFromSelection();
}
/* Private members */
Modified: trunk/src/GnomeSubtitles/Ui/View/SubtitleView.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/View/SubtitleView.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/View/SubtitleView.cs Sun Jun 22 23:46:31 2008
@@ -17,12 +17,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
+using GnomeSubtitles.Ui.View;
using Gtk;
using Mono.Unix;
using System;
using SubLib;
-namespace GnomeSubtitles.Ui.SubtitleView {
+namespace GnomeSubtitles.Ui.View {
public class SubtitleView {
private Subtitles subtitles = null; //A reference to Global.Subtitles, kept here because it's often accessed by CellRenderers.
@@ -40,7 +42,7 @@
public SubtitleView() {
- tree = Global.GetWidget(WidgetNames.SubtitleView) as TreeView;
+ tree = Base.GetWidget(WidgetNames.SubtitleView) as TreeView;
selection = new SubtitleSelection(tree);
search = new Search();
@@ -72,7 +74,7 @@
SetTranslationVisible(false);
}
- Load(Global.Document.Subtitles);
+ Load(Base.Document.Subtitles);
}
public void UpdateFromNewTranslationDocument () {
@@ -287,7 +289,7 @@
private void RenderStartCell (TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) {
CellRendererText renderer = cell as CellRendererText;
- if (Global.TimingModeIsFrames)
+ if (Base.TimingModeIsFrames)
renderer.Text = subtitles[iter].Frames.Start.ToString();
else
renderer.Text = Util.TimeSpanToText(subtitles[iter].Times.Start);
@@ -295,7 +297,7 @@
private void RenderEndCell (TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) {
CellRendererText renderer = cell as CellRendererText;
- if (Global.TimingModeIsFrames)
+ if (Base.TimingModeIsFrames)
renderer.Text = subtitles[iter].Frames.End.ToString();
else
renderer.Text = Util.TimeSpanToText(subtitles[iter].Times.End);
@@ -303,7 +305,7 @@
private void RenderDurationCell (TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) {
CellRendererText renderer = cell as CellRendererText;
- if (Global.TimingModeIsFrames)
+ if (Base.TimingModeIsFrames)
renderer.Text = subtitles[iter].Frames.Duration.ToString();
else
renderer.Text = Util.TimeSpanToText(subtitles[iter].Times.Duration);
Modified: trunk/src/GnomeSubtitles/Ui/View/Subtitles.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/View/Subtitles.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/View/Subtitles.cs Sun Jun 22 23:46:31 2008
@@ -17,11 +17,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+using GnomeSubtitles.Core;
using Gtk;
using System;
using SubLib;
-namespace GnomeSubtitles.Ui.SubtitleView {
+namespace GnomeSubtitles.Ui.View {
public class Subtitles : SubLib.Subtitles {
private ListStore model = new ListStore(typeof(Subtitle));
@@ -163,11 +164,11 @@
}
private void OnRowInserted (object o, RowInsertedArgs args) {
- Global.GUI.UpdateFromSubtitleCount();
+ Core.Base.Ui.UpdateFromSubtitleCount();
}
private void OnRowDeleted (object o, RowDeletedArgs args) {
- Global.GUI.UpdateFromSubtitleCount();
+ Core.Base.Ui.UpdateFromSubtitleCount();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]