[gnome-subtitles] Fix bug #673126 - Add tunable to set minimum gap between subtitles.



commit d6fc490ce070969050cee7a3f9bda5a495b1decb
Author: Pedro Castro <pedro gnomesubtitles org>
Date:   Sun Apr 15 19:54:33 2012 +0100

    Fix bug #673126 - Add tunable to set minimum gap between subtitles.

 src/Glade/PreferencesDialog.glade            |  191 +++++++++++++++++++-------
 src/GnomeSubtitles/Core/Document.cs          |    2 +-
 src/GnomeSubtitles/Ui/View/Subtitles.cs      |    4 +-
 src/SubLib/Core/Domain/SubtitleCollection.cs |   35 ++++-
 src/SubLib/Core/Translations.cs              |   12 ++-
 5 files changed, 180 insertions(+), 64 deletions(-)
---
diff --git a/src/Glade/PreferencesDialog.glade b/src/Glade/PreferencesDialog.glade
index 6978fba..0e02827 100644
--- a/src/Glade/PreferencesDialog.glade
+++ b/src/Glade/PreferencesDialog.glade
@@ -3,6 +3,7 @@
   <!-- interface-requires gtk+ 2.16 -->
   <!-- interface-naming-policy toplevel-contextual -->
   <widget class="GtkDialog" id="dialog">
+    <property name="can_focus">False</property>
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Preferences</property>
     <property name="modal">True</property>
@@ -10,8 +11,54 @@
     <child internal-child="vbox">
       <widget class="GtkVBox" id="dialogVBox">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
         <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialogActionArea">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
+            <property name="layout_style">edge</property>
+            <child>
+              <widget class="GtkButton" id="buttonReset">
+                <property name="label" translatable="yes">_Reset to defaults</property>
+                <property name="response_id">-6</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="buttonClose">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
         <child>
           <widget class="GtkNotebook" id="notebook1">
             <property name="visible">True</property>
@@ -20,20 +67,24 @@
             <child>
               <widget class="GtkVBox" id="vbox1">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">8</property>
                 <property name="spacing">10</property>
                 <child>
                   <widget class="GtkFrame" id="frame3">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
                       <widget class="GtkAlignment" id="alignment3">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
                           <widget class="GtkVBox" id="vbox2">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="spacing">5</property>
                             <child>
                               <widget class="GtkCheckButton" id="translationSaveAllCheckButton">
@@ -41,11 +92,14 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
-                                <signal name="toggled" handler="OnTranslationSaveAllToggled"/>
+                                <signal name="toggled" handler="OnTranslationSaveAllToggled" swapped="no"/>
                               </widget>
                               <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
@@ -56,6 +110,7 @@
                     <child>
                       <widget class="GtkLabel" id="label10">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="label" translatable="yes">&lt;b&gt;Translation File Saving&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
                         <property name="use_underline">True</property>
@@ -74,19 +129,23 @@
                 <child>
                   <widget class="GtkFrame" id="frame1">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
                       <widget class="GtkAlignment" id="alignment1">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
                           <widget class="GtkVBox" id="vbox4">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="spacing">5</property>
                             <child>
                               <widget class="GtkTable" id="table2">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="n_rows">2</property>
                                 <property name="n_columns">2</property>
                                 <property name="column_spacing">5</property>
@@ -94,6 +153,7 @@
                                 <child>
                                   <widget class="GtkLabel" id="label6">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">Character c_oding to use:</property>
                                     <property name="use_underline">True</property>
@@ -105,6 +165,7 @@
                                 <child>
                                   <widget class="GtkComboBox" id="fileOpenEncodingComboBox">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                   </widget>
                                   <packing>
                                     <property name="left_attach">1</property>
@@ -114,6 +175,7 @@
                                 <child>
                                   <widget class="GtkLabel" id="label7">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">If auto detection _fails, use:</property>
                                     <property name="use_underline">True</property>
@@ -127,6 +189,7 @@
                                 <child>
                                   <widget class="GtkComboBox" id="fileOpenFallbackEncodingComboBox">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                   </widget>
                                   <packing>
                                     <property name="left_attach">1</property>
@@ -137,6 +200,8 @@
                                 </child>
                               </widget>
                               <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
