unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* SVG widget in GNU Emacs
@ 2021-10-20  2:00 Anand Tamariya
  2021-10-20  3:15 ` Po Lu
  2021-10-20  8:15 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 34+ messages in thread
From: Anand Tamariya @ 2021-10-20  2:00 UTC (permalink / raw)
  To: Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 1858 bytes --]

Now you can use SVG widget in GNU Emacs. That is, use an SVG image or
fragment as background for push-button widget in Emacs buffer. You can also
specify the width and height of the widget for finer control. Generally
speaking, you can use any type of image for this purpose. But SVG suits
best because you can draw widget of any size without any distortion.

The ability to use SVG fragment means you can define multiple symbols in an
SVG and use the same as a sprite sheet for your UI requirements. Thus the
number of files to be managed is reduced.

Another use case would be better looking customize form. Or at the very
least, rounded "Save" and "Cancel" buttons. In other words, a more visually
appealing UI in graphical environments while maintaining the promise of
Emacs in terminal.

*Sample API: *svg-widget (svg frag &optional width height &rest args)

*Code:* https://gitlab.com/atamariya/emacs/-/blob/dev/lisp/svg.el
<https://www.blogger.com/#>

*Details:*
https://lifeofpenguin.blogspot.com/2021/10/svg-widget-in-gnu-emacs.html
*Patch*
modified   *lisp/wid-edit.el*
@@ -353,6 +353,7 @@ widget-specify-button
   "Specify button for WIDGET between FROM and TO."
   (let ((overlay (make-overlay from to nil t nil))
     (follow-link (widget-get widget :follow-link))
+    (display (widget-get widget :display))
     (help-echo (widget-get widget :help-echo)))
     (widget-put widget :button-overlay overlay)
     (if (functionp help-echo)
@@ -360,6 +361,7 @@ widget-specify-button
     (overlay-put overlay 'button widget)
     (overlay-put overlay 'keymap (widget-get widget :keymap))
     (overlay-put overlay 'evaporate t)
+    (overlay-put overlay 'display display)
     ;; We want to avoid the face with image buttons.
     (unless (widget-get widget :suppress-face)
       (overlay-put overlay 'face (widget-apply widget :button-face-get))

[-- Attachment #2: Type: text/html, Size: 2737 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2021-10-29 20:05 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-20  2:00 SVG widget in GNU Emacs Anand Tamariya
2021-10-20  3:15 ` Po Lu
2021-10-20 12:09   ` Eli Zaretskii
2021-10-20 12:48     ` Po Lu
2021-10-20 13:08       ` Eli Zaretskii
2021-10-20 13:17         ` Po Lu
2021-10-20 14:13           ` Eli Zaretskii
2021-10-26  6:32             ` Akira Kyle
2021-10-26 12:32               ` GUI and redisplay work (was: SVG widget in GNU Emacs) Stefan Monnier
2021-10-26 12:51                 ` Stefan Kangas
2021-10-26 13:23                   ` Eli Zaretskii
2021-10-26 13:19                 ` Eli Zaretskii
2021-10-27 16:07                 ` Alexandre Garreau
2021-10-27 17:12                   ` tomas
2021-10-27 19:00                     ` Alexandre Garreau
2021-10-29 17:34                       ` GUI and redisplay work Arthur Miller
2021-10-29 19:29                         ` Alexandre Garreau
2021-10-29 20:05                           ` Alexandre Garreau
2021-10-27  9:47               ` SVG widget in GNU Emacs Po Lu
2021-10-27 12:10                 ` Eli Zaretskii
2021-10-27 12:25                   ` Po Lu
2021-10-27 20:01                     ` Akira Kyle
2021-10-28  1:21                       ` Po Lu
2021-10-28 13:50                       ` Fix flickering on X11 xwidgets (was: Re: SVG widget in GNU Emacs) Po Lu
2021-10-27 19:49                 ` SVG widget in GNU Emacs Akira Kyle
2021-10-28  1:15                   ` Po Lu
2021-10-28  6:15                   ` Eli Zaretskii
2021-10-28  9:39                     ` Po Lu
2021-10-20 22:35   ` Richard Stallman
2021-10-20 23:37     ` dalanicolai
2021-10-21  0:31       ` dalanicolai
2021-10-21  0:07     ` Po Lu
2021-10-20  8:15 ` Lars Ingebrigtsen
2021-10-20  9:13   ` Anand Tamariya

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).