Author: kitone
Date: Sat Apr 18 12:20:21 2015
New Revision: 918

URL: http://svn.gna.org/viewcvs/subtitleeditor?rev=918&view=rev
Log:
Fix bug #23471 : Problems when saving into ASS - Save PlayResX/Y from screen 
resolution.

Modified:
    trunk/ChangeLog
    
trunk/plugins/subtitleformats/advancedsubstationalpha/advancedsubstationalpha.cc

Modified: trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/subtitleeditor/trunk/ChangeLog?rev=918&r1=917&r2=918&view=diff
==============================================================================
--- trunk/ChangeLog     (original)
+++ trunk/ChangeLog     Sat Apr 18 12:20:21 2015
@@ -1,3 +1,8 @@
+2015-04-18  kitone  <[email protected]>
+
+       * 
plugins/subtitleformats/advancedsubstationalpha/advancedsubstationalpha.cc:
+       Fix bug #23471 : Problems when saving into ASS - Save PlayResX/Y from 
screen resolution.
+
 2015-04-18  kitone  <[email protected]>
 
        * 
plugins/subtitleformats/advancedsubstationalpha/advancedsubstationalpha.cc:

Modified: 
trunk/plugins/subtitleformats/advancedsubstationalpha/advancedsubstationalpha.cc
URL: 
http://svn.gna.org/viewcvs/subtitleeditor/trunk/plugins/subtitleformats/advancedsubstationalpha/advancedsubstationalpha.cc?rev=918&r1=917&r2=918&view=diff
==============================================================================
--- 
trunk/plugins/subtitleformats/advancedsubstationalpha/advancedsubstationalpha.cc
    (original)
+++ 
trunk/plugins/subtitleformats/advancedsubstationalpha/advancedsubstationalpha.cc
    Sat Apr 18 12:20:21 2015
@@ -4,7 +4,7 @@
  *     http://home.gna.org/subtitleeditor/
  *     https://gna.org/projects/subtitleeditor/
  *
- *     Copyright @ 2005-2011, kitone
+ *     Copyright @ 2005-2015, kitone
  *
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -372,6 +372,17 @@
                                ++it)
                {
                        file.write(it->first + ": " + it->second + "\n");
+               }
+
+               // Only if one of PlayRes is missing
+               guint width, height;
+               if(get_screen_resolution(width, height) && 
has_play_res(scriptInfo)==false)
+               {
+                       file.write(
+                               Glib::ustring::compose(
+                                       "PlayResX: %1\n"
+                                       "PlayResY: %2\n",
+                                       width, height));
                }
 
                // End of block, empty line
@@ -612,6 +623,29 @@
                                                        "%01i:%02i:%02i.%02i",
                                                        t.hours(), t.minutes(), 
t.seconds(), (t.mseconds()+5)/10);
        }
+
+       /*
+        */
+       bool get_screen_resolution(guint &width, guint &height)
+       {
+               Glib::RefPtr<Gdk::Screen> screen = 
Gdk::Display::get_default()->get_default_screen();
+               if(!screen)
+                       return false;
+
+               width = screen->get_width();
+               height = screen->get_height();
+
+               return true;
+       }
+
+       /*
+        */
+       bool has_play_res(const ScriptInfo &script)
+       {
+               if(script.data.find("PlayResX") != script.data.end() || 
script.data.find("PlayResY") != script.data.end())
+                       return true;
+               return false;
+       }
 };
 
 class AdvancedSubStationAlphaPlugin : public SubtitleFormat


_______________________________________________
Subtitleeditor-commits mailing list
[email protected]
https://mail.gna.org/listinfo/subtitleeditor-commits

Reply via email to