[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/sketch-mode 4d78311 18/38: Experimental object modify t
From: |
ELPA Syncer |
Subject: |
[elpa] externals/sketch-mode 4d78311 18/38: Experimental object modify tabulated list |
Date: |
Wed, 15 Sep 2021 16:57:36 -0400 (EDT) |
branch: externals/sketch-mode
commit 4d783114bfd66665ce54a0fa89cdd92230f9a61b
Author: Daniel Nicolai <dalanicolai@gmail.com>
Commit: Daniel Nicolai <dalanicolai@gmail.com>
Experimental object modify tabulated list
Tabulated list is probably not the way to go. See /vision/ page in the
github wiki.
---
sketch-scratch.el | 67 ++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 51 insertions(+), 16 deletions(-)
diff --git a/sketch-scratch.el b/sketch-scratch.el
index c9f60b2..7c52f85 100644
--- a/sketch-scratch.el
+++ b/sketch-scratch.el
@@ -6,21 +6,56 @@
;; (insert-image (svg-image (append svg-scratch (nthcdr 2 svg-labels))))
-(defun sketch-translate-node-coords (node amount &rest args)
- (dolist (coord args node)
- (cl-decf (alist-get coord (cadr node)) amount)))
+(defun sketch-modify-line-entry (node)
+ (let* ((props (copy-alist (cadr node)))
+ (id (alist-get 'id props)))
+ (assq-delete-all 'id props)
+ (vconcat [("id" 4 t)]
+ (map 'vector (lambda (prop)
+ ;; (let* ((key (car prop))
+ ;; (val (cdr prop))
+ ;; (length (when (stringp val)
+ ;; (length val))))
+ (list (symbol-name (car prop))
+ (pcase (car prop)
+ ((or 'x1 'y1 'x2 'y2) 5)
+ ('marker-end 7)
+ ('fill 18)
+ ('stroke 18)
+ (_ 10))
+ t))
+ props))))
-(defun svg-translate (dx dy)
+(define-derived-mode sketch-modify-mode tabulated-list-mode "sketch-modify"
+ (setq tabulated-list-format (sketch-modify-line-entry (car (dom-by-id svg
"^a$"))))
+ (let* ((props (copy-alist (cadar (dom-by-id svg "^a$"))))
+ (id (alist-get 'id props)))
+ (assq-delete-all 'id props)
+ (setq tabulated-list-entries(list
+ (list
+ nil
+ (vconcat (vector id)
+ (map 'vector (lambda (prop) (let
((val (cdr prop)))
+ (if
(stringp val)
+
val
+
(number-to-string val))))
+ props)))))
+ (tabulated-list-print)))
+
+(defun sketch-translate-down ()
(interactive)
- (mapcar (lambda (node)
- (pcase (car node)
- ('line (sketch-translate-node-coords node dx 'x1 'x2)
- (sketch-translate-node-coords node dx 'y1 'y2))
- ('rect (sketch-translate-node-coords node dx 'x)
- (sketch-translate-node-coords node dx 'y))
- ((or 'circle 'ellipse)
- (sketch-translate-node-coords node dx 'cx)
- (sketch-translate-node-coords node dx 'cy))
- ('text (sketch-translate-node-coords node dx 'x)
- (sketch-translate-node-coords node dx 'y))))
- (cddr svg-sketch)))
+ (let* ((props (cadar (dom-by-id svg "^a$"))))
+ (dolist (coord '(y1 y2))
+ (cl-incf (alist-get coord props) 10)))
+ (sketch-redraw))
+
+(transient-define-prefix sketch-modify-object ()
+ "Set object properties."
+ :transient-suffix 'transient--do-call
+ ["Properties"
+ [("x1" "author" "author=")
+ ("y" "year" "year=")]]
+ [("<down>" "Down" sketch-translate-down)
+ ("q" "Quit" transient-quit-one)])
+ ;; (interactive)
+ ;; (djvu-switch-shared))
- [elpa] externals/sketch-mode 96ce92b 02/38: First sketch of sketch-mode, (continued)
- [elpa] externals/sketch-mode 96ce92b 02/38: First sketch of sketch-mode, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode d3b1831 14/38: Move transient quit for more sketch space, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode a715b8a 12/38: Reformat/compactify transient, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode 35255d0 04/38: Implement undo/redo and show/edit/(re)load definition, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode 56d7b5d 08/38: Create FUNDING.yml, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode da9e1d7 13/38: Implement help-echo showing coordinates, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode 32559c4 06/38: Add remove functionality (id's and labels), ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode 5c37145 09/38: Add sponsor button, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode b944693 10/38: Add crop image feature AND add text transient into main, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode f82ed74 11/38: Update documentation (add screencast), ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode 4d78311 18/38: Experimental object modify tabulated list,
ELPA Syncer <=
- [elpa] externals/sketch-mode d42f84a 22/38: Add svg and sketch group definitions, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode e3c16c7 26/38: Merge branch 'implement-layers' (incl. undo-tree undo/redo), ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode 951c284 28/38: Fix dot marker and rename (make internal) sketch-snap-to-grid, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode f0465ec 29/38: Remove sketch-interactive function, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode 4c6a675 36/38: Fix load definition functionality (also set layers list), ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode bcb99c9 35/38: Implement text label and modify feature, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode 49c3c04 34/38: Add dasharray feature, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode 4a4e2ba 33/38: Implement import/snippet functionality, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode 37af8f4 01/38: Initial commit, ELPA Syncer, 2021/09/15
- [elpa] externals/sketch-mode 0f870a1 20/38: Implement load from definition buffer & modify object functionality, ELPA Syncer, 2021/09/15