--- /dev/null
+/* XPM */
+static char *last_page[] = {
+/* columns rows colors chars-per-pixel */
+"24 24 92 1 ",
+" c None",
+". c black",
+"X c gray15",
+"o c #2F4050",
+"O c #344353",
+"+ c #3B4F63",
+"@ c #384F66",
+"# c #3A5067",
+"$ c #3C5064",
+"% c #3C5065",
+"& c #3E5166",
+"* c #3F5266",
+"= c #3A5168",
+"- c #3B5269",
+"; c #3D526A",
+": c #3E546A",
+"> c #3F556B",
+", c #3E5975",
+"< c #3F5A76",
+"1 c #464646",
+"2 c #494949",
+"3 c #405367",
+"4 c #405468",
+"5 c #40566C",
+"6 c #41576D",
+"7 c #42586E",
+"8 c #44586F",
+"9 c #45596F",
+"0 c #465B70",
+"q c #415B77",
+"w c #425C78",
+"e c #435E79",
+"r c #445F7A",
+"t c #46607B",
+"y c #47617B",
+"u c #47617C",
+"i c #48627D",
+"p c #49637D",
+"a c #4B647E",
+"s c #4C647F",
+"d c #4C657F",
+"f c gray38",
+"g c #6A6A6A",
+"h c #616A73",
+"j c #68727D",
+"k c #7C7C7C",
+"l c #4E6780",
+"z c #4F6881",
+"x c #506982",
+"c c #526A83",
+"v c #556D85",
+"b c #5B7289",
+"n c #7D8185",
+"m c #77838F",
+"M c #868788",
+"N c #888888",
+"B c #8B8B8B",
+"V c #8F9296",
+"C c #8F9396",
+"Z c #8F9397",
+"A c #909397",
+"S c #959595",
+"D c #91969C",
+"F c #91979C",
+"G c #92979C",
+"H c #92979D",
+"J c #9C9FA1",
+"K c #9D9FA2",
+"L c #A2A3A4",
+"P c #A6A6A6",
+"I c #ACACAC",
+"U c gray68",
+"Y c #B0B0B0",
+"T c #B2B2B2",
+"R c gray71",
+"E c #B6B6B6",
+"W c gray75",
+"Q c #C5C5C5",
+"! c gray79",
+"~ c gray80",
+"^ c LightGray",
+"/ c #D6D6D6",
+"( c #D8D8D8",
+") c #DADADA",
+"_ c #DEDEDE",
+"` c gray89",
+"' c #E5E5E5",
+"] c #E6E6E6",
+"[ c #EEEEEE",
+"{ c #F2F2F2",
+"} c #F6F6F6",
+"| c white",
+/* pixels */
+" ",
+" ",
+" ........ ........ ",
+" .vU/_][`!N2gNT~)]{|b. ",
+" .@T/_][}||PUTW~)]{|t. ",
+" .#T/_][}`|PUTW~)]{|t. ",
+" .-T/_][).|PUTW~)]{|t. ",
+" .-T/_]^..|PUTW~)]{|t. ",
+" .;T/_~...|PUTW~)]{|u. ",
+" .>T/Q.....X1fkSR]{|i. ",
+" .>T/_~...|PUTW~)]{|i. ",
+" .5T/_]^..|PUTW~)]{|a. ",
+" .5T/_][).|PUTW~)]{|d. ",
+" .7T/_][}`|PUTW~)]{|d. ",
+" .8T/_][}||PUTW~)]{|l. ",
+" .8R/_][}||PUTW~)]{|z. ",
+" .0MAZZZZZKPLHHHHHKmc. ",
+" .O43&&&&+hnjtrwwq<<c. ",
+" ..........o......... ",
+" ... ",
+" ",
+" ",
+" ",
+" "
+};
:help "Reset the current slice"
:enabled (image-mode-window-get 'slice)])
"---"
- ["New Search" (doc-view-search t)
+ ["New Search" doc-view-new-search
:help "Initiate a new search"]
["Search Forward" doc-view-search
:help "Jump to the next match or initiate a new search"]
:style radio :selected (eq major-mode 'doc-view-mode)])
["Exit DocView Mode" doc-view-minor-mode]))
+(defvar doc-view-tool-bar-map
+ (let ((map (make-sparse-keymap)))
+ ;; Most of these items are the same as in the default tool bar
+ ;; map, but with extraneous items removed, and with extra search
+ ;; and navigation items.
+ (tool-bar-local-item-from-menu 'find-file "new" map
+ nil :label "New File"
+ :vert-only t)
+ (tool-bar-local-item-from-menu 'menu-find-file-existing "open" map
+ nil :label "Open" :vert-only t)
+ (tool-bar-local-item-from-menu 'dired "diropen" map nil :vert-only t)
+ (tool-bar-local-item-from-menu 'kill-this-buffer "close" map nil
+ :vert-only t)
+ (define-key-after map [separator-1] menu-bar-separator)
+ (tool-bar-local-item-from-menu 'doc-view-new-search "search"
+ map doc-view-mode-map :vert-only t
+ :help "Start a new search query.")
+ (tool-bar-local-item-from-menu 'doc-view-search-backward "left-arrow"
+ map doc-view-mode-map
+ :vert-only t
+ :enable 'doc-view--current-search-matches
+ :help "Move to the last search result.")
+ (tool-bar-local-item-from-menu 'doc-view-search "right-arrow"
+ map doc-view-mode-map :vert-only t
+ :enable 'doc-view--current-search-matches
+ :help "Move to the next search result.")
+ (define-key-after map [separator-2] menu-bar-separator)
+ (tool-bar-local-item-from-menu 'doc-view-previous-page "last-page"
+ map doc-view-mode-map :vert-only t
+ :enable '(> (doc-view-current-page) 1)
+ :help "Move to the next page.")
+ (tool-bar-local-item-from-menu 'doc-view-next-page "next-page"
+ map doc-view-mode-map :vert-only t
+ :enable '(< (doc-view-current-page)
+ (doc-view-last-page-number))
+ :help "Move to the next page.")
+ map)
+ "Like the default `tool-bar-map', but with additions for DocView.")
+
;;;; Navigation Commands
(defun doc-view-last-page-number ()
;; We must convert to TXT first!
(if doc-view--current-converter-processes
(message "DocView: please wait till conversion finished.")
- (doc-view-doc->txt txt (lambda () (doc-view-search nil))))))))
+ (doc-view-doc->txt txt (lambda () (doc-view-search nil))))))
+ ;; Update the tool bar items.
+ (force-mode-line-update)))
+
+(defun doc-view-new-search ()
+ "Initiate a new search query.
+Prompt for a string, then search for its appearances within
+the document text."
+ (interactive)
+ (doc-view-search t nil))
(defun doc-view-search-next-match (arg)
"Go to the ARGth next matching page."
major-mode 'doc-view-mode)
(doc-view-imenu-setup)
(doc-view-initiate-display)
+ ;; Replace the tool bar map with `doc-view-tool-bar-map'.
+ (setq-local tool-bar-map doc-view-tool-bar-map)
;; Switch off view-mode explicitly, because doc-view-mode is the
;; canonical view mode for PDF/PS/DVI files. This could be
;; switched on automatically depending on the value of