annotate lisp/hm--html-menus/internal-drag-and-drop.el @ 177:6075d714658b r20-3b15

Import from CVS: tag r20-3b15
author cvs
date Mon, 13 Aug 2007 09:51:16 +0200
parents 25f70ba0133c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
1 ;;; internal-drag-and-drop.el --- Internal drag and drop interface
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
2
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
3 ;; Copyright (C) 1996, 1997 Heiko Muenkel
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
4
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
5 ;; Author: Heiko Muenkel <muenkel@tnt.uni-hannover.de>
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
6 ;; Keywords: mouse
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
7
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
8 ;; $Id: internal-drag-and-drop.el,v 1.5 1997/07/26 22:09:46 steve Exp $
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
9
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
10 ;; This file is part of XEmacs.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
11
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
13 ;; under the terms of the GNU General Public License as published by
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
15 ;; option) any later version.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
16
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
20 ;; General Public License for more details.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
21
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
22 ;; You should have received a copy of the GNU General Public License
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
23 ;; along with XEmacs; See the file COPYING. if not, write to the Free
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
25 ;; 02111-1307, USA.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
26
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
27 ;;; Synched up with: Not part of Emacs.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
28
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
29 ;;; Commentary:
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
30
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
31 ;; Description:
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
32
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
33 ;; This package provides functions to define and call internal
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
34 ;; drag and drop actions in the emacs. One could start such an
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
35 ;; action by clicking with the mouse in the source buffer and
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
36 ;; then in the destination buffer. The action could depend on
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
37 ;; the points where you've clicked with the mouse, on the state
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
38 ;; of the region, the point, the mark and any other properties
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
39 ;; of the source and the destination buffers. The actions are
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
40 ;; defined by the variable `idd-actions', which is a buffer local
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
41 ;; variable. The following is an example for the hm--html-mode:
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
42 ;; (defvar hm--html-idd-actions
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
43 ;; '((nil (((idd-if-major-mode-p . dired-mode)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
44 ;; (idd-if-dired-file-on-line-p
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
45 ;; . ".*\\.\\(gif\\)\\|\\(jpq\\)"))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
46 ;; hm--html-idd-add-include-image-from-dired-line)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
47 ;; (((idd-if-major-mode-p . dired-mode)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
48 ;; (idd-if-dired-no-file-on-line-p . nil))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
49 ;; hm--html-idd-add-file-link-to-file-on-dired-line)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
50 ;; (((idd-if-major-mode-p . dired-mode)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
51 ;; (idd-if-dired-no-file-on-line-p . t))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
52 ;; hm--html-idd-add-file-link-to-directory-of-buffer)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
53 ;; (((idd-if-major-mode-p . w3-mode)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
54 ;; (idd-if-url-at-point-p . t))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
55 ;; hm--html-idd-add-html-link-from-w3-buffer-point)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
56 ;; (((idd-if-major-mode-p . w3-mode))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
57 ;; hm--html-idd-add-html-link-to-w3-buffer)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
58 ;; (((idd-if-local-file-p . t))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
59 ;; hm--html-idd-add-file-link-to-buffer)))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
60 ;; Look at the variable `idd-actions' for further descriptions.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
61
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
62
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
63 ;; Installation:
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
64
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
65 ;; Put this file in one of your load path directories.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
66
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
67 ;; Put the following in your .emacs:
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
68 ;; (autoload 'idd-mouse-drag-and-drop "internal-drag-and-drop"
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
69 ;; "Performs a drag and drop action.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
70 ;; At first you must click on the source and
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
71 ;; after that on the destination."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
72 ;; t)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
73
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
74 ;; Define actions in the variable `idd-actions'.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
75
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
76 ;; The variable `idd-global-mouse-keys' defines the mouse keys,
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
77 ;; which are bound to the drag and drop command.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
78
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
79 ;; The variable `idd-global-help-mouse-keys' defines the mouse keys,
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
80 ;; which are bound to the drag and drop help command.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
81
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
82 ;; The variable `idd-drag-and-drop-mouse-binding-type' determines
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
83 ;; if you've to hold a mouse button down during moving the mouse
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
84 ;; from the source to the destination or not.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
85
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
86 ;; Emacs 19 users should read carefully the whole comments of
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
87 ;; `idd-drag-and-drop-mouse-binding-type', `idd-global-mouse-keys'
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
88 ;; and `idd-global-help-mouse-keys', if they would like to change
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
89 ;; any of these variables or the mouse bindings!
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
90
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
91 ;;; Code:
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
92
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
93 (require 'adapt)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
94 (require 'cl)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
95
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
96 (defgroup idd-drag-and-drop nil
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
97 "This package provides functions to define and call internal
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
98 drag and drop actions in the emacs. One could start such an
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
99 action by clicking with the mouse in the source buffer and
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
100 then in the destination buffer. The action could depend on
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
101 the points where you've clicked with the mouse, on the state
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
102 of the region, the point, the mark and any other properties
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
103 of the source and the destination buffers. The actions are
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
104 defined by the variable `idd-actions', which is a buffer local
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
105 variable."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
106 :group 'mouse)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
107
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
108 (defcustom idd-drag-and-drop-mouse-binding-type 'click
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
109 "*The type of the drag and drop mouse binding.
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
110 The value maybe `click' or `press-button-during-move'.
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
111 A value of `click' means, that you've to click over the source, leave
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
112 the button and click it again over the destination.
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
113 A value of `press-button-during-move' means, that you've to press
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
114 the button down over the source and hold it until the mouse pointer
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
115 is over the destination.
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
116
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
117 The disadvantage of the `press-button-during-move' type compared with
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
118 the `click' type is, that you can't select a destination region and
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
119 therefore a drag and drop action depending on a selected region can't
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
120 be started with that type of mouse binding.
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
121
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
122 Note: In the Emacs 19 you'll have to change also the keybindings of
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
123 the drag and drop commands, if you change this variable. Look at the
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
124 variables `idd-global-mouse-keys' and `idd-global-help-mouse-keys' for
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
125 this."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
126 :group 'idd-drag-and-drop
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
127 :type '(choice (const :tag "Click on source and destination"
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
128 :value click)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
129 (const :tag "Press button during mouse move"
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
130 :value press-button-during-move)))
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
131
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
132 (defvar idd-global-mouse-keys (if (adapt-emacs19p)
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
133 (if (eq idd-drag-and-drop-mouse-binding-type
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
134 'click)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
135 [(meta control mouse-1)]
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
136 [(meta control down-mouse-1)])
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
137 [(meta control button1)])
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
138 "The mouse keys for the command `idd-mouse-drag-and-drop'.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
139 The command `idd-mouse-drag-and-drop' is bound during the loading
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
140 of the package internal-drag-and-drop to this keys in the global
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
141 key map.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
142
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
143 Set it to nil, if you don't want to bind this function during loading.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
144
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
145 If the command is already bound in the global keymap during loading,
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
146 then this key sequence will not be bind.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
147
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
148 Note: In the Emacs 19 the mouse keys must contain the modifier
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
149 `down', if `idd-drag-and-drop-mouse-binding-type' is set to
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
150 `press-button-during-move' and must not contain the modifier, if it
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
151 is set to `click'. If you set `idd-drag-and-drop-mouse-binding-type'
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
152 before loading the package internal-drag-and-drop, the mouse will
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
153 be bind in the right way.")
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
154
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
155 (defvar idd-global-help-mouse-keys
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
156 (if (adapt-emacs19p)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
157 (if (eq idd-drag-and-drop-mouse-binding-type 'click)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
158 [(meta control mouse-3)]
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
159 [(meta control down-mouse-3)])
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
160 [(meta control button3)])
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
161 "The mouse keys for the command `idd-help-mouse-drag-and-drop'.
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
162 The command `idd-help-mouse-drag-and-drop' is bound during the loading
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
163 of the package internal-drag-and-drop to this keys in the global
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
164 key map.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
165
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
166 Set it to nil, if you don't want to bind this function during loading.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
167
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
168 If the command is already bound in the global keymap during loading,
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
169 then this key sequence will not be bind.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
170
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
171 Note: In the Emacs 19 the mouse keys must contain the modifier
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
172 `down', if `idd-drag-and-drop-mouse-binding-type' is set to
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
173 `press-button-during-move' and must not contain the modifier, if it
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
174 is set to `click'. If you set `idd-drag-and-drop-mouse-binding-type'
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
175 before loading the package internal-drag-and-drop, the mouse will
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
176 be bind in the right way.")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
177
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
178 (defcustom idd-actions '((((idd-if-region-active-p . nil))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
179 (((idd-if-region-active-p . t))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
180 idd-action-copy-region))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
181
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
182 (((idd-if-region-active-p . t))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
183 (((idd-if-region-active-p . t))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
184 idd-action-copy-replace-region))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
185
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
186 (((idd-if-region-active-p . nil)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
187 (idd-if-modifiers-p . nil))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
188 (((idd-if-region-active-p . t))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
189 idd-action-move-region))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
190
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
191 (((idd-if-region-active-p . t)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
192 (idd-if-modifiers-p . nil))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
193 (((idd-if-region-active-p . t))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
194 idd-action-move-replace-region))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
195 )
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
196 "*The list with actions, depending on the source and the destination.
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
197 The list looks like:
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
198 '((<destination-specification-1> (<source-specification-1> <action-1-1>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
199 (<source-specification-2> <action-1-2>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
200 :
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
201 )
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
202 (<destination-specification-2> (<source-specification-1> <action-2-1>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
203 (<source-specification-2> <action-2-2>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
204 :
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
205 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
206 :
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
207 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
208 The <source-specification> looks like the following:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
209 '([(<specification-type> <value>)])
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
210 with <specification-type> :== idd-if-minor-mode-p | idd-if-buffer-name-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
211 | idd-if-region-active-p | idd-if-url-at-point-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
212 | idd-if-major-mode-p | idd-if-variable-non-nil-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
213 | idd-if-dired-file-on-line-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
214 | idd-if-dired-no-file-on-line-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
215 | idd-if-local-file-p | idd-if-buffer-name-p
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
216 | idd-if-modifiers-p | ...
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
217
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
218 The <specification-type> - functions must have two arguments, the first one
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
219 is the source or destination and the second is the <value>. It must return
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
220 nil, if the test wasn't successfull and a number (in general 1), which
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
221 specifies the weight of the test function. The weights of all single tests
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
222 are added to a summary weight and assigned to the action. The action
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
223 with the highest weight is called from the action handler. Look at
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
224 the definition of `idd-if-major-mode-p', `idd-if-minor-mode-p' and so on for
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
225 examples. Look at the function `idd-get-source-or-destination-alist', if
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
226 you wan't to know the structure of the 'source-or-destination' argument
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
227 of these functions.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
228
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
229 The <destination-specification> looks like <source-specification>,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
230 but in general it could be set to nil in mode specific idd-action
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
231 lists.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
232
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
233 If <destination-specification-1> or <source-specification-1> is set to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
234 nil, then every source or source matches. `idd-actions' is a
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
235 buffer local variable, which should be at least mode depended. So if
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
236 the <destination-specification-1> is set to nil it says, that the destination
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
237 buffer must only have a specific mode. But however, it's also possible
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
238 to define a general `idd-actions' list, where the destination mode is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
239 specified by `idd-if-major-mode-p'.
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
240
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
241 <action> ist a function, which has two arguments, the first specifies the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
242 source and the second the destination. Look at the function definition
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
243 of `idd-action-copy-region' and `idd-action-copy-replace-region'. They are
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
244 examples for such actions."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
245 :group 'idd-drag-and-drop
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
246 :type 'list)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
247
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
248 (make-variable-buffer-local 'idd-actions)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
249
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
250 (defcustom idd-help-instead-of-action nil
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
251 "*If this variable is t, then a help buffer is displayed.
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
252 No action will be performed if this variable is t.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
253
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
254 Note: You can also use the help mouse key instead of setting
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
255 this to t."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
256 :group 'idd-drag-and-drop
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
257 :type 'boolean)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
258
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
259 (defcustom idd-mouse-pointer-image "drop"
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
260 "*The name of the image used as mouse pointer during drag and drop.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
261 The image must be in the directory `idd-data-directory'.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
262 Run the command `idd-make-drag-and-drop-pointer-glyph' after changing
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
263 this variable."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
264 :group 'idd-drag-and-drop
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
265 :type 'file)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
266
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
267 (defcustom idd-data-directory (file-name-as-directory
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
268 (expand-file-name "idd" data-directory))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
269 "Data directory for the file `idd-mouse-pointer-image'.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
270 Run the command `idd-make-drag-and-drop-pointer-glyph' after changing
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
271 this variable."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
272 :group 'idd-drag-and-drop
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
273 :type 'directory)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
274
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
275 (defcustom idd-overwrite-mouse-pointers
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
276 (if (adapt-xemacsp)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
277 '(text-pointer-glyph
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
278 nontext-pointer-glyph
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
279 selection-pointer-glyph)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
280 nil)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
281 "*A list with pointer glyph variables, which should be overwritten
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
282 by the idd-drag-and-drop-pointer-glyph. If it is nil, the pointer
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
283 wont be changed. Currently it must be nil in the Emacs."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
284 :group 'idd-drag-and-drop
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
285 :type '(repeat lisp))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
286
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
287 (defvar idd-drag-and-drop-pointer-glyph nil
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
288 ; (if idd-overwrite-mouse-pointers
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
289 ; (make-pointer-glyph
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
290 ; (vector 'autodetect :data idd-mouse-pointer-image))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
291 ; nil)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
292 "The shape of the mouse-pointer when internal drag and drop is active.")
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
293
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
294 (defvar idd-original-pointer-image-instances nil
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
295 "Internal variable. Alist with the saved images instances of the pointers.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
296 This list is used to restore the old mouse pointers.")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
297
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
298 (defvar idd-help-start-action-keymap nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
299 "Keymap used in an extent in the help buffer to start the action.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
300
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
301 (defvar idd-help-source nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
302 "Contains the source of an action. Used only in the help buffer.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
303
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
304 (defvar idd-help-destination nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
305 "Contains the destination of an action. Used only in the help buffer.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
306
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
307 (defvar idd-help-start-extent nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
308 "The start extent in the help buffer.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
309
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
310 (defun idd-compare-a-specification (source-or-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
311 specification)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
312 "Tests if SOURCE-OR-DESTINATION matches the SPECIFICATION.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
313 It returns a value (1 in general) if both are matching or nil."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
314 (eval (list (car specification)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
315 'source-or-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
316 '(cdr specification))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
317
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
318 (defun idd-get-old-pointer-image-instances (mouse-pointers)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
319 "Returns an alist with the pointer variables and there image instances."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
320 (cond ((not mouse-pointers) nil)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
321 (t (cons (cons (car mouse-pointers)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
322 (glyph-image-instance (eval (car mouse-pointers))))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
323 (idd-get-old-pointer-image-instances (cdr mouse-pointers))))))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
324
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
325 (defun idd-set-drag-and-drop-pointer-glyphs-1 (mouse-pointers
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
326 drag-and-drop-pointer-glyph)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
327 "Internal function."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
328 (cond ((not mouse-pointers))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
329 (t (set-glyph-image (eval (car mouse-pointers))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
330 (glyph-image-instance drag-and-drop-pointer-glyph))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
331 (idd-set-drag-and-drop-pointer-glyphs-1 (cdr mouse-pointers)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
332 drag-and-drop-pointer-glyph)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
333 )))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
334
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
335 (defun idd-set-drag-and-drop-pointer-glyphs ()
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
336 "Set the shape of some pointers to the drag and drop shape.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
337 Only the pointers in the list `idd-overwrite-mouse-pointers' are
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
338 used."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
339 (unless (or idd-original-pointer-image-instances
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
340 (not idd-overwrite-mouse-pointers))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
341 (setq idd-original-pointer-image-instances
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
342 (idd-get-old-pointer-image-instances idd-overwrite-mouse-pointers))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
343 (idd-set-drag-and-drop-pointer-glyphs-1 idd-overwrite-mouse-pointers
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
344 idd-drag-and-drop-pointer-glyph)))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
345
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
346 (defun idd-restore-original-pointer-glyphs-1 (pointer-alist)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
347 "Internal function."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
348 (cond ((not pointer-alist))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
349 (t (set-glyph-image (eval (car (car pointer-alist)))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
350 (cdr (car pointer-alist)))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
351 (idd-restore-original-pointer-glyphs-1 (cdr pointer-alist)))))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
352
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
353 (defun idd-restore-original-pointer-glyphs ()
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
354 "Restores the original pointer shapes."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
355 (interactive)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
356 (when idd-overwrite-mouse-pointers
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
357 (idd-restore-original-pointer-glyphs-1
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
358 idd-original-pointer-image-instances)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
359 (setq idd-original-pointer-image-instances nil)))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
360
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
361 (defun idd-compare-specifications-1 (source-or-destination
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
362 specifications
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
363 value)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
364 "Internal function of `idd-compare-specifications'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
365 VALUE is the value of the last matches."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
366 (cond ((not specifications) value)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
367 (t (let ((match (idd-compare-a-specification source-or-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
368 (car specifications))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
369 (cond ((not match) 0)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
370 (t (idd-compare-specifications-1 source-or-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
371 (cdr specifications)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
372 (+ value match))))))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
373
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
374 (defun idd-compare-specifications (source-or-destination
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
375 specifications)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
376 "Determines how good SOURCE-OR-DESTINATION and SPECIFICATIONS are matching.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
377 A return value of zero means, that they don't match. The higher the
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
378 return value the better is the matching."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
379 (cond ((not specifications) 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
380 (t (idd-compare-specifications-1 source-or-destination
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
381 specifications
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
382 0))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
383
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
384 (defun idd-get-action-depending-on-source (source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
385 actions-depending-on-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
386 destination-value
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
387 value-action-pair)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
388 "Internal function of `idd-get-action-depending-on-source-and-destination'."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
389 (let ((source-value (idd-compare-specifications
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
390 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
391 (car (car actions-depending-on-source)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
392 (cond ((not actions-depending-on-source) value-action-pair)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
393 ((or (= source-value 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
394 (<= (+ destination-value source-value) (car value-action-pair)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
395 (idd-get-action-depending-on-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
396 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
397 (cdr actions-depending-on-source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
398 destination-value
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
399 value-action-pair))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
400 (t (idd-get-action-depending-on-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
401 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
402 (cdr actions-depending-on-source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
403 destination-value
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
404 (cons (+ destination-value source-value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
405 (second (car actions-depending-on-source))))))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
406
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
407 (defun idd-get-action-depending-on-source-and-destination (source
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
408 destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
409 actions
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
410 value-action-pair)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
411 "Internal function of `idd-get-action'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
412 VALUE-ACTION-PAIR is a list like (<value> <action>).
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
413 It returns VALUE-ACTION-PAIR, if no other action is found, which has a
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
414 value higher than (car VALUE-ACTION-PAIR)."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
415 (let ((destination-value
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
416 (idd-compare-specifications destination (car (car actions)))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
417 (cond ((not actions) value-action-pair)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
418 ((= destination-value 0)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
419 (idd-get-action-depending-on-source-and-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
420 source
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
421 destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
422 (cdr actions)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
423 value-action-pair))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
424 (t (idd-get-action-depending-on-source-and-destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
425 source
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
426 destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
427 (cdr actions)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
428 (idd-get-action-depending-on-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
429 source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
430 (cdr (car actions))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
431 destination-value
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
432 value-action-pair))))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
433
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
434 (defun idd-get-action (source destination actions)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
435 "Returns the action, which depends on the SOURCE and the DESTINATION.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
436 The list ACTIONS contains all possible actions. Look at the variable
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
437 `idd-actions' for a description of the format of this list."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
438 (idd-get-action-depending-on-source-and-destination source
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
439 destination
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
440 actions
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
441 '(0 . nil)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
442
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
443 ;(autoload 'ange-ftp-ftp-path "ange-ftp"
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
444 ; "Parse PATH according to ange-ftp-path-format (which see).
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
445 ;Returns a list (HOST USER PATH), or nil if PATH does not match the format.")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
446
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
447 (defun idd-get-buffer (source-or-destination)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
448 "Returns the buffer of the SOURCE-OR-DESTINATION."
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
449 (cdr (assoc ':buffer source-or-destination)))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
450
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
451 (defun idd-set-point (source-or-destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
452 "Sets the point and buffer to SOURCE-OR-DESTINATION."
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
453 (set-buffer (idd-get-buffer source-or-destination))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
454 (goto-char (cdr (assoc ':drag-or-drop-point source-or-destination))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
455
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
456 (defun idd-set-region (source-or-destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
457 "Sets the point, mark and buffer to SOURCE-OR-DESTINATION.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
458 The region is active after this function is called."
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
459 (set-buffer (idd-get-buffer source-or-destination))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
460 (goto-char (car (cdr (assoc ':region-active source-or-destination))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
461 (set-mark (cdr (cdr (assoc ':region-active source-or-destination))))
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
462 (if (adapt-xemacsp)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
463 (activate-region))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
464 )
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
465
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
466
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
467 ;;; Specification type functions for the list `idd-actions'
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
468
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
469 (defun idd-if-region-active-p (source-or-destination value)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
470 "Checks if the region in the SOURCE-OR-DESTINATION was active.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
471 It returns 1, if the region was active and VALUE is t, or if
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
472 the region was not active and VALUE is nil. Otherwise it returns
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
473 nil."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
474 (if (cdr (assoc ':region-active source-or-destination))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
475 (if value 1 nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
476 (if value nil 1)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
477
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
478 (defun idd-get-buffer-url (source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
479 "Returns the URL of the buffer specified by SOURCE-OR-DESTINATION."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
480 (save-excursion
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
481 (idd-set-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
482 (url-view-url t)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
483
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
484 (defun idd-get-url-at-point (source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
485 "Returns the URL at the point specified by SOURCE-OR-DESTINATION.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
486 It returns nil, if there is no URL."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
487 (save-excursion
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
488 (idd-set-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
489 (w3-view-this-url t)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
490
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
491 (defun idd-if-url-at-point-p (source-or-destination value)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
492 "Checks if there is an URL at the point of SOURCE-OR-DESTINATION.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
493 If that is t and VALUE is t, or that is nil and VALUE is nil, then 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
494 is returned. Otherwise nil is returned."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
495 (if value
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
496 (if (idd-get-url-at-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
497 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
498 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
499 (if (idd-get-url-at-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
500 nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
501 1)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
502
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
503 (defun idd-if-major-mode-p (source-or-destination mode)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
504 "Checks, if the major mode of SOURCE-OR-DESTINATION is MODE.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
505 It returns 1, if that is t and nil otherwise."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
506 (save-excursion
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
507 (set-buffer (idd-get-buffer source-or-destination))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
508 (if (eq major-mode mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
509 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
510 nil)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
511
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
512 (defun idd-if-variable-non-nil-p (source-or-destination variable)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
513 "Checks, if the variable named VARIABLE isn't t in SOURCE-OR-DESTINATION.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
514 It returns 1, if this is t."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
515 (save-excursion
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
516 (set-buffer (idd-get-buffer source-or-destination))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
517 (if (eval variable)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
518 1
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
519 nil)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
520
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
521 (defun idd-if-minor-mode-p (source-or-destination minor-mode-variable)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
522 "Checks, if the variable MINOR-MODE-VARIABLE is t in SOURCE-OR-DESTINATION.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
523 MINOR-MODE-VARIABLE is the name of the variable!."
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
524 (idd-if-variable-non-nil-p source-or-destination minor-mode-variable))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
525
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
526 (defun idd-get-dired-filename-from-line (source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
527 "Returns the filename form the line in a dired buffer.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
528 The position and the buffer is specified by SOURCE-OR-DESTINATION."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
529 (save-excursion
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
530 (idd-set-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
531 (dired-get-filename nil t)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
532
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
533 (defun idd-if-dired-file-on-line-p (source-or-destination filename-regexp)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
534 "Checks, if the filename on the line match FILENAME-REGEXP.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
535 The function `dired-get-filename' is used, to get the filename from
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
536 the SOURCE-OR-DESTINATION. It returns 1, if it matchs or nil."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
537 (let ((case-fold-search t))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
538 (if (and (idd-get-dired-filename-from-line source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
539 (string-match filename-regexp
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
540 (idd-get-dired-filename-from-line
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
541 source-or-destination)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
542 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
543 nil)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
544
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
545 (defun idd-if-dired-no-file-on-line-p (source-or-destination value)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
546 "Checks, if a filename is in the dired buffer of SOURCE-OR-DESTINATION.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
547 It returns 1, if a filename is on the line and if VALUE is t, or if
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
548 no filename is on the line and VALUE is nil, otherwise it returns
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
549 nil. For the test the function `dired-get-filename' is used."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
550 (if (idd-get-dired-filename-from-line source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
551 (if value nil 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
552 (if value 1 nil)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
553
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
554 (defun idd-get-local-filename (source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
555 "Returns the filename of a local file specified by SOURCE-OR-DESTINATION."
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
556 (buffer-file-name (idd-get-buffer source-or-destination)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
557
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
558 (defun idd-get-directory-of-buffer (source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
559 "Returns the directory name assigned to the SOURCE-OR-DESTINATION buffer."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
560 (save-excursion
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
561 (idd-set-point source-or-destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
562 default-directory))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
563
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
564 (defun idd-if-local-file-p (source-or-destination value)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
565 "Checks, if SOURCE-OR-DESTINATION has a file on the local filesystem.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
566 If that is t and VALUE is t, or that is nil and VALUE is nil, then 1
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
567 is returned. Otherwise nil is returned."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
568 (let ((filename (idd-get-local-filename source-or-destination)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
569 (if (and filename
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
570 ; (not (ange-ftp-ftp-path filename)))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
571 (not (file-remote-p filename)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
572 (if value 1 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
573 (if value nil 1))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
574
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
575 (defun idd-if-buffer-name-p (source-or-destination buffer-name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
576 "Checks, if SOURCE-OR-DESTINATION has a buffer called BUFFER-NAME.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
577 It returns 1 if this is the case or nil otherwise."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
578 (if (string= buffer-name
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
579 (buffer-name (idd-get-buffer source-or-destination)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
580 1
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
581 nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
582
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
583 (defun idd-list-1-subset-of-list-2 (list-1 list-2)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
584 "Returns t, if LIST-1 is a subset of LIST-2."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
585 (cond ((not list-1))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
586 ((member (car list-1) list-2)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
587 (idd-list-1-subset-of-list-2 (cdr list-1) list-2))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
588 (t nil)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
589
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
590 (defun idd-same-elements-p (list-1 list-2)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
591 "Returns t, if both list have the same modifiers."
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
592 (and (= (length list-1) (length list-2))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
593 (idd-list-1-subset-of-list-2 list-1 list-2)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
594
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
595 (defun idd-if-modifiers-p (source-or-destination modifiers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
596 "Checks, if the MODIFIERS hold during selecting the SOURCE-OR-DESTINATION.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
597 Returns 1, if the list MODIFIERS contains the same modifiers,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
598 or if any modyfiers are hold and MODIFIERS is t,
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
599 or if no modyfiers are hold and MODIFIERS is nil.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
600 Otherwise nil is returned."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
601 (let ((event-modifiers (event-modifiers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
602 (cdr (assoc ':event source-or-destination)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
603 (cond ((not modifiers)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
604 (if event-modifiers nil 1))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
605 ((listp modifiers)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
606 (if (idd-same-elements-p modifiers event-modifiers)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
607 1
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
608 nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
609 (t (if event-modifiers 1 nil)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
610
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
611 ;;; action functions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
612
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
613 (defun idd-action-copy-region (source destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
614 "Copy the region from DESTINATION to SOURCE."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
615 (idd-set-region source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
616 (let ((region-contents (buffer-substring (point) (mark))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
617 (idd-set-point destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
618 (insert region-contents)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
619
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
620 (defun idd-action-copy-replace-region (source destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
621 "Copy the region from SOURCE and replace the DESTINATION region with it."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
622 (idd-set-region source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
623 (let ((region-contents (buffer-substring (point) (mark))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
624 (idd-set-region destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
625 (delete-region (point) (mark))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
626 (insert region-contents)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
627
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
628 (defmacro* idd-with-source-and-destination (source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
629 destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
630 &key
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
631 do-in-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
632 do-in-destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
633 "Macro, usefull for the definition of action functions.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
634 Look at the example `idd-action-move-region'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
635 `(progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
636 (if (idd-if-region-active-p ,source t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
637 (idd-set-region ,source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
638 (idd-set-point ,source))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
639 ,(when do-in-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
640 (cons 'progn do-in-source))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
641 (if (idd-if-region-active-p ,destination t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
642 (idd-set-region ,destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
643 (idd-set-point ,destination))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
644 ,(when do-in-destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
645 (cons 'progn do-in-destination))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
646
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
647 (defun idd-action-move-region (source destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
648 "Move the region from SOURCE to DESTINATION."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
649 (let ((region))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
650 (idd-with-source-and-destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
651 source destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
652 :do-in-source ((setq region (buffer-substring (point) (mark)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
653 (delete-region (point) (mark)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
654 :do-in-destination ((insert region)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
655
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
656
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
657 (defun idd-action-move-replace-region (source destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
658 "Delete the region at SOURCE and overwrite the DESTINATION region with it."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
659 (let ((region))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
660 (idd-with-source-and-destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
661 source destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
662 :do-in-source ((setq region (buffer-substring (point) (mark)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
663 (delete-region (point) (mark)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
664 :do-in-destination ((delete-region (point) (mark))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
665 (insert region)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
666
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
667
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
668 ;;; Performing the drag and drop
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
669
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
670 (defun idd-display-help-about-action (action source destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
671 "Display a help buffer with information about the action."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
672 (if (> (car action) 0)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
673 (if (symbol-function (cdr action))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
674 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
675 (with-displaying-help-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
676 '(lambda ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
677 (set-buffer "*Help*")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
678 (setq idd-help-source source)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
679 (setq idd-help-destination destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
680 (insert "Drag and drop action: `")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
681 (let ((start (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
682 (insert (format "%s" (cdr action)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
683 (setq idd-help-start-extent (make-extent start (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
684 (set-extent-mouse-face idd-help-start-extent 'highlight)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
685 (set-extent-face idd-help-start-extent 'bold)
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
686 (if (adapt-xemacsp)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
687 (set-extent-keymap idd-help-start-extent
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
688 idd-help-start-action-keymap)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
689 )
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
690 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
691 (insert "'\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
692 (insert (format "Source buffer : `%s'\n"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
693 (buffer-name (cdr (assoc ':buffer source)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
694 (insert (format "Destination buffer : `%s'\n"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
695 (buffer-name (cdr (assoc ':buffer destination))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
696 )))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
697 (insert "=================================================="
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
698 "====================\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
699 (insert "Look at `idd-actions' in the "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
700 "destination buffer for other actions!\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
701 (insert (format "The documentation of `%s':\n\n"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
702 (cdr action)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
703 (insert (documentation (cdr action)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
704 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
705 (error "Error: Action %s isn't a valid function!" (cdr action)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
706 (message "No valid action defined for this source and this destination!")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
707
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
708 (defun idd-call-action (action source destination)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
709 "Calls the drag and drop ACTION with its arguments SOURCE and DESTINATION."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
710 (if (> (car action) 0)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
711 (if (symbol-function (cdr action))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
712 (eval (list (cdr action) 'source 'destination))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
713 (error "Error: Action %s isn't a valid function!" (cdr action)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
714 (message "No valid action defined for this source and this destination!")))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
715
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
716 (defun idd-start-help-mouse-drag-and-drop ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
717 "Starts help on `idd-start-mouse-drag-and-drop'."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
718 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
719 (let ((idd-help-instead-of-action t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
720 (idd-start-mouse-drag-and-drop)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
721
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
722 (defun idd-start-mouse-drag-and-drop ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
723 "Starts a drag and drop command.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
724 This command could be used to start a drag and drop command without a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
725 button event. Therefore this should not be bind direct to a mouse button."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
726 (interactive)
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
727 (let ((source-event)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
728 (drag-and-drop-message "Drag&Drop: Click on the source!"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
729 (message drag-and-drop-message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
730 (setq source-event
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
731 (next-command-event nil drag-and-drop-message))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
732 (if (button-press-event-p source-event)
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
733 (progn
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
734 (when (and (adapt-emacs19p)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
735 (mouse-event-p source-event)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
736 (eq idd-drag-and-drop-mouse-binding-type 'click))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
737 (while (not (button-release-event-p (next-command-event)))))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
738 (idd-mouse-drag-and-drop source-event))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
739 (message "Wrong event! Exit drag and drop."))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
740
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
741 (defun idd-help-mouse-drag-and-drop (source-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
742 "Displays help about the drag and drop action."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
743 (interactive "@e")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
744 (let ((idd-help-instead-of-action t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
745 (idd-mouse-drag-and-drop source-event)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
746
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
747 (defun idd-mouse-drag-and-drop (source-event)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
748 "Performs a drag and drop action.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
749 It calls the command `idd-mouse-drag-and-drop-click' or
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
750 `idd-mouse-drag-and-drop-press-button-during-move' depending on
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
751 the value of `idd-drag-and-drop-mouse-binding-type'."
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
752 (interactive "@e")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
753 (if (eq idd-drag-and-drop-mouse-binding-type 'click)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
754 (idd-mouse-drag-and-drop-click source-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
755 (idd-mouse-drag-and-drop-press-button-during-move source-event)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
756
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
757 (defun idd-get-source-or-destination-alist (event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
758 "Returns an alist with the description of a source or destination point.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
759 The EVENT must be the button event, which has selected the source or
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
760 destination of the drag and drop command.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
761
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
762 The alist has the following structure:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
763 '((:buffer . <buffer-of-the-event>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
764 (:drag-or-drop-point . <closest-point-to-the-event>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
765 (:region-active . <t-or-nil>)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
766 (:event . EVENT))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
767
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
768 Note: <closest-point-to-the-event> is (event-closest-point EVENT),
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
769 if the EVENT is a mouse event and if it isn't nil. Otherwise the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
770 point is used."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
771 ; (set-buffer (event-buffer event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
772 (list (cons ':buffer (event-buffer event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
773 (cons ':drag-or-drop-point (set-marker
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
774 (make-marker)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
775 (if (mouse-event-p event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
776 (or (event-closest-point event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
777 (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
778 (point))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
779 (cons ':region-active (if (region-active-p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
780 (cons (set-marker (make-marker) (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
781 (set-marker (make-marker) (mark)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
782 (cons ':event event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
783 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
784
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
785 (defun idd-mouse-drag-and-drop-press-button-during-move (source-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
786 "Performs a drag and drop action.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
787 At first you must press the button down over the source and then
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
788 move with the pressed button to the destination, where you must leave
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
789 the button up.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
790 This must be bind to a mouse button. The SOURCE-EVENT must be a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
791 button-press-event.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
792
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
793 The disadvantage of this command compared with the command
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
794 `idd-mouse-drag-and-drop-click' is, that you can't select a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
795 destination region."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
796 (interactive "@e")
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
797 (idd-set-drag-and-drop-pointer-glyphs)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
798 (let ((drag-and-drop-message
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
799 "Drag&Drop: Leave the button over the destination!")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
800 (source (idd-get-source-or-destination-alist source-event))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
801 (destination nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
802 (destination-event))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
803 (message drag-and-drop-message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
804 (setq destination-event
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
805 (next-command-event nil drag-and-drop-message))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
806 (message "")
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
807 (cond ((or (button-release-event-p destination-event)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
808 (and (adapt-emacs19p)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
809 (button-drag-event-p destination-event)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
810 (setq destination (idd-get-source-or-destination-alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
811 destination-event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
812 (idd-set-point destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
813 (if idd-help-instead-of-action
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
814 (idd-display-help-about-action (idd-get-action source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
815 destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
816 idd-actions)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
817 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
818 destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
819 (idd-call-action (idd-get-action source destination idd-actions)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
820 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
821 destination)))
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
822 (t (message "Wrong event! Exit drag and drop.") nil)))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
823 (idd-restore-original-pointer-glyphs))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
824
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
825 (defun idd-mouse-drag-and-drop-click (source-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
826 "Performs a drag and drop action.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
827 At first you must click on the source and after that on the destination.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
828 This must be bind to a mouse button. The SOURCE-EVENT must be a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
829 button-press-event."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
830 (interactive "@e")
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
831 (idd-set-drag-and-drop-pointer-glyphs)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
832 (let ((drag-and-drop-message "Drag&Drop: Click on the destination!")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
833 (source (idd-get-source-or-destination-alist source-event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
834 (destination nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
835 (destination-event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
836 (message drag-and-drop-message)
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
837 (when (and (adapt-xemacsp) (mouse-event-p source-event))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
838 (dispatch-event (next-command-event)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
839 (setq destination-event
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
840 (next-command-event nil drag-and-drop-message))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
841 (message "")
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
842 (cond ((button-press-event-p destination-event)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
843 (mouse-track destination-event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
844 (setq destination (idd-get-source-or-destination-alist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
845 destination-event))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
846 (idd-set-point destination)
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
847 ; (when (adapt-emacs19p)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
848 ; (while (not (button-release-event-p (next-command-event)))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
849 (if idd-help-instead-of-action
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
850 (idd-display-help-about-action (idd-get-action source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
851 destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
852 idd-actions)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
853 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
854 destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
855 (idd-call-action (idd-get-action source destination idd-actions)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
856 source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
857 destination)))
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
858 ((and (adapt-emacs19p)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
859 (button-click-event-p destination-event))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
860 (setq destination (idd-get-source-or-destination-alist
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
861 destination-event))
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
862 (idd-set-point destination)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
863 (if idd-help-instead-of-action
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
864 (idd-display-help-about-action (idd-get-action source
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
865 destination
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
866 idd-actions)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
867 source
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
868 destination)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
869 (idd-call-action (idd-get-action source destination idd-actions)
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
870 source
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 98
diff changeset
871 destination)))
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
872 (t (message "Wrong event! Exit drag and drop.") nil))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
873
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
874 ;; Useful for debugging
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
875 ;; (setq idd-last-source source)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
876 ;; (setq idd-last-destination destination)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 116
diff changeset
877
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
878 )
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
879 (idd-restore-original-pointer-glyphs))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
880
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
881 (defun idd-help-start-action (event)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
882 "Used to start the action from the help buffer."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
883 (interactive "@e")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
884 (idd-set-point idd-help-destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
885 (idd-call-action (idd-get-action idd-help-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
886 idd-help-destination
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
887 idd-actions)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
888 idd-help-source
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
889 idd-help-destination)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
890 (delete-extent idd-help-start-extent))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
891
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
892 (if (adapt-xemacsp)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
893 (progn
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
894
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
895 (defun idd-make-drag-and-drop-pointer-glyph ()
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
896 "Creates the drag and drop pointer glyph.
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
897 You've to rerun this, if you change either the variable
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
898 `idd-data-directory' or `idd-mouse-pointer-image'."
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
899 (interactive)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
900 (let ((mouse-pointer-image (if (and idd-data-directory
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
901 idd-mouse-pointer-image)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
902 (expand-file-name
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
903 (file-name-nondirectory
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
904 idd-mouse-pointer-image)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
905 idd-data-directory)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
906 idd-mouse-pointer-image)))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
907 (if (and mouse-pointer-image
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
908 (file-exists-p mouse-pointer-image))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
909 (setq idd-drag-and-drop-pointer-glyph
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
910 (make-pointer-glyph
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
911 (vector 'autodetect :data mouse-pointer-image)))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
912 (setq idd-drag-and-drop-pointer-glyph (make-pointer-glyph))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
913 (message
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
914 "Warning: Can't find drag and drop mouse pointer image!"))))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
915
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
916 (idd-make-drag-and-drop-pointer-glyph)
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
917
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
918 ))
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
919
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
920 ;; keymap for help buffer extents
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
921 (if (not idd-help-start-action-keymap)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
922 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
923 (setq idd-help-start-action-keymap
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
924 (make-sparse-keymap 'idd-help-start-action-keymap))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
925 (if (adapt-emacs19p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
926 (define-key idd-help-start-action-keymap [(mouse-2)]
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
927 'idd-help-start-action)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
928 (define-key idd-help-start-action-keymap "[(button2)]"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
929 'idd-help-start-action))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
930
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
931 ;; global key bindings
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
932 (when idd-global-mouse-keys
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
933 (unless (where-is-internal 'idd-mouse-drag-and-drop global-map t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
934 (define-key global-map idd-global-mouse-keys 'idd-mouse-drag-and-drop))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
935 (unless (where-is-internal 'idd-help-mouse-drag-and-drop global-map t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
936 (define-key global-map
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
937 idd-global-help-mouse-keys 'idd-help-mouse-drag-and-drop)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
938
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
939
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
940 (provide 'internal-drag-and-drop)
177
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
941
6075d714658b Import from CVS: tag r20-3b15
cvs
parents: 153
diff changeset
942 ;;; internal-drag-and-drop ends here