@@ -146,11 +211,14 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
-                                <signal name="toggled" handler="OnVideoAutoChooseFileToggled"/>
+                                <signal name="toggled" handler="OnVideoAutoChooseFileToggled" swapped="no"/>
                               </widget>
                               <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
@@ -161,6 +229,7 @@
                     <child>
                       <widget class="GtkLabel" id="label3">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="label" translatable="yes">&lt;b&gt;File Open Dialog&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
                         <property name="use_underline">True</property>
@@ -179,15 +248,18 @@
                 <child>
                   <widget class="GtkFrame" id="frame2">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
                       <widget class="GtkAlignment" id="alignment2">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
                           <widget class="GtkTable" id="table1">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="n_rows">3</property>
                             <property name="n_columns">2</property>
                             <property name="column_spacing">5</property>
@@ -195,6 +267,7 @@
                             <child>
                               <widget class="GtkLabel" id="label2">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">Ch_aracter coding to use:</property>
                                 <property name="use_underline">True</property>
@@ -208,6 +281,7 @@
                             <child>
                               <widget class="GtkLabel" id="label1">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">_Subtitle format to use:</property>
                                 <property name="use_underline">True</property>
@@ -219,6 +293,7 @@
                             <child>
                               <widget class="GtkComboBox" id="fileSaveFormatComboBox">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                               </widget>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -228,6 +303,7 @@
                             <child>
                               <widget class="GtkComboBox" id="fileSaveEncodingComboBox">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                               </widget>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -239,6 +315,7 @@
                             <child>
                               <widget class="GtkLabel" id="label5">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">_Newline type to use:</property>
                                 <property name="use_underline">True</property>
@@ -252,6 +329,7 @@
                             <child>
                               <widget class="GtkComboBox" id="fileSaveNewlineComboBox">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                               </widget>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -267,6 +345,7 @@
                     <child>
                       <widget class="GtkLabel" id="label4">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="label" translatable="yes">&lt;b&gt;File Save As Dialog&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
                         <property name="use_underline">True</property>
@@ -285,15 +364,18 @@
                 <child>
                   <widget class="GtkFrame" id="frame4">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
                       <widget class="GtkAlignment" id="alignment4">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
                           <widget class="GtkHBox" id="hbox1">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="spacing">3</property>
                             <child>
                               <widget class="GtkCheckButton" id="autoBackupCheckButton">
@@ -301,9 +383,10 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
-                                <signal name="toggled" handler="OnAutoBackupToggled"/>
+                                <signal name="toggled" handler="OnAutoBackupToggled" swapped="no"/>
                               </widget>
                               <packing>
                                 <property name="expand">False</property>
@@ -318,9 +401,13 @@
                                 <property name="max_length">2</property>
                                 <property name="invisible_char">â</property>
                                 <property name="width_chars">2</property>
+                                <property name="primary_icon_activatable">False</property>
+                                <property name="secondary_icon_activatable">False</property>
+                                <property name="primary_icon_sensitive">True</property>
+                                <property name="secondary_icon_sensitive">True</property>
                                 <property name="adjustment">1 1 100 1 2 0</property>
                                 <property name="numeric">True</property>
-                                <signal name="value_changed" handler="OnAutoBackupTimeSpinButtonValueChanged"/>
+                                <signal name="value_changed" handler="OnAutoBackupTimeSpinButtonValueChanged" swapped="no"/>
                               </widget>
                               <packing>
                                 <property name="expand">False</property>
@@ -331,6 +418,7 @@
                             <child>
                               <widget class="GtkLabel" id="label9">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">minutes</property>
                               </widget>
                               <packing>
@@ -346,6 +434,7 @@
                     <child>
                       <widget class="GtkLabel" id="label8">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="label" translatable="yes">&lt;b&gt;Backup&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
                       </widget>
@@ -365,6 +454,7 @@
             <child>
               <widget class="GtkLabel" id="filesLabel">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Files</property>
               </widget>
               <packing>
