Code

Preserve current zoom and view for reverted documents
authorcilix42 <cilix42@users.sourceforge.net>
Tue, 11 Sep 2007 23:22:50 +0000 (23:22 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Tue, 11 Sep 2007 23:22:50 +0000 (23:22 +0000)
src/file.cpp

index a08be62c0cfd47fd8586fbde2a47e4ea0b00daab..abb00be4cf81af4567427c4d5136140bdb45f3ad 100644 (file)
@@ -264,7 +264,16 @@ sp_file_revert_dialog()
     if (do_revert) {
         // Allow overwriting of current document.
         doc->virgin = TRUE;
+
+        // remember current zoom and view
+        double zoom = desktop->current_zoom();
+        NR::Point c = desktop->get_display_area().midpoint();
+
         reverted = sp_file_open(uri,NULL);
+        if (reverted) {
+            // restore zoom and view
+            desktop->zoom_absolute(c[NR::X], c[NR::Y], zoom);
+        }
     } else {
         reverted = false;
     }