comparison lisp/prim/frame.el @ 197:acd284d43ca1 r20-3b25

Import from CVS: tag r20-3b25
author cvs
date Mon, 13 Aug 2007 10:00:02 +0200
parents e121b013d1f0
children 169c0442b401
comparison
equal deleted inserted replaced
196:58e0786448ca 197:acd284d43ca1
815 (add-hook 'select-frame-hook 'default-select-frame-hook)) 815 (add-hook 'select-frame-hook 'default-select-frame-hook))
816 816
817 (or deselect-frame-hook 817 (or deselect-frame-hook
818 (add-hook 'deselect-frame-hook 'default-deselect-frame-hook)) 818 (add-hook 'deselect-frame-hook 'default-deselect-frame-hook))
819 819
820 (defun default-drag-and-drop-functions (frame filepath &optional data type) 820 (defun default-drag-and-drop-functions (frame filepath &optional data)
821 "Implements the `drag-and-drop-functions' variable. 821 "Implements the `drag-and-drop-functions' variable.
822 For use as the value of `drag-and-drop-functions'. 822 For use as the value of `drag-and-drop-functions'.
823 A file is popped up in a new buffer, some data without 823 A file is popped up in a new buffer, some data without
824 is inserted at point, and data with a type is handled 824 is inserted at point."
825 for it's type (NOTE: type is only set for OffiX DnD)." 825 ;; changed this back -- hope it works for CDE ;-) Oliver Graf <ograf@fga.de>
826 (cond (type 826 ;; the OffiX drop stuff has moved to mouse.el (mouse-offix-drop)
827 (cond ((or (< type 2) (> type 9)) ;; this is raw data or unknown stuff 827 (if (data)
828 (let ((buf (generate-new-buffer "DndRawData"))) 828 (insert data)
829 (set-buffer buf) 829 (let ((x pop-up-windows))
830 (pop-to-buffer buf nil frame) 830 (setq pop-up-windows nil)
831 (insert data) 831 (pop-to-buffer (find-file-noselect filepath) nil frame)
832 (hexlify-buffer) 832 (make-frame-visible frame)
833 (make-frame-visible frame))) 833 (setq pop-up-windows x))))
834 ((= type 5) (dired data))
835 ((= type 8) (funcall browse-url-browser-function data))
836 ((= type 9)
837 (let ((buf (generate-new-buffer "DndMIME")))
838 (set-buffer buf)
839 (pop-to-buffer buf nil frame)
840 (insert data)
841 (make-frame-visible frame)))
842 (t (ding))))
843 (data (insert data))
844 (t
845 (let ((x pop-up-windows))
846 (setq pop-up-windows nil)
847 (pop-to-buffer (find-file-noselect filepath) nil frame)
848 (make-frame-visible frame)
849 (setq pop-up-windows x)))))
850 834
851 (and (boundp 'drag-and-drop-functions) 835 (and (boundp 'drag-and-drop-functions)
852 (or drag-and-drop-functions 836 (or drag-and-drop-functions
853 (add-hook 'drag-and-drop-functions 'default-drag-and-drop-functions))) 837 (add-hook 'drag-and-drop-functions 'default-drag-and-drop-functions)))
854 838
861 ;; in the following roundabout way: 845 ;; in the following roundabout way:
862 (funcall (intern "cde-start-drag-internal") 846 (funcall (intern "cde-start-drag-internal")
863 (buffer-substring-no-properties begin end)) 847 (buffer-substring-no-properties begin end))
864 (error "CDE functionality not compiled in."))) 848 (error "CDE functionality not compiled in.")))
865 849
850 ;; the OffiX drag stuff will soon move also (perhaps mouse.el)
851 ;; if the drag event is done
866 (defun offix-start-drag (event data &optional type) 852 (defun offix-start-drag (event data &optional type)
867 "Implements the OffiX drag operation. 853 "Implements the OffiX drag operation.
868 Calls the internal function offix-start-drag-internal to do the actual work. 854 Calls the internal function offix-start-drag-internal to do the actual work.
869 If type is not given, DndText is assumed." 855 If type is not given, DndText is assumed."
856 ;; Oliver Graf <ograf@fga.de>
870 (interactive "esi") 857 (interactive "esi")
871 (if (featurep 'offix) 858 (if (featurep 'offix)
872 (funcall (intern "offix-start-drag-internal") event data type) 859 (funcall (intern "offix-start-drag-internal") event data type)
873 (error "OffiX functionality not compiled in."))) 860 (error "OffiX functionality not compiled in.")))
874 861
875 (defun offix-start-drag-region (event begin end) 862 (defun offix-start-drag-region (event begin end)
876 "Implements the OffiX drag operation for a region. 863 "Implements the OffiX drag operation for a region.
877 Calls the internal function offix-start-drag-internal to do the actual work. 864 Calls the internal function offix-start-drag-internal to do the actual work.
878 This always assumes DndText as type." 865 This always assumes DndText as type."
866 ;; Oliver Graf <ograf@fga.de>
879 (interactive "_er") 867 (interactive "_er")
880 (if (featurep 'offix) 868 (if (featurep 'offix)
881 (funcall (intern "offix-start-drag-internal") 869 (funcall (intern "offix-start-drag-internal")
882 event (buffer-substring-no-properties begin end)) 870 event (buffer-substring-no-properties begin end))
883 (error "OffiX functionality not compiled in."))) 871 (error "OffiX functionality not compiled in.")))