[latex3-commits] [git/LaTeX3-latex3-pdfresources] radiobuttons: working on pushbutton appearacne (abeda76)

Ulrike Fischer fischer at troubleshooting-tex.de
Sat May 29 23:22:41 CEST 2021


Repository : https://github.com/latex3/pdfresources
On branch  : radiobuttons
Link       : https://github.com/latex3/pdfresources/commit/abeda7691a3d5dff2540a3fa5edf2a3cecc07b24

>---------------------------------------------------------------

commit abeda7691a3d5dff2540a3fa5edf2a3cecc07b24
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sat May 29 23:22:41 2021 +0200

    working on pushbutton appearacne


>---------------------------------------------------------------

abeda7691a3d5dff2540a3fa5edf2a3cecc07b24
 experiments/pushbutton-appearance.tex | 99 +++++++++++++++++++++++++++++++++++
 l3pdffield-pushbutton.dtx             | 27 ++++------
 2 files changed, 108 insertions(+), 18 deletions(-)

diff --git a/experiments/pushbutton-appearance.tex b/experiments/pushbutton-appearance.tex
new file mode 100644
index 0000000..09a945b
--- /dev/null
+++ b/experiments/pushbutton-appearance.tex
@@ -0,0 +1,99 @@
+\documentclass[]{article}
+\usepackage{l3draw}
+\begin{document}
+abc
+\ExplSyntaxOn
+
+\dim_new:N\l_my_ht_dim
+\dim_set:Nn\l_my_ht_dim {1.3\baselineskip}
+\dim_new:N\l_my_wd_dim
+\dim_set:Nn\l_my_wd_dim {2cm}
+\dim_new:N\l_my_linewidth_dim
+\dim_set:Nn\l_my_linewidth_dim {0.6pt}
+\color_set:nn {normalcolor}{.}
+\color_set:nn {border}{black!95!white}
+\color_set:nn {bordertop}{yellow!5!white}
+\color_set:nn {borderbot}{black!50!white}
+\color_set:nn {fill}{black!20!white}
+
+         \draw_begin:
+         \draw_linewidth:n {\l_my_linewidth_dim}
+         \draw_path_rectangle_corners:nn
+            {0.5\l_my_linewidth_dim,0.5\l_my_linewidth_dim}
+            {\l_my_wd_dim-0.5\l_my_linewidth_dim,\l_my_ht_dim-0.5\l_my_linewidth_dim}
+         \color_fill:n {border}
+         \draw_path_use_clear:n { fill }
+         \draw_path_rectangle_corners:nn
+            {2\l_my_linewidth_dim,2\l_my_linewidth_dim}
+            {\l_my_wd_dim-2\l_my_linewidth_dim,\l_my_ht_dim-2\l_my_linewidth_dim}
+         \color_fill:n {bordertop}
+         \draw_path_use_clear:n { fill }
+         \draw_path_moveto:n {2\l_my_linewidth_dim,2\l_my_linewidth_dim}
+         \draw_path_lineto:n
+           {5\l_my_linewidth_dim,5\l_my_linewidth_dim}
+         \draw_path_lineto:n
+           {\l_my_wd_dim-5\l_my_linewidth_dim,\l_my_ht_dim-5\l_my_linewidth_dim}
+         \draw_path_lineto:n
+           {\l_my_wd_dim-2\l_my_linewidth_dim,\l_my_ht_dim-2\l_my_linewidth_dim}
+         \draw_path_lineto:n {\l_my_wd_dim-2\l_my_linewidth_dim,2\l_my_linewidth_dim}
+         \draw_path_close:
+         \color_fill:n {borderbot}
+         \draw_path_use_clear:n { fill }
+         \draw_path_rectangle_corners:nn
+           {1.5\l_my_linewidth_dim,1.5\l_my_linewidth_dim}
+           {\l_my_wd_dim-1.5\l_my_linewidth_dim,\l_my_ht_dim-1.5\l_my_linewidth_dim}
+         \color_stroke:n {border}
+         \draw_path_use_clear:n { stroke }
+         \draw_path_rectangle_corners:nn
+           {4\l_my_linewidth_dim,4\l_my_linewidth_dim}
+           {\l_my_wd_dim-4\l_my_linewidth_dim,\l_my_ht_dim-4\l_my_linewidth_dim}
+           \color_fill:n {fill}
+          \draw_path_use_clear:n { fill }
+          \color_fill:n {normalcolor}
+          \draw_transform_shift:n {0.5 \l_my_wd_dim, 0.3\l_my_ht_dim}
+          \hbox_set:Nn \l_tmpa_box { \makebox[0pt]{\sffamily\bfseries Reset} }
+          \draw_box_use:N \l_tmpa_box
+         \draw_end:
+
+         \draw_begin:
+         \draw_linewidth:n {\l_my_linewidth_dim}
+         \draw_path_rectangle_corners:nn
+            {0.5\l_my_linewidth_dim,0.5\l_my_linewidth_dim}
+            {\l_my_wd_dim-0.5\l_my_linewidth_dim,\l_my_ht_dim-0.5\l_my_linewidth_dim}
+         \color_fill:n {border}
+         \draw_path_use_clear:n { fill }
+         \draw_path_rectangle_corners:nn
+            {2\l_my_linewidth_dim,2\l_my_linewidth_dim}
+            {\l_my_wd_dim-2\l_my_linewidth_dim,\l_my_ht_dim-2\l_my_linewidth_dim}
+         \color_fill:n {borderbot}
+         \draw_path_use_clear:n { fill }
+         \draw_path_moveto:n {2\l_my_linewidth_dim,2\l_my_linewidth_dim}
+         \draw_path_lineto:n
+           {5\l_my_linewidth_dim,5\l_my_linewidth_dim}
+         \draw_path_lineto:n
+           {\l_my_wd_dim-5\l_my_linewidth_dim,\l_my_ht_dim-5\l_my_linewidth_dim}
+         \draw_path_lineto:n
+           {\l_my_wd_dim-2\l_my_linewidth_dim,\l_my_ht_dim-2\l_my_linewidth_dim}
+         \draw_path_lineto:n {\l_my_wd_dim-2\l_my_linewidth_dim,2\l_my_linewidth_dim}
+         \draw_path_close:
+         \color_fill:n {bordertop}
+         \draw_path_use_clear:n { fill }
+         \draw_path_rectangle_corners:nn
+           {1.5\l_my_linewidth_dim,1.5\l_my_linewidth_dim}
+           {\l_my_wd_dim-1.5\l_my_linewidth_dim,\l_my_ht_dim-1.5\l_my_linewidth_dim}
+         \color_stroke:n {border}
+         \draw_path_use_clear:n { stroke }
+         \draw_path_rectangle_corners:nn
+           {4\l_my_linewidth_dim,4\l_my_linewidth_dim}
+           {\l_my_wd_dim-4\l_my_linewidth_dim,\l_my_ht_dim-4\l_my_linewidth_dim}
+           \color_fill:n {fill}
+          \draw_path_use_clear:n { fill }
+          \color_fill:n {normalcolor}
+          \draw_transform_shift:n {0.5 \l_my_wd_dim, 0.3\l_my_ht_dim}
+          \hbox_set:Nn \l_tmpa_box { \makebox[0pt]{\sffamily\bfseries XXXX} }
+          \draw_box_use:N \l_tmpa_box
+
+         \draw_end:
+\ExplSyntaxOff
+
+\end{document}
\ No newline at end of file
diff --git a/l3pdffield-pushbutton.dtx b/l3pdffield-pushbutton.dtx
index b504c87..79fa90a 100644
--- a/l3pdffield-pushbutton.dtx
+++ b/l3pdffield-pushbutton.dtx
@@ -375,32 +375,21 @@
 %  use of a pushbutton, and will adapt to the font family in use then.
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_pushbutton_default_appearances:n #1 % text
-  {
+  { \dim_show:N\l_@@_annot_wd_dim \dim_show:N\l_@@_annot_ht_dim
      \pdffield_appearance:nn {pdffield/pushbutton/defaultN}
        {
-         \normalsize
-         \fboxsep 0pt
-         \framebox
-           [ \dim_eval:n { \box_ht:N\strutbox+\box_dp:N\strutbox } ]
-           { \texttimes \strut }
+         { \color_select:n{black!5!white}\rule{3cm}{0.5cm}
+           \llap{\makebox[3cm]{\color_select:n{black}PUSH}}}
        }
       \pdffield_appearance:nn {pdffield/pushbutton/defaultR}
        {
-         \normalsize
-         \fboxsep 0pt
-         \framebox
-           [ \dim_eval:n { \box_ht:N\strutbox+\box_dp:N\strutbox } ]
-           { \phantom{\texttimes} \strut }
+         { \color_select:n{yellow!50!white}\rule{\paperwidth}{\paperheight} }
        }
-    \pdffield_appearance:nn {pdffield/pushbutton/defaultD}
+     \pdffield_appearance:nn {pdffield/pushbutton/defaultD}
        {
-         \normalsize
-         \fboxsep 0pt
-         \framebox
-           [ \dim_eval:n { \box_ht:N\strutbox+\box_dp:N\strutbox } ]
-           { \phantom{\texttimes} \strut }
+         { \color_select:n{blue}\rule{\paperwidth}{\paperheight} }
        }
-
+     \cs_gset_eq:NN \@@_pushbutton_default_appearances:n  \prg_do_nothing:
   }
 %    \end{macrocode}
 % \end{macro}
@@ -439,6 +428,8 @@
         fieldID=,
         name=pushbutton,
         appearance = pdffield/pushbutton/defaultN,
+        down-appearance = pdffield/pushbutton/defaultD,
+        rollover-appearance = pdffield/pushbutton/defaultR,
         width  = 3cm,
         height = \normalbaselineskip,
       }





More information about the latex3-commits mailing list.