From dd77bfc22b3a15dc8409398a40bcd724276cf62b Mon Sep 17 00:00:00 2001 From: John Foerch Date: Mon, 13 Feb 2012 13:00:46 -0500 Subject: [PATCH] image-toggle-zoom-to-fit: new command, bound to 'C-x %' Toggles zoom-to-fit on an image document. --- modules/bindings/default/global.js | 2 ++ modules/commands.js | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/modules/bindings/default/global.js b/modules/bindings/default/global.js index ed06c23..d5e75d8 100644 --- a/modules/bindings/default/global.js +++ b/modules/bindings/default/global.js @@ -62,3 +62,5 @@ define_key(default_global_keymap, "C-M-q", "quote-mode"); // multimedia keys define_key(default_global_keymap, "cmdsearch", "isearch-forward"); + +define_key(default_global_keymap, "C-x %", "image-toggle-zoom-to-fit"); diff --git a/modules/commands.js b/modules/commands.js index 2a853e4..52f2fd9 100644 --- a/modules/commands.js +++ b/modules/commands.js @@ -826,4 +826,17 @@ interactive("toggle-full-screen", }); +interactive("image-toggle-zoom-to-fit", + "Toggle zoom-to-fit (viewport) on an image document.", + function (I) { + try { + var doc = I.buffer.document + .QueryInterface(Ci.nsIImageDocument); + doc.toggleImageSize(); + } catch (e) { + I.minibuffer.message("Not an image document"); + } + }); + + provide("commands"); -- 2.11.4.GIT