Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions TeXmacs/progs/kernel/gui/menu-widget.scm
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,24 @@
((== p '()) p)
(else (list (make-menu-bad-format p style))))))

(define (make-symbol-completion-widget sym col)
;; Renders a math symbol using the full TeXmacs typesetting engine
(let* ((math-content `(math ,sym))
(doc `(document
(with "color" ,col
"font-size" "5"
"page-type" "user"
"page-odd" "3px"
"page-even" "3px"
"page-top" "3px"
"page-bot" "3px"
,math-content)))
(style `(style (tuple "generic")))
(output-wid (widget-texmacs-output doc style)))
(widget-menu-button output-wid
(make-menu-command (insert sym))
"" "" 0)))

(define-table make-menu-items-table
(glue (:boolean? :boolean? :integer? :integer?)
,(lambda (p style bar?)
Expand All @@ -846,12 +864,12 @@
(list (make-menu-symbol p style '() (color symbol-color))))))
(symbol-completion (:string? :*)
,(lambda (p style bar?)
(let ((symbol-color (if (== (get-preference "gui theme") "liii-night") "white" "black")))
(list (make-menu-symbol p style '(roman mr medium normal 10 600 0) (color symbol-color))))))
(let ((symbol-color (if (== (get-preference "gui theme") "liii-night") "white" "black")))
(list (make-symbol-completion-widget (cadr p) symbol-color)))))
(symbol-completion* (:string? :*)
,(lambda (p style bar?)
(let ((symbol-color (if (== (get-preference "gui theme") "liii-night") "#ff6666" "red")))
(list (make-menu-symbol p style '(roman mr medium normal 10 600 -2) (color symbol-color))))))
(let ((symbol-color (if (== (get-preference "gui theme") "liii-night") "#ff6666" "red")))
(list (make-symbol-completion-widget (cadr p) symbol-color)))))
(texmacs-output (:%2)
,(lambda (p style bar?) (list (make-texmacs-output p style))))
(texmacs-input (:%3)
Expand Down
8 changes: 4 additions & 4 deletions src/Texmacs/Window/tm_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,16 @@ texmacs_output_widget (tree doc, tree style) {
// SI dw2= env->get_length (PAGE_SCREEN_RIGHT);
// SI dh1= env->get_length (PAGE_SCREEN_BOT);
// SI dh2= env->get_length (PAGE_SCREEN_TOP);
color col= env->get_color (BG_COLOR);
if (env->get_string (BG_COLOR) == "white" &&
is_transparent (extract (doc, "body")))
color col = env->get_color (BG_COLOR);
bool trans= is_transparent (extract (doc, "body"));
if (env->get_string (BG_COLOR) == "white" && trans)
#ifdef QTTEXMACS
col= rgb_color (236, 236, 236);
#else
col= light_grey;
#endif
double zoom= (retina_zoom == 2 ? 1.0 : 1.2);
return widget (tm_new<box_widget_rep> (b, col, false, zoom, 0, 0));
return widget (tm_new<box_widget_rep> (b, col, trans, zoom, 0, 0));
}

array<SI>
Expand Down