diff -c remi-1_14/mime-view.el wremi-1_14/mime-view.el *** remi-1_14/mime-view.el Tue Feb 22 16:29:14 2000 --- wremi-1_14/mime-view.el Fri Feb 18 17:30:36 2000 *************** *** 754,765 **** (defvar mime-view-announcement-for-message/partial (if (and (>= emacs-major-version 19) window-system) "\ ! \[[ This is message/partial style split message. ]] ! \[[ Please press `v' key in this buffer ]] ! \[[ or click here by mouse button-2. ]]" "\ ! \[[ This is message/partial style split message. ]] ! \[[ Please press `v' key in this buffer. ]]" )) (defun mime-display-message/partial-button (&optional entity situation) --- 754,764 ---- (defvar mime-view-announcement-for-message/partial (if (and (>= emacs-major-version 19) window-system) "\ ! This is message/partial style split message. ! Please press `v' key in this buffer or click here by mouse button-2." "\ ! This is message/partial style split message. ! Please press `v' key in this buffer." )) (defun mime-display-message/partial-button (&optional entity situation) *************** *** 769,778 **** (insert "\n") ) (goto-char (point-max)) ! (narrow-to-region (point-max)(point-max)) ! (insert mime-view-announcement-for-message/partial) ! (mime-add-button (point-min)(point-max) ! #'mime-preview-play-current-entity) )) (defun mime-display-multipart/mixed (entity situation) --- 768,779 ---- (insert "\n") ) (goto-char (point-max)) ! ;;(narrow-to-region (point-max)(point-max)) ! ;;(insert mime-view-announcement-for-message/partial) ! ;; (mime-add-button (point-min)(point-max) ! ;; #'mime-preview-play-current-entity) ! (mime-insert-button mime-view-announcement-for-message/partial ! #'mime-preview-play-current-entity) )) (defun mime-display-multipart/mixed (entity situation) diff -c remi-1_14/mime-w3.el wremi-1_14/mime-w3.el *** remi-1_14/mime-w3.el Tue Feb 22 16:29:14 2000 --- wremi-1_14/mime-w3.el Mon Jan 17 07:31:31 2000 *************** *** 47,54 **** (defun mime-preview-text/html (entity situation) (setq mime-w3-message-structure ! (with-current-buffer (mime-entity-buffer entity) ! mime-message-structure)) (goto-char (point-max)) (let ((p (point))) (insert "\n") --- 47,56 ---- (defun mime-preview-text/html (entity situation) (setq mime-w3-message-structure ! (let ((ent entity)) ! (while (not (mime-root-entity-p ent)) ! (setq ent (mime-entity-parent ent))) ! ent)) (goto-char (point-max)) (let ((p (point))) (insert "\n") diff -c remi-1_14/semi-def.el wremi-1_14/semi-def.el *** remi-1_14/semi-def.el Tue Feb 22 16:29:14 2000 --- wremi-1_14/semi-def.el Tue Feb 22 18:07:09 2000 *************** *** 31 **** --- 30,32 ---- + (require 'widget) + (eval-when-compile (require 'static)) + (require 'alist) *************** *** 38 **** --- 40,41 ---- + (autoload 'widget-convert-button "wid-edit") + *************** *** 74,82 **** "Insert STRING as button with callback FUNCTION and DATA." (save-restriction (narrow-to-region (point)(point)) ! (insert (concat "[" string "]\n")) ! (mime-add-button (point-min)(point-max) function data) ! )) (defvar mime-button-mother-dispatcher nil) --- 79,88 ---- "Insert STRING as button with callback FUNCTION and DATA." (save-restriction (narrow-to-region (point)(point)) ! (mapcar (function ! (lambda (line) ! (funcall mime-create-button-function line function))) ! (split-string string "\n")))) (defvar mime-button-mother-dispatcher nil) *************** *** 100,105 **** --- 106,228 ---- (funcall mime-button-mother-dispatcher event) ))))) + ;;; @ button for widget + ;;; + + (defun mime-create-widget-button (string function) + "Display STRING as a widget button with the callback FUNCTION. + Under XEmacs, the function `mime-create-xpm-button' might be identical + to the function `mime-create-widget-button' if the feature `xpm' is not + provided or the TTY frame is used." + (let ((start (point))) + (widget-create + 'push-button + :action `(lambda (widget &optional event) (,function)) + :mouse-down-action `(lambda (widget event) + (let (buf point) + (save-window-excursion + (mouse-set-point event) + (setq buf (current-buffer) + point (point))) + (save-excursion + (set-buffer buf) + (goto-char point) + (,function)))) + string) + (static-when (featurep 'xemacs) + (let ((end (point)) + extent) + (insert "[" string "]") + (while (setq extent (extent-at start nil nil extent)) + (set-extent-endpoints extent end (point))) + (delete-region start end)))) + (insert "\n")) + + (static-when (featurep 'xemacs) + (defcustom mime-xpm-button-shadow-thickness 3 + "A number of pixels should be used for the shadows on the edges of + the buttons." + :group 'mime + :type 'integer) + + (defcustom mime-xpm-button-foreground "Yellow" + "A color used to display the text." + :group 'mime + :type 'string) + + (defcustom mime-xpm-button-background "#a0a0d0" + "A background color the text will be displayed upon." + :group 'mime + :type 'string) + + (defvar mime-xpm-button-glyph-cache nil) + + (if (and (featurep 'xpm) (device-on-window-system-p)) + (defun mime-create-xpm-button (string function) + "Display STRING as a XPM button with the callback FUNCTION. + It might be identical to the function `mime-create-widget-button' + if the feature `xpm' is not provided or the TTY frame is used." + (set-extent-properties (make-extent (point) + (progn + (insert "[" string "]") + (point))) + '(invisible t intangible t)) + (let* ((spec (list string + mime-xpm-button-shadow-thickness + mime-xpm-button-foreground + mime-xpm-button-background)) + (button (cdr (assoc spec mime-xpm-button-glyph-cache)))) + (or button + (set-alist 'mime-xpm-button-glyph-cache spec + (setq button (apply (function xpm-button-create) + spec)))) + (let* ((extent (make-extent (point) (point))) + (down-glyph (make-glyph (car (cdr button)))) + (up-glyph (make-glyph (car button))) + (down-func `(lambda (event) + (interactive "e") + (set-extent-begin-glyph ,extent ,down-glyph))) + (up-func `(lambda (event) + (interactive "e") + (mouse-set-point event) + (set-extent-begin-glyph ,extent ,up-glyph) + (,function))) + (keymap (make-sparse-keymap))) + (define-key keymap 'button1 down-func) + (define-key keymap 'button2 down-func) + (define-key keymap 'button1up up-func) + (define-key keymap 'button2up up-func) + (set-extent-begin-glyph extent up-glyph) + (set-extent-property extent 'keymap keymap)) + (insert "\n"))) + (fset 'mime-create-xpm-button 'mime-create-widget-button)) + ) + + (defcustom mime-create-button-function 'mime-create-widget-button + "A function called to create the content button." + :group 'mime + :type (list + 'cons + :convert-widget + (function + (lambda (widget) + (list + 'radio + :args + (append + '((const :tag "Widget button" mime-create-widget-button)) + (static-when (featurep 'xemacs) + '((const :tag "Xpm button" mime-create-xpm-button))) + '((function :tag "Other")))))))) + + (defsubst mime-insert-button (string function &optional data) + "Insert STRING as button with callback FUNCTION and DATA." + (save-restriction + (narrow-to-region (point) (point)) + (mapcar (function + (lambda (line) + (funcall mime-create-button-function line function))) + (split-string string "\n")))) ;;; @ for URL ;;; *************** *** 123,131 **** (while (re-search-forward mime-browse-url-regexp nil t) (let ((beg (match-beginning 0)) (end (match-end 0))) ! (mime-add-button beg end mime-browse-url-function ! (list (buffer-substring beg end)))))) ! ;;; @ menu ;;; --- 246,265 ---- (while (re-search-forward mime-browse-url-regexp nil t) (let ((beg (match-beginning 0)) (end (match-end 0))) ! (widget-convert-button 'mime-url-link beg end ! (buffer-substring beg end)) ! (static-unless (featurep 'xemacs) ! (overlay-put (make-overlay beg end) 'local-map widget-keymap)) ! ))) ! ! (define-widget 'mime-url-link 'link ! "A link to an www page." ! :help-echo 'widget-url-link-help-echo ! :action 'widget-mime-url-link-action) ! ! (defun widget-mime-url-link-action (widget &optional event) ! "Open the url specified by WIDGET." ! (funcall mime-browse-url-function (widget-value widget))) ;;; @ menu ;;;