TeXmacs/Mogan Note 3
修改为两点画圆
研究三点画圆的代码实现
菜单中选择画圆的时候使用
1("Circle" (graphics-set-mode '(edit carc)))
但是edit carc没有继续出现。因此推测是得到mode之后判断,如果第一个值是edit则统一处理,不需要分别处理。
以
1(tm-define (edit_right-button mode x y)
2 (:require (== mode 'edit))
3 (:state graphics-state)
4 (set-texmacs-pointer 'graphics-cross)
5 (when current-obj
6 (graphics-delete)))
为例子。
它在这里被调用
1(tm-define (graphics-release-right x y)
2 ;;(display* "Graphics] Release-right " x ", " y "\n")
3 (when (not (inside-graphical-text?))
4 (edit_right-button (car (graphics-mode)) x y)))
可以看到确实是按照(car (graphics-mode))
来进行调用。
研究如何通过菜单进行markup中的两点画圆
1(menu-bind graphics-focus-menu
2 (-> (eval (upcase-first (gr-mode->string (graphics-mode))))
3 (link graphics-mode-menu))
4 (if (inside-graphical-over-under?)
5 ("Exit graphics" (graphics-exit-right)))
6 (assuming (nnot (tree-innermost overlays-context?))
7 (link graphics-focus-overlays-menu))
8 (assuming (nnull? (graphics-mode-attributes (graphics-mode)))
9 ---
10 (assuming (graphics-mode-attribute? (graphics-mode) "color")
11 (-> "Color" (link graphics-color-menu)))
12 (assuming (graphics-mode-attribute? (graphics-mode) "fill-color")
13 (-> "Fill color" (link graphics-fill-color-menu)))
14 (assuming (graphics-mode-attribute? (graphics-mode) "opacity")
15 (assuming (== (get-preference "experimental alpha") "on")
16 (-> "Opacity" (link graphics-opacity-menu))))
17 (assuming (graphics-mode-attribute? (graphics-mode) "pen-enhance")
18 (-> "Enhance" (link graphics-pen-enhance-menu)))
这是焦点工具栏,在菜单中的版本。
1(tm-menu (graphics-property-icons)
这个是图形界面中的第三栏。除了属性卡之外的选项们。
1(tm-menu (graphics-icons)
2 (link graphics-global-icons)
3 /
4 (link graphics-insert-icons)
5 /
6 (link graphics-group-icons))
7
8(tm-menu (graphics-focus-icons)
9 (mini #t
10 (=> (balloon (eval (upcase-first (gr-mode->string (graphics-mode))))
11 "Current graphical mode")
12 (link graphics-mode-menu)))
13 (assuming (nnot (tree-innermost overlays-context?))
14 (link graphics-focus-overlays-icons))
15 (assuming (nnull? (graphics-mode-attributes (graphics-mode)))
16 (link graphics-property-icons))
17 (assuming (graphics-get-anim-type)
18 /
19 (mini #t
20 (group "Status:")
21 (=> (eval (graphics-get-anim-type))
22 (link graphics-anim-type-menu))))
23 /
24 (link graphics-snap-icons))
这是整体。
则事实上要找的含有markup选项的菜单为
1(menu-bind graphics-mode-menu
2 ("Point" (graphics-set-mode '(edit point)))
3 ("Line" (graphics-set-mode '(edit line)))
4 ("Polygon" (graphics-set-mode '(edit cline)))
5 (-> "Curve"
其中含有插件的为
1(assuming (style-has? "std-markup-dtd")
2 (with u '(arrow-with-text arrow-with-text*)
3 (with l (list-filter u (lambda (s) (style-has? (symbol->string s))))
4 (for (tag (sort l symbol<=?))
5 ((eval (upcase-first (symbol->string tag)))
6 (import-from (graphics graphics-markup))
7 (graphics-set-mode `(edit ,tag))))))
8 (with u (list-difference gr-tags-user '(arrow-with-text arrow-with-text*))
9 (with l (list-filter u (lambda (s) (style-has? (symbol->string s))))
10 (assuming (nnull? l)
11 ---
12 (for (tag (sort l symbol<=?))
13 ((eval (upcase-first (symbol->string tag)))
14 (import-from (graphics graphics-markup))
15 (graphics-set-mode `(edit ,tag))))))))