@@ -375,20 +465,24 @@
             <child>
               <widget class="GtkVBox" id="vbox3">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">8</property>
                 <property name="spacing">10</property>
                 <child>
                   <widget class="GtkFrame" id="frame6">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
                       <widget class="GtkAlignment" id="alignment6">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
                           <widget class="GtkVBox" id="vbox5">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="spacing">5</property>
                             <child>
                               <widget class="GtkCheckButton" id="videoSeekCheckButton">
@@ -396,9 +490,10 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
-                                <signal name="toggled" handler="OnVideoSeekToggled"/>
+                                <signal name="toggled" handler="OnVideoSeekToggled" swapped="no"/>
                               </widget>
                               <packing>
                                 <property name="expand">False</property>
@@ -409,10 +504,12 @@
                             <child>
                               <widget class="GtkHBox" id="hbox3">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">3</property>
                                 <child>
                                   <widget class="GtkLabel" id="label18">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
                                     <property name="label" translatable="yes">Seek</property>
                                   </widget>
@@ -430,9 +527,13 @@
                                     <property name="invisible_char">â</property>
                                     <property name="width_chars">4</property>
                                     <property name="invisible_char_set">True</property>
+                                    <property name="primary_icon_activatable">False</property>
+                                    <property name="secondary_icon_activatable">False</property>
+                                    <property name="primary_icon_sensitive">True</property>
+                                    <property name="secondary_icon_sensitive">True</property>
                                     <property name="adjustment">200 0 2000 50 100 0</property>
                                     <property name="numeric">True</property>
-                                    <signal name="value_changed" handler="OnVideoSeekRewindSpinButtonValueChanged"/>
+                                    <signal name="value_changed" handler="OnVideoSeekRewindSpinButtonValueChanged" swapped="no"/>
                                   </widget>
                                   <packing>
                                     <property name="expand">False</property>
@@ -443,6 +544,7 @@
                                 <child>
                                   <widget class="GtkLabel" id="label13">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="label" translatable="yes">ms before the actual start to help review new timings</property>
                                   </widget>
                                   <packing>
@@ -465,6 +567,7 @@
                     <child>
                       <widget class="GtkLabel" id="label15">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="label" translatable="yes">&lt;b&gt;Video Seeking&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
                         <property name="use_underline">True</property>
@@ -483,23 +586,28 @@
                 <child>
                   <widget class="GtkFrame" id="frame7">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
                       <widget class="GtkAlignment" id="alignment7">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
                           <widget class="GtkVBox" id="vbox6">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="spacing">5</property>
                             <child>
                               <widget class="GtkHBox" id="hbox4">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="spacing">3</property>
                                 <child>
                                   <widget class="GtkLabel" id="label17">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
                                     <property name="label" translatable="yes">Leave</property>
                                   </widget>
                                   <packing>
@@ -516,9 +624,13 @@
                                     <property name="invisible_char">â</property>
                                     <property name="width_chars">4</property>
                                     <property name="invisible_char_set">True</property>
+                                    <property name="primary_icon_activatable">False</property>
+                                    <property name="secondary_icon_activatable">False</property>
+                                    <property name="primary_icon_sensitive">True</property>
+                                    <property name="secondary_icon_sensitive">True</property>
                                     <property name="adjustment">100 0 2000 50 100 0</property>
                                     <property name="numeric">True</property>
-                                    <signal name="value_changed" handler="OnSubtitleSplitSpinButtonValueChanged"/>
+                                    <signal name="value_changed" handler="OnSubtitleSplitSpinButtonValueChanged" swapped="no"/>
                                   </widget>
                                   <packing>
                                     <property name="expand">False</property>
@@ -529,7 +641,8 @@
                                 <child>
                                   <widget class="GtkLabel" id="label14">
                                     <property name="visible">True</property>
-                                    <property name="label" translatable="yes">ms between subtitles when splitting</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label" translatable="yes">ms between subtitles when inserting or splitting</property>
                                   </widget>
                                   <packing>
                                     <property name="expand">False</property>
@@ -551,7 +664,8 @@
                     <child>
                       <widget class="GtkLabel" id="label16">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">&lt;b&gt;Subtitle Splitting&lt;/b&gt;</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">&lt;b&gt;Gap Between Subtitles&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
                         <property name="use_underline">True</property>
                       </widget>
