From 9f3d1e77738725801aee61ef8a4c429605342be1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Tue, 5 May 2015 01:33:11 +0200 Subject: [PATCH] pdfform.module: unset a PassTru - this makes real life much easier since it saves more TeX code than with passThru - adapt the example file accordingly --- lib/examples/PDF-form.lyx | 635 +++++++++++++++++++++++++++---------- lib/layouts/pdfform.module | 21 +- 2 files changed, 476 insertions(+), 180 deletions(-) diff --git a/lib/examples/PDF-form.lyx b/lib/examples/PDF-form.lyx index 5e6d77d00f..f26419e6ba 100644 --- a/lib/examples/PDF-form.lyx +++ b/lib/examples/PDF-form.lyx @@ -390,7 +390,6 @@ Insets status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -435,7 +434,8 @@ status open \series bold Note: \series default - All braces and brackets in form parameters must be inserted as TeX code! + All braces, brackets, backslashes and quote characters in form parameters + must be inserted as TeX code! \end_layout \end_inset @@ -465,7 +465,6 @@ fields as example: Fill one and see that the other one will also be filled status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -489,7 +488,6 @@ name=identic status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -533,14 +531,46 @@ cm height and a proposed content: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout name=customer2, multiline, width=0.6 +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + \backslash -textwidth, height=3cm, value={Testman} +textwidth +\end_layout + +\end_inset + +, height=3cm, value= +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +{ +\end_layout + +\end_inset + +Testman +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +} +\end_layout + +\end_inset + + \end_layout \end_inset @@ -603,7 +633,6 @@ CheckBox status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -711,7 +740,6 @@ Here is an example for the radio type: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -753,7 +781,6 @@ Here is an example for the combo type: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -795,7 +822,6 @@ Here is an example for the popdown type: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -899,7 +925,6 @@ default=m status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -974,7 +999,6 @@ PushButton status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1007,72 +1031,83 @@ onclick={} status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -onclick={app.alert("What the hell? Now you destroyed your fridge. - Congratulations.")} +onclick= +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +{ \end_layout \end_inset -Don't click on this button or your fridge will be destroyed!!! +app.alert( +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +" \end_layout \end_inset +What the hell? Now you destroyed your fridge. + Congratulations. +\begin_inset ERT +status collapsed -\end_layout +\begin_layout Plain Layout -\begin_layout Standard -For info about JavaScript, see its documentation, -\begin_inset CommandInset citation -LatexCommand cite -key "JavaScript" +" +\end_layout \end_inset -. +) +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +} \end_layout -\begin_layout Standard -A common usage for pus buttons is to open a weblink. - Such a button is created by inserting the command -\series bold +\end_inset -\backslash -href -\series default - into the button inset. - -\series bold -\backslash -href -\series default - is used in the scheme -\begin_inset Newline newline +\end_layout + \end_inset +Don't click on this button or your fridge will be destroyed!!! +\end_layout + +\end_inset -\series bold -\backslash -href{link target}{text} \end_layout \begin_layout Standard -In the following button this code was used: -\begin_inset Newline newline -\end_inset +For info about JavaScript, see its documentation, +\begin_inset CommandInset citation +LatexCommand cite +key "JavaScript" +\end_inset -\series bold +. +\end_layout -\backslash -href{http://wiki.lyx.org}{Information how to fill out this form} +\begin_layout Standard +A common usage for pus buttons is to open a weblink. + Such a button is created by inserting a hyperlink into the button inset. + Here is an example: \end_layout \begin_layout Standard @@ -1080,7 +1115,6 @@ href{http://wiki.lyx.org}{Information how to fill out this form} status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1091,8 +1125,14 @@ status open \end_inset -\backslash -href{http://wiki.lyx.org}{Information how to fill out this form} +\begin_inset CommandInset href +LatexCommand href +name "Information how to fill out this form" +target "http://wiki.lyx.org" + +\end_inset + + \end_layout \end_inset @@ -1151,7 +1191,6 @@ SubmitButton status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1253,7 +1292,6 @@ ResetButton status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1518,7 +1556,6 @@ characters to insert: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1605,7 +1642,6 @@ ding{55}: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1670,7 +1706,6 @@ Combo box with dashed, colored border: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1716,7 +1751,6 @@ entries are shown and where the last entry is preselected: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1795,7 +1829,6 @@ Radio box with inverted bevel border and symbol number status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1837,21 +1870,88 @@ Push button with a bevel border and colored text: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -onclick={app.alert("Why do you click this?")} +onclick= +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +{ \end_layout \end_inset +app.alert( +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +" +\end_layout + +\end_inset + +Why do you click this? +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +" +\end_layout + +\end_inset + +) +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +} +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + \backslash colorbox{lime}{ -\backslash -textcolor{red}{Don't click on this button!!!}} +\end_layout + +\end_inset + + +\color red +Don't click on this button!!! +\color inherit + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +} +\end_layout + +\end_inset + + \end_layout \end_inset @@ -1911,23 +2011,7 @@ Colored Boxes \emph on EmbeddedObjects \emph default - manual and -\series bold - -\backslash -textcolor -\series default - that is used is used in the scheme -\begin_inset Newline newline -\end_inset - - -\series bold - -\backslash -textcolor{color}{characters to color} -\series default - + manual. \begin_inset Newline newline \end_inset @@ -1939,9 +2023,13 @@ In the button above this code was used: \family sans \backslash -colorbox{lime}{ -\backslash -textcolor{red}{Don't click on this button!!!}} +colorbox{lime}{Don't click on this button!!!} +\family default + +\begin_inset Newline newline +\end_inset + +and the button text was colored. \end_layout \begin_layout Standard @@ -1998,7 +2086,6 @@ Submit button without border, with cyan background color and increased height: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2009,14 +2096,62 @@ name=submit2 \end_inset +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + \backslash colorbox{cyan}{ +\end_layout + +\end_inset + + +\begin_inset Box Frameless +position "c" +hor_pos "c" +has_inner_box 1 +inner_pos "c" +use_parbox 1 +use_makebox 0 +width "5cm" +special "none" +height "4in" +height_special "totalheight" +status open + +\begin_layout Plain Layout +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + \backslash -parbox[c][4 -\backslash -totalheight]{5cm}{ -\backslash -centering Send your data via mail}} +centering +\end_layout + +\end_inset + + Send your data via mail +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +} +\end_layout + +\end_inset + + \end_layout \end_inset @@ -2046,7 +2181,6 @@ cm: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2057,8 +2191,38 @@ name=reset2 \end_inset +\begin_inset Box Frameless +position "t" +hor_pos "c" +has_inner_box 1 +inner_pos "t" +use_parbox 0 +use_makebox 1 +width "7cm" +special "none" +height "1in" +height_special "totalheight" +status open + +\begin_layout Plain Layout +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + \backslash -makebox[7cm]{Reset the form} +centering +\end_layout + +\end_inset + + Reset the form +\end_layout + +\end_inset + + \end_layout \end_inset @@ -2139,7 +2303,6 @@ Printing: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2167,7 +2330,6 @@ as: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2199,7 +2361,6 @@ fullscreen: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2229,56 +2390,22 @@ name "sub:Action-button-customization" \end_layout \begin_layout Standard -Customizing the action buttons requires some complicated LaTeX code because - things like the width, height and border separation cannot be specified - as button parameters. -\end_layout - -\begin_layout Standard -The easiest way to customize the buttons is to fill it with a custom box: -\end_layout - -\begin_layout Enumerate -Create a normal LyX box of your choice -\end_layout - -\begin_layout Enumerate -Use the menu -\family sans -View\SpecialChar \menuseparator -Source -\begin_inset space ~ -\end_inset - -Pane -\family default - to show the source code window (if not already shown) -\end_layout - -\begin_layout Enumerate -set the cursor into the box and copy the corresponding LaTeX code from the - source window -\end_layout - -\begin_layout Enumerate -paste it t the content of the -\family sans -PDFAction -\family default - inset. +Customizing the action buttons requires the usage of boxes because things + like the width, height and border separation cannot be specified as button + parameters. \end_layout \begin_layout Standard -For example the button should be 4 +The easiest way to customize the buttons is to fill it with a custom box. + For example the button should be 4 \begin_inset space \thinspace{} \end_inset cm wide and have the height of 2 lines. Then create this parbox: -\begin_inset Newline newline -\end_inset - +\end_layout +\begin_layout Standard \begin_inset Box Frameless position "c" hor_pos "c" @@ -2300,17 +2427,21 @@ Save form as \end_inset -\begin_inset Newline newline -\end_inset +\end_layout -and copy its LaTeX code to the button +\begin_layout Standard +inside a \family sans PDFAction \family default inset. To center the text in the button add +\series bold + \backslash -centering right before the button text. +centering +\series default + as TeX code right before the button text. This is the result: \end_layout @@ -2319,7 +2450,6 @@ centering right before the button text. status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2330,12 +2460,38 @@ SaveAs \end_inset +\begin_inset Box Frameless +position "c" +hor_pos "c" +has_inner_box 1 +inner_pos "c" +use_parbox 1 +use_makebox 0 +width "4cm" +special "none" +height "2in" +height_special "totalheight" +status open + +\begin_layout Plain Layout +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + \backslash -parbox[c][2 -\backslash -totalheight]{4cm}{ -\backslash -centering Save form as} +centering +\end_layout + +\end_inset + + Save form as +\end_layout + +\end_inset + + \end_layout \end_inset @@ -2416,7 +2572,6 @@ menubordercolor={0.1 0.9 0.5} status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2427,12 +2582,39 @@ SaveAs \end_inset +\begin_inset Box Frameless +position "c" +hor_pos "c" +has_inner_box 1 +inner_pos "c" +use_parbox 1 +use_makebox 0 +width "4cm" +special "none" +height "2in" +height_special "totalheight" +status open + +\begin_layout Plain Layout +\noindent +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + \backslash -parbox[c][2 -\backslash -totalheight]{4cm}{ -\backslash -centering Save form as} +centering +\end_layout + +\end_inset + + Save form as +\end_layout + +\end_inset + + \end_layout \end_inset @@ -2500,7 +2682,6 @@ pixel thick yellow border: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2511,12 +2692,39 @@ SaveAs \end_inset +\begin_inset Box Frameless +position "c" +hor_pos "c" +has_inner_box 1 +inner_pos "c" +use_parbox 1 +use_makebox 0 +width "4cm" +special "none" +height "2in" +height_special "totalheight" +status open + +\begin_layout Plain Layout +\noindent +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + \backslash -parbox[c][2 -\backslash -totalheight]{4cm}{ -\backslash -centering Save form as} +centering +\end_layout + +\end_inset + + Save form as +\end_layout + +\end_inset + + \end_layout \end_inset @@ -2564,7 +2772,7 @@ pdfborder={0 0 0} \end_layout \begin_layout Standard -An example without a border and with a background color: +An example without a border and with lime background color: \begin_inset Newline newline \end_inset @@ -2573,7 +2781,6 @@ An example without a border and with a background color: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2584,14 +2791,63 @@ SaveAs \end_inset +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + \backslash colorbox{lime}{ +\end_layout + +\end_inset + + +\begin_inset Box Frameless +position "c" +hor_pos "c" +has_inner_box 1 +inner_pos "c" +use_parbox 1 +use_makebox 0 +width "4cm" +special "none" +height "2in" +height_special "totalheight" +status open + +\begin_layout Plain Layout +\noindent +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + + \backslash -parbox[c][2 -\backslash -totalheight]{4cm}{ -\backslash -centering Save form as}} +centering +\end_layout + +\end_inset + + Save form as +\end_layout + +\end_inset + + +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +} +\end_layout + +\end_inset + + \end_layout \end_inset @@ -2818,12 +3074,33 @@ name=contract,radio,default=tl,validate={validateTime();} status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -name=contract,radio,default=tl,validate={validateTime();} +name=contract,radio,default=tl,validate= +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +{ +\end_layout + +\end_inset + +validateTime(); +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +} +\end_layout + +\end_inset + + \end_layout \end_inset @@ -2874,7 +3151,6 @@ From: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2936,7 +3212,6 @@ To: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -3033,12 +3308,33 @@ An example text field: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -name=onlyNumbers, align=1, validate={checkNumber();} +name=onlyNumbers, align=1, validate= +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +{ +\end_layout + +\end_inset + +checkNumber(); +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +} +\end_layout + +\end_inset + + \end_layout \end_inset @@ -3127,7 +3423,8 @@ Submitting and applying data requires that all form fields have a name. \end_layout \begin_layout Itemize -All braces and brackets in form parameters must be inserted as TeX code! +All braces, brackets, backslashes and quote characters in form parameters + must be inserted as TeX code! \end_layout \begin_layout Itemize diff --git a/lib/layouts/pdfform.module b/lib/layouts/pdfform.module index f4954d7d0d..f0a4116826 100644 --- a/lib/layouts/pdfform.module +++ b/lib/layouts/pdfform.module @@ -25,10 +25,10 @@ Style "Begin PDF Form" LabelType Static LabelString "Begin PDF Form" Argument 1 - MenuString "PDF Form Parameters" - LabelString "Params" + MenuString "PDF Form Parameters" + LabelString "Params" Tooltip "Insert PDF form parameters here" - AutoInsert 1 + AutoInsert 1 EndArgument LabelFont Series Bold @@ -62,12 +62,11 @@ InsetLayout Flex:TextField LatexName TextField LabelString "TextField" Argument 1 - MenuString "PDF Form Parameters" - LabelString "Params" + MenuString "PDF Form Parameters" + LabelString "Params" Tooltip "Insert PDF form parameters here" - AutoInsert 1 + AutoInsert 1 EndArgument - PassThru 1 LabelFont Color magenta Size Small @@ -86,9 +85,9 @@ InsetLayout Flex:ChoiceMenu LatexName ChoiceMenu LabelString "ChoiceMenu" Argument 2 - LabelString "Label" + LabelString "Label" Mandatory 1 - AutoInsert 1 + AutoInsert 1 ToolTip "Insert the label here" EndArgument End @@ -120,9 +119,9 @@ InsetLayout Flex:PDFAction LatexName Acrobatmenu LabelString "PDFAction" Argument 1 - LabelString "Action" + LabelString "Action" Mandatory 1 - AutoInsert 1 + AutoInsert 1 ToolTip "The name of the PDF action" EndArgument End -- 2.39.2