# HG changeset patch # User Jan Dj¸«£rv # Date 1204801128 0 # Node ID 5da8fdae3248def148130d9edd698e8eee76fd71 # Parent c4481ed01f7bdf1636044dd63235a09429c9a3a8 (vc-status-tool-bar-map, vc-status-toggle-mark-file) (vc-status-toggle-mark): New functions. (vc-status-mode): Set tool bar map. diff -r c4481ed01f7b -r 5da8fdae3248 lisp/vc.el --- a/lisp/vc.el Wed Mar 05 21:52:47 2008 +0000 +++ b/lisp/vc.el Thu Mar 06 10:58:48 2008 +0000 @@ -616,6 +616,8 @@ (require 'vc-hooks) (require 'ring) +(require 'tool-bar) + (eval-when-compile (require 'cl) (require 'compile) @@ -2734,7 +2736,7 @@ :help "Move to the previous line and unmark the file")) (define-key map [mark-all] - '(menu-item "Marl All" vc-status-mark-all-files + '(menu-item "Mark All" vc-status-mark-all-files :help "Mark all files that are in the same state as the current file\ \nWith prefix argument mark all files")) (define-key map [unmark] @@ -2743,7 +2745,7 @@ (define-key map [mark] '(menu-item "Mark" vc-status-mark - :help "Mark the current file or all files in the region")) + :help "Mark the current file or all files in the region")) (define-key map [separator-open] '("--")) (define-key map [open-other] @@ -2815,6 +2817,29 @@ (interactive "e") (popup-menu vc-status-menu-map e)) +(defun vc-status-tool-bar-map () + (if (display-graphic-p) + (let ((map (make-sparse-keymap))) + (tool-bar-local-item-from-menu 'vc-status-find-file "open" + map vc-status-mode-map) + (tool-bar-local-item "bookmark_add" + 'vc-status-toggle-mark 'vc-status-toggle-mark map + :help "Toggle mark on current item") + (tool-bar-local-item-from-menu 'vc-status-previous-line "left-arrow" + map vc-status-mode-map + :rtl "right-arrow") + (tool-bar-local-item-from-menu 'vc-status-next-line "right-arrow" + map vc-status-mode-map + :rtl "left-arrow") + (tool-bar-local-item-from-menu 'vc-status-refresh "refresh" + map vc-status-mode-map) + (tool-bar-local-item-from-menu 'nonincremental-search-forward + "search" map) + (tool-bar-local-item-from-menu 'bury-buffer "exit" + map vc-status-mode-map) + map))) + + (defvar vc-status-process-buffer nil "The buffer used for the asynchronous call that computes the VC status.") @@ -2829,6 +2854,7 @@ (setq buffer-read-only t) (set (make-local-variable 'vc-status-crt-marked) nil) (use-local-map vc-status-mode-map) + (set (make-local-variable 'tool-bar-map) (vc-status-tool-bar-map)) (let ((buffer-read-only nil) (backend (vc-responsible-backend default-directory)) entries) @@ -3016,6 +3042,17 @@ t)) vc-status)))) +(defun vc-status-toggle-mark-file () + (let* ((crt (ewoc-locate vc-status)) + (file (ewoc-data crt))) + (if (vc-status-fileinfo->marked file) + (vc-status-unmark-file) + (vc-status-mark-file)))) + +(defun vc-status-toggle-mark () + (interactive) + (vc-status-mark-unmark 'toggle-mark-file)) + (defun vc-status-register () "Register the marked files, or the current file if no marks." (interactive)