@@ -569,15 +683,18 @@
                 <child>
                   <widget class="GtkFrame" id="frame5">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
                       <widget class="GtkAlignment" id="alignment5">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
                           <widget class="GtkHBox" id="hbox2">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="spacing">3</property>
                             <child>
                               <widget class="GtkCheckButton" id="reactionDelayCheckButton">
@@ -585,9 +702,10 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
-                                <signal name="toggled" handler="OnReactionDelayToggled"/>
+                                <signal name="toggled" handler="OnReactionDelayToggled" swapped="no"/>
                               </widget>
                               <packing>
                                 <property name="expand">False</property>
@@ -603,9 +721,13 @@
                                 <property name="invisible_char">â</property>
                                 <property name="width_chars">4</property>
                                 <property name="invisible_char_set">True</property>
+                                <property name="primary_icon_activatable">False</property>
+                                <property name="secondary_icon_activatable">False</property>
+                                <property name="primary_icon_sensitive">True</property>
+                                <property name="secondary_icon_sensitive">True</property>
                                 <property name="adjustment">2000 0 2000 50 100 0</property>
                                 <property name="numeric">True</property>
-                                <signal name="value_changed" handler="OnReactionDelaySpinButtonValueChanged"/>
+                                <signal name="value_changed" handler="OnReactionDelaySpinButtonValueChanged" swapped="no"/>
                               </widget>
                               <packing>
                                 <property name="expand">False</property>
@@ -616,6 +738,7 @@
                             <child>
                               <widget class="GtkLabel" id="label11">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">ms when setting subtitle start/end on playback</property>
                               </widget>
                               <packing>
@@ -631,6 +754,7 @@
                     <child>
                       <widget class="GtkLabel" id="label12">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="label" translatable="yes">&lt;b&gt;Reaction Delay&lt;/b&gt;</property>
                         <property name="use_markup">True</property>
                       </widget>
@@ -653,6 +777,7 @@
             <child>
               <widget class="GtkLabel" id="editingLabel">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Editing</property>
               </widget>
               <packing>
@@ -672,51 +797,11 @@
             </child>
           </widget>
           <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
             <property name="position">1</property>
           </packing>
         </child>
-        <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="dialogActionArea">
-            <property name="visible">True</property>
-            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK</property>
-            <property name="layout_style">edge</property>
-            <child>
-              <widget class="GtkButton" id="buttonReset">
-                <property name="label" translatable="yes">_Reset to defaults</property>
-                <property name="response_id">-6</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkButton" id="buttonClose">
-                <property name="label">gtk-close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
       </widget>
     </child>
   </widget>
