[Libreoffice-commits] core.git: libreofficekit/qa

Miklos Vajna vmiklos at collabora.co.uk
Thu Nov 19 12:44:30 PST 2015


 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 9dea0a9775c1ab8c6ce8bbf00df83757cba34fb0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Nov 19 17:29:31 2015 +0100

    gtktiledviewer: allow setting custom background color
    
    E.g. it helps testing the semi-transparent shadow around Writer pages to
    append "--background-color yellow" to the commandline arguments.
    
    Change-Id: Ib94750e936abe3f41e4982534431fd5115e2c543

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index f76ad1a..9c2692c 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -32,6 +32,7 @@ static int help()
     fprintf(stderr, "Usage: gtktiledviewer <absolute-path-to-libreoffice-install's-program-directory> <path-to-document> [<options> ... ]\n\n");
     fprintf(stderr, "Options:\n\n");
     fprintf(stderr, "--hide-whitespace: Hide whitespace between pages in text documents.\n");
+    fprintf(stderr, "--background-color <color>: Set custom background color, e.g. 'yellow'.\n");
     return 1;
 }
 
@@ -484,13 +485,20 @@ static void createModelAndView(const char* pLOPath, const char* pDocPath, const
     setupWidgetAndCreateWindow(pDocView);
 
     boost::property_tree::ptree aTree;
-    for (const std::string& rArgument : rArguments)
+    for (size_t i = 0; i < rArguments.size(); ++i)
     {
+        const std::string& rArgument = rArguments[i];
         if (rArgument == "--hide-whitespace")
         {
             aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/type", '/'), "boolean");
             aTree.put(boost::property_tree::ptree::path_type(".uno:HideWhitespace/value", '/'), true);
         }
+        else if (rArgument == "--background-color" && i + 1 < rArguments.size())
+        {
+            GdkRGBA color;
+            gdk_rgba_parse(&color, rArguments[i + 1].c_str());
+            gtk_widget_override_background_color(gtk_widget_get_toplevel(pDocView), GTK_STATE_FLAG_NORMAL, &color);
+        }
     }
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aTree);


More information about the Libreoffice-commits mailing list