[gnome-maps] exportViewDialog: Add option to include/exclude layers



commit 64828459ee69a75087e70867f03d08582592cb64
Author: Alex Anthony <alex anthony28991 gmail com>
Date:   Sun Jan 10 17:14:51 2016 +0000

    exportViewDialog: Add option to include/exclude layers
    
    Add a checkbox in the export view dialog to allow the user to decide
    whether or not to include layers in the export.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760353

 data/ui/export-view-dialog.ui |   19 ++++++++++++++++++-
 src/exportViewDialog.js       |   15 +++++++++++++--
 2 files changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/export-view-dialog.ui b/data/ui/export-view-dialog.ui
index 81bb2f6..993a533 100644
--- a/data/ui/export-view-dialog.ui
+++ b/data/ui/export-view-dialog.ui
@@ -87,7 +87,7 @@
                 <property name="left_attach">0</property>
                 <property name="top_attach">0</property>
                 <property name="width">1</property>
-                <property name="height">2</property>
+                <property name="height">3</property>
               </packing>
             </child>
             <child>
@@ -121,6 +121,23 @@
                 <property name="height">1</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkCheckButton" id="layersCheckButton">
+                <property name="label" translatable="yes">Include route and markers</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+                <property name="active">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
           </object>
         </child>
       </object>
diff --git a/src/exportViewDialog.js b/src/exportViewDialog.js
index 2894ac9..15e1e54 100644
--- a/src/exportViewDialog.js
+++ b/src/exportViewDialog.js
@@ -41,7 +41,8 @@ const ExportViewDialog = new Lang.Class({
                         'cancelButton',
                         'filenameEntry',
                         'fileChooserButton',
-                        'previewArea' ],
+                        'previewArea',
+                        'layersCheckButton' ],
 
     _init: function(params) {
         this._surface = params.surface;
@@ -67,6 +68,9 @@ const ExportViewDialog = new Lang.Class({
         this._fileChooserButton.connect('file-set',
                                         this._onFolderChanged.bind(this));
 
+        this._layersCheckButton.connect('toggled',
+                                        this._includeLayersChanged.bind(this));
+
 
         this._folder = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES);
         if (!this._folder)
@@ -98,7 +102,7 @@ const ExportViewDialog = new Lang.Class({
         cr.paint();
         cr.setOperator(Cairo.Operator.OVER);
 
-        cr.scale(this._scaleFactor, this._scaleFactor)
+        cr.scale(this._scaleFactor, this._scaleFactor);
         cr.setSourceSurface(this._surface, 0, 0);
         cr.paint();
     },
@@ -170,5 +174,12 @@ const ExportViewDialog = new Lang.Class({
             dialog.run();
             dialog.destroy();
         }
+    },
+
+    _includeLayersChanged: function() {
+        let includeLayers = this._layersCheckButton.get_active();
+
+        this._surface = this._mapView.view.to_surface(includeLayers);
+        this._previewArea.queue_draw();
     }
 });


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