diff --git a/src/GnomeSubtitles/Core/Document.cs b/src/GnomeSubtitles/Core/Document.cs
index 7f582bb..0e4251e 100644
--- a/src/GnomeSubtitles/Core/Document.cs
+++ b/src/GnomeSubtitles/Core/Document.cs
@@ -160,7 +160,7 @@ public class Document {
 		AddExtraSubtitles(openedTranslation);
 
 		Translations translations = new Translations();
-		translations.Import(subtitles, openedTranslation);
+		translations.Import(subtitles, openedTranslation, Base.Config.PrefsTimingsTimeBetweenSubtitles);
 
 		if (newTranslationFile.SubtitleType != SubtitleType.Unknown)
 			canTranslationBeSaved = true;
diff --git a/src/GnomeSubtitles/Ui/View/Subtitles.cs b/src/GnomeSubtitles/Ui/View/Subtitles.cs
index 677b4d5..4c7fce1 100644
--- a/src/GnomeSubtitles/Ui/View/Subtitles.cs
+++ b/src/GnomeSubtitles/Ui/View/Subtitles.cs
@@ -72,7 +72,7 @@ public class Subtitles : SubLib.Core.Domain.Subtitles {
 	/// <summary>Creates a subtitle and adds it after the specified position.</summary>
 	/// <remarks>The timings of the new subtitle will be based on the subtitle that preceeds it.</remarks>
 	public void AddNewAfter (int index) {
-		Collection.AddNewAfter(index, Properties);
+		Collection.AddNewAfter(index, Properties, Base.Config.PrefsTimingsTimeBetweenSubtitles);
 		int newIndex = index + 1;
 		Subtitle newSubtitle = this[newIndex];
 		model.SetValue(model.Insert(newIndex), 0, newSubtitle);
@@ -81,7 +81,7 @@ public class Subtitles : SubLib.Core.Domain.Subtitles {
 	/// <summary>Creates a subtitle and adds it before the specified position.</summary>
 	/// <remarks>The timings of the new subtitle will be based on the subtitle that succeeds it.</remarks>
 	public void AddNewBefore (int index) {
-		Collection.AddNewBefore(index, Properties);
+		Collection.AddNewBefore(index, Properties, Base.Config.PrefsTimingsTimeBetweenSubtitles);
 		Subtitle newSubtitle = this[index];
 		model.SetValue(model.Insert(index), 0, newSubtitle);	
 	}
diff --git a/src/SubLib/Core/Domain/SubtitleCollection.cs b/src/SubLib/Core/Domain/SubtitleCollection.cs
index ecac1e5..ae45cdd 100644
--- a/src/SubLib/Core/Domain/SubtitleCollection.cs
+++ b/src/SubLib/Core/Domain/SubtitleCollection.cs
@@ -87,7 +87,7 @@ public class SubtitleCollection {
 	public void Add (Subtitle subtitle, int index){
 		subtitles.Insert(index, subtitle);
 	}
-	
+		
 	/// <summary>Creates a subtitle based on the subtitle at the specified index and adds it to the
 	/// collection, inserting it right before that index.</summary>
 	/// <remarks>The newly created subtitle's times will be based on the specified subtitle. Its end
@@ -98,11 +98,24 @@ public class SubtitleCollection {
 	/// <param name="subtitleProperties">The SubtitleProperties of the subtitles.</param>
 	/// <returns>True if the subtitle could be added, false otherwise.</returns>
 	public bool AddNewBefore (int index, SubtitleProperties subtitleProperties) {
+		return AddNewBefore(index, subtitleProperties, (int)(SubtitleConstants.MinTimeBetweenSubtitles*1000));
+	}
+	
+	/// <summary>Creates a subtitle based on the subtitle at the specified index and adds it to the
+	/// collection, inserting it right before that index.</summary>
+	/// <remarks>The newly created subtitle's times will be based on the specified subtitle. Its duration
+	/// will be <see cref="SubtitleConstants.MaxSingleLineSubtitleDuration" />. Both the start and end times
+	/// times will be wrapped to zero if they are negative.</remarks>
+	/// <param name="index">The zero-based index before which the subtitle should be inserted.</param>
+	/// <param name="subtitleProperties">The SubtitleProperties of the subtitles.</param>
+	/// <param name="timeBetweenSubtitles">The gap to keep before the existing subtitle, in milliseconds.</param>
+	/// <returns>True if the subtitle could be added, false otherwise.</returns>
+	public bool AddNewBefore (int index, SubtitleProperties subtitleProperties, int timeBetweenSubtitles) {
 		Subtitle existing = Get(index);
 		if (existing == null)
 			return false;
 		
-		TimeSpan subtitleEnd = existing.Times.Start - TimeSpan.FromSeconds(SubtitleConstants.MinTimeBetweenSubtitles);
+		TimeSpan subtitleEnd = existing.Times.Start - TimeSpan.FromMilliseconds(timeBetweenSubtitles);
 		if (subtitleEnd < TimeSpan.Zero)
 			subtitleEnd = TimeSpan.FromSeconds(0);
 
@@ -114,21 +127,33 @@ public class SubtitleCollection {
 		Add(subtitle, index);
 		return true;
 	}
-
+		
 	/// <summary>Creates a subtitle based on the subtitle at the specified index and adds it to the
 	/// collection, inserting it right after that index.</summary>
 	/// <remarks>The newly created subtitle's times will be based on the specified subtitle. Its start
-	/// time will be the start time of the existing subtitle plus <see cref="SubtitleConstants.MinTimeBetweenSubtitles" />.
+	/// time will be the end time of the existing subtitle plus <see cref="SubtitleConstants.MinTimeBetweenSubtitles" />.
 	/// Its duration will be <see cref="SubtitleConstants.MaxSingleLineSubtitleDuration" />.</remarks>
 	/// <param name="index">The zero-based index after which the subtitle should be inserted.</param>
 	/// <param name="subtitleProperties">The SubtitleProperties of the subtitles.</param>
 	/// <returns>True if the subtitle could be added, false otherwise.</returns>
 	public bool AddNewAfter (int index, SubtitleProperties subtitleProperties) {
+		return AddNewAfter(index, subtitleProperties, (int)(SubtitleConstants.MinTimeBetweenSubtitles*1000));
+	}
+
+	/// <summary>Creates a subtitle based on the subtitle at the specified index and adds it to the
+	/// collection, inserting it right after that index.</summary>
+	/// <remarks>The newly created subtitle's times will be based on the specified subtitle.
+	/// Its duration will be <see cref="SubtitleConstants.MaxSingleLineSubtitleDuration" />.</remarks>
+	/// <param name="index">The zero-based index after which the subtitle should be inserted.</param>
+	/// <param name="subtitleProperties">The SubtitleProperties of the subtitles.</param>
+	/// <param name="timeBetweenSubtitles">The gap to keep after the existing subtitle, in milliseconds.</param>
+	/// <returns>True if the subtitle could be added, false otherwise.</returns>
+	public bool AddNewAfter (int index, SubtitleProperties subtitleProperties, int timeBetweenSubtitles) {
 		Subtitle existing = Get(index);
 		if (existing == null)
 			return false;
 		
-		TimeSpan subtitleStart = existing.Times.End + TimeSpan.FromSeconds(SubtitleConstants.MinTimeBetweenSubtitles);
+		TimeSpan subtitleStart = existing.Times.End + TimeSpan.FromMilliseconds(timeBetweenSubtitles);
 		TimeSpan subtitleEnd = subtitleStart + TimeSpan.FromSeconds(SubtitleConstants.AverageSubtitleDuration);
 		Subtitle subtitle = new Subtitle(subtitleProperties, subtitleStart, subtitleEnd);
 		Add(subtitle, index + 1);
diff --git a/src/SubLib/Core/Translations.cs b/src/SubLib/Core/Translations.cs
index afa5a2c..8200194 100644
--- a/src/SubLib/Core/Translations.cs
+++ b/src/SubLib/Core/Translations.cs
@@ -34,8 +34,8 @@ public class Translations {
 	/// <summary>Imports translated subtitles into existing subtitles.</summary>
 	/// <param name="subtitles">The subtitles to import the translation to.</param>
 	/// <param name="translation">The translated subtitles.</param>
-	public void Import (Subtitles subtitles, Subtitles translation) {
-		AddExtraSubtitles(subtitles, translation);
+	public void Import (Subtitles subtitles, Subtitles translation, int timeBetweenSubtitles) {
+		AddExtraSubtitles(subtitles, translation, timeBetweenSubtitles);
 		CopyTranslation(subtitles, translation);
 	}
 	
@@ -49,7 +49,13 @@ public class Translations {
 	/* Private methods */
 
 	/// <summary>Adds the number of subtitles that the translation has more than the original subtitles.</summary>
+	/// <remarks>A gap between subtitles of <see cref="SubtitleConstants.MinTimeBetweenSubtitles" /> will be used.</remarks>
 	private void AddExtraSubtitles (Subtitles subtitles, Subtitles translation) {
+		AddExtraSubtitles(subtitles, translation, (int)(SubtitleConstants.MinTimeBetweenSubtitles));
+	}
+
+	/// <summary>Adds the number of subtitles missing comparing to the translation.</summary>
+	private void AddExtraSubtitles (Subtitles subtitles, Subtitles translation, int timeBetweenSubtitles) {
 		int translationCount = translation.Collection.Count;
 		int subtitlesCount = subtitles.Collection.Count;
 		int extraCount = translationCount - subtitlesCount;
@@ -58,7 +64,7 @@ public class Translations {
 			return;
 		
 		for (int position = subtitlesCount - 1 ; position < translationCount - 1 ; position++) {
-			subtitles.Collection.AddNewAfter(position, subtitles.Properties);
+			subtitles.Collection.AddNewAfter(position, subtitles.Properties, timeBetweenSubtitles);
 		}
 	}
 	



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