1 ;;; wl-dnd.el -- dragdrop support on Wanderlust.
3 ;; Copyright 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
5 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
6 ;; Keywords: mail, net news
7 ;; Time-stamp: <2000-02-18 19:14:53 teranisi>
9 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
11 ;; This program is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; This program is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
37 (defun start-drag (event what &optional typ)
39 (funcall (intern "offix-start-drag") event what typ)
40 (funcall (intern "offix-start-drag") event what))))
42 (defun start-drag (event what &optional typ)
44 (funcall (intern "cde-start-drag-internal") event nil
46 (funcall (intern "cde-start-drag-internal") event t what))))
47 (t (defun start-drag (event what &optional typ))))
49 (defun wl-dnd-start-drag (event)
51 (mouse-set-point event)
52 (start-drag event (concat
53 wl-summary-buffer-folder-name " "
54 (int-to-string (wl-summary-message-number)))))
56 (defun wl-dnd-drop-func (event object text)
58 (mouse-set-point event)
60 (when (looking-at "^[ ]*\\([^\\[].+\\):.*\n")
61 (let* ((src-spec (save-match-data
62 (split-string (nth 2 (car (cdr object)))
64 (src-fld (nth 0 src-spec))
65 (number (string-to-int (nth 1 src-spec)))
68 (wl-folder-get-folder-name-by-id (get-text-property
70 'wl-folder-entity-id)))
71 (message "%s is dropped at %s." number
72 (buffer-substring (match-beginning 1)
74 (set-buffer (wl-summary-get-buffer src-fld))
76 (wl-summary-jump-to-msg number))
77 (wl-summary-refile target number)
78 (select-window (get-buffer-window (current-buffer)))
82 (defun wl-dnd-default-drop-message (event object)
83 (message "Dropping here is meaningless.")
86 (defun wl-dnd-set-drop-target (beg end)
88 (setq ext (make-extent beg end))
91 'experimental-dragdrop-drop-functions
92 '((wl-dnd-drop-func t t (buffer-substring beg end))))))
93 ; (set-extent-property ext 'mouse-face 'highlight)))
95 (defun wl-dnd-set-drag-starter (beg end)
97 (setq ext (make-extent beg end))
98 ; (set-extent-property ext 'mouse-face 'isearch)
99 (setq kmap (make-keymap))
100 (define-key kmap [button1] 'wl-dnd-start-drag)
101 (set-extent-property ext 'keymap kmap)))
103 ;;; wl-dnd.el ends here