5 |
;; Author: Tomas Abrahamsson <tab@lysator.liu.se> |
;; Author: Tomas Abrahamsson <tab@lysator.liu.se> |
6 |
;; Maintainer: Tomas Abrahamsson <tab@lysator.liu.se> |
;; Maintainer: Tomas Abrahamsson <tab@lysator.liu.se> |
7 |
;; Keywords: mouse |
;; Keywords: mouse |
8 |
;; Version: 1.2.4 |
;; Version: 1.2.6 |
9 |
;; Release-date: 25-Oct-2001 |
;; Release-date: 6-Aug-2004 |
10 |
;; Location: http://www.lysator.liu.se/~tab/artist/ |
;; Location: http://www.lysator.liu.se/~tab/artist/ |
11 |
|
|
12 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
136 |
|
|
137 |
;;; ChangeLog: |
;;; ChangeLog: |
138 |
|
|
139 |
|
;; 1.2.6 6-Aug-2004 |
140 |
|
;; New: Coerced with the artist.el that's in Emacs-21.3. |
141 |
|
;; (minor editorial changes) |
142 |
|
;; |
143 |
|
;; 1.2.5 4-Aug-2004 |
144 |
|
;; New: Added tool selection via the mouse-wheel |
145 |
|
;; Function provided by Andreas Leue <al@sphenon.de> |
146 |
|
;; |
147 |
;; 1.2.4 25-Oct-2001 |
;; 1.2.4 25-Oct-2001 |
148 |
;; Bugfix: Some operations (the edit menu) got hidden |
;; Bugfix: Some operations (the edit menu) got hidden |
149 |
;; Bugfix: The first arrow for poly-lines was always pointing |
;; Bugfix: The first arrow for poly-lines was always pointing |
195 |
|
|
196 |
;; Variables |
;; Variables |
197 |
|
|
198 |
(defconst artist-version "1.2.4") |
(defconst artist-version "1.2.6") |
199 |
(defconst artist-maintainer-address "tab@lysator.liu.se") |
(defconst artist-maintainer-address "tab@lysator.liu.se") |
200 |
|
|
201 |
|
|
479 |
The fill char is used instead, if it is set.") |
The fill char is used instead, if it is set.") |
480 |
(make-variable-buffer-local 'artist-borderless-shapes) |
(make-variable-buffer-local 'artist-borderless-shapes) |
481 |
|
|
482 |
|
(defvar artist-prev-next-op-alist nil |
483 |
|
"Assoc list for looking up next and/or previous draw operation. |
484 |
|
The structure is as follows: (OP . (PREV-OP . NEXT-OP)) |
485 |
|
where the elements are as follows: |
486 |
|
* OP is an atom: the KEY-SYMBOL in the `artist-mt' structure |
487 |
|
* PREV-OP and NEXT-OP are strings: the KEYWORD in the `artist-mt' structure |
488 |
|
|
489 |
|
This variable is initialized by the artist-make-prev-next-op-alist function.") |
490 |
|
|
491 |
(eval-when-compile |
(eval-when-compile |
492 |
;; Make rect available at compile-time |
;; Make rect available at compile-time |
512 |
(define-key map [S-down-mouse-2] 'artist-mouse-choose-operation) |
(define-key map [S-down-mouse-2] 'artist-mouse-choose-operation) |
513 |
(define-key map [down-mouse-3] 'artist-down-mouse-3) |
(define-key map [down-mouse-3] 'artist-down-mouse-3) |
514 |
(define-key map [S-down-mouse-3] 'artist-down-mouse-3) |
(define-key map [S-down-mouse-3] 'artist-down-mouse-3) |
515 |
|
(define-key map [C-mouse-4] 'artist-select-prev-op-in-list) |
516 |
|
(define-key map [C-mouse-5] 'artist-select-next-op-in-list) |
517 |
(define-key map "\r" 'artist-key-set-point) ; return |
(define-key map "\r" 'artist-key-set-point) ; return |
518 |
(define-key map [up] 'artist-previous-line) |
(define-key map [up] 'artist-previous-line) |
519 |
(define-key map "\C-p" 'artist-previous-line) |
(define-key map "\C-p" 'artist-previous-line) |
1081 |
"Retrieve the items component from a graphics operation INFO-PART." |
"Retrieve the items component from a graphics operation INFO-PART." |
1082 |
(elt info-part 1)) |
(elt info-part 1)) |
1083 |
|
|
1084 |
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1085 |
|
;; mouse wheel cyclic operation selection |
1086 |
|
|
1087 |
|
(defun artist-get-last-non-nil-op (op-list &optional last-non-nil) |
1088 |
|
"Find the last non-nil draw operation in OP-LIST. |
1089 |
|
Optional LAST-NON-NIL will be returned if OP-LIST is nil." |
1090 |
|
(if op-list |
1091 |
|
(artist-get-last-non-nil-op (cdr op-list) |
1092 |
|
(or (car (car op-list)) last-non-nil)) |
1093 |
|
last-non-nil)) |
1094 |
|
|
1095 |
|
(defun artist-get-first-non-nil-op (op-list) |
1096 |
|
"Find the first non-nil draw operation in OP-LIST." |
1097 |
|
(or (car (car op-list)) (artist-get-first-non-nil-op (cdr op-list)))) |
1098 |
|
|
1099 |
|
(defun artist-is-in-op-list-p (op op-list) |
1100 |
|
"Check whether OP is in OP-LIST." |
1101 |
|
(and op-list |
1102 |
|
(or (and (car (car op-list)) (string= op (car (car op-list)))) |
1103 |
|
(artist-is-in-op-list-p op (cdr op-list))))) |
1104 |
|
|
1105 |
|
(defun artist-make-prev-next-op-alist (op-list |
1106 |
|
&optional |
1107 |
|
last-non-nil-arg first-non-nil-arg |
1108 |
|
prev-entry prev-op-arg) |
1109 |
|
"Build an assoc-list of OP-LIST. |
1110 |
|
The arguments LAST-NON-NIL-ARG, FIRST-NON-NIL-ARG, PREV-ENTRY and |
1111 |
|
PREV-OP-ARG are used when invoked recursively during the build-up." |
1112 |
|
(let* ((last-non-nil (or last-non-nil-arg |
1113 |
|
(artist-get-last-non-nil-op |
1114 |
|
artist-key-compl-table))) |
1115 |
|
(first-non-nil (or first-non-nil-arg |
1116 |
|
(artist-get-first-non-nil-op |
1117 |
|
artist-key-compl-table))) |
1118 |
|
(prev-op (or prev-op-arg last-non-nil)) |
1119 |
|
(op (car (car op-list))) |
1120 |
|
(opsym (artist-mt-get-symbol-from-keyword op)) |
1121 |
|
(entry (cons opsym (cons prev-op nil)))) |
1122 |
|
(if (or (and op-list (not op)) |
1123 |
|
(artist-is-in-op-list-p op (cdr op-list))) |
1124 |
|
(artist-make-prev-next-op-alist (cdr op-list) |
1125 |
|
last-non-nil first-non-nil |
1126 |
|
prev-entry prev-op) |
1127 |
|
(if prev-entry (setcdr (cdr prev-entry) op)) |
1128 |
|
(if op-list |
1129 |
|
(cons entry (artist-make-prev-next-op-alist |
1130 |
|
(cdr op-list) |
1131 |
|
last-non-nil first-non-nil |
1132 |
|
entry op)) |
1133 |
|
(progn (setcdr (cdr prev-entry) first-non-nil) nil))))) |
1134 |
|
|
1135 |
|
(defun artist-select-next-op-in-list () |
1136 |
|
"Cyclically select next drawing mode operation." |
1137 |
|
(interactive) |
1138 |
|
(let ((next-op (cdr (cdr (assoc artist-curr-go artist-prev-next-op-alist))))) |
1139 |
|
(artist-select-operation next-op) |
1140 |
|
(message next-op))) |
1141 |
|
|
1142 |
|
(defun artist-select-prev-op-in-list () |
1143 |
|
"Cyclically select previous drawing mode operation." |
1144 |
|
(interactive) |
1145 |
|
(let ((prev-op (car (cdr (assoc artist-curr-go artist-prev-next-op-alist))))) |
1146 |
|
(artist-select-operation prev-op) |
1147 |
|
(message prev-op))) |
1148 |
|
|
1149 |
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1150 |
|
|
1151 |
;;; --------------------------------- |
;;; --------------------------------- |
1152 |
;;; The artist-mode |
;;; The artist-mode |
1153 |
;;; --------------------------------- |
;;; --------------------------------- |
1402 |
(make-local-variable 'artist-key-draw-how) |
(make-local-variable 'artist-key-draw-how) |
1403 |
(make-local-variable 'artist-popup-menu-table) |
(make-local-variable 'artist-popup-menu-table) |
1404 |
(make-local-variable 'artist-key-compl-table) |
(make-local-variable 'artist-key-compl-table) |
1405 |
|
(make-local-variable 'artist-prev-next-op-alist) |
1406 |
(make-local-variable 'artist-rb-save-data) |
(make-local-variable 'artist-rb-save-data) |
1407 |
(make-local-variable 'artist-arrow-point-1) |
(make-local-variable 'artist-arrow-point-1) |
1408 |
(make-local-variable 'artist-arrow-point-2) |
(make-local-variable 'artist-arrow-point-2) |
1412 |
(setq artist-key-shape nil) |
(setq artist-key-shape nil) |
1413 |
(setq artist-popup-menu-table (artist-compute-popup-menu-table artist-mt)) |
(setq artist-popup-menu-table (artist-compute-popup-menu-table artist-mt)) |
1414 |
(setq artist-key-compl-table (artist-compute-key-compl-table artist-mt)) |
(setq artist-key-compl-table (artist-compute-key-compl-table artist-mt)) |
1415 |
|
(setq artist-prev-next-op-alist |
1416 |
|
(artist-make-prev-next-op-alist artist-key-compl-table)) |
1417 |
(setq artist-rb-save-data (make-vector 7 0)) |
(setq artist-rb-save-data (make-vector 7 0)) |
1418 |
(setq artist-arrow-point-1 nil) |
(setq artist-arrow-point-1 nil) |
1419 |
(setq artist-arrow-point-2 nil) |
(setq artist-arrow-point-2 nil) |