1%  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %
2%
3%  This document describes flx - a library of routines that extend the
4%  functionality of xforms.  It is for input to the wordprocessor LaTeX.
5%  You will need to run LaTeX twice in order to obtain a correct table of
6%  contents.
7%
8%  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %  %
9
10\font\button = cmssbx10
11
12% twoside requires LaTeX version 2 epsilon?
13\documentstyle[12pt, twoside, epsf]{article}
14
15% Left margin   = 1.5in
16% Right margin  = 1.0in
17% Top margin    = 0.75in
18% Bottom margin = 1.0in
19
20\setlength{\textwidth}{6.0in}
21\setlength{\evensidemargin}{0.0in}
22\setlength{\oddsidemargin}{0.5in}
23\setlength{\headsep}{20pt}
24\setlength{\headheight}{12pt}
25\setlength{\topmargin}{-0.25in}
26\setlength{\footskip}{26pt}
27\setlength{\footheight}{12pt}
28\setlength{\intextsep}{15pt}
29
30\setlength{\parindent}{0pt}
31\setlength{\parskip}{10pt}
32
33% Vertical space around inserted figures
34\setlength{\textfloatsep}{15pt}
35\setlength{\intextsep}{15pt}
36
37% Set penalties for a line by itself at the bottom of a page and
38% breaking a page just before the last line of a paragraph.
39\clubpenalty 10000
40\widowpenalty 10000
41
42
43\newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}}
44\newcommand{\flx}{{\bf{flx\ }}}
45\newcommand{\code}[1]{{\texttt{#1}}}
46
47\pagestyle{headings}
48\pagenumbering{roman}
49\setcounter{section}{0}
50
51
52% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
53\begin{document}
54
55
56% Title page
57\thispagestyle{empty}
58\begin{center}
59      \begin{figure}[!hbt]
60            \leavevmode\epsffile{figures/flx.ps}
61            \vspace{1cm}
62      \end{figure}
63      \large
64      Version 0.1                           \\
65      Document: 1998 January                \\
66      \vspace{1.0cm}
67      Robert S. Mallozzi                    \\
68      University of Alabama in Huntsville   \\
69      currently at                          \\
70      NASA Marshall Space Flight Center     \\
71      \vspace{0.5cm}
72      mallozzi@cspar.uah.edu                \\
73      http://cspar.uah/edu/$\sim$mallozzir/ \\
74
75\end{center}
76
77\normalsize
78
79
80\vspace*{\fill}
81\newpage
82
83% Generate a blank page
84\thispagestyle{empty}
85\mbox{}
86\newpage
87
88% Table of contents
89\setcounter{page}{1}
90\tableofcontents
91\clearpage
92
93% Generate a blank page
94%\mbox{}
95%\newpage
96
97% Begin main text - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
98\section{Introduction}
99
100\hrule
101\vspace{0.5cm}
102
103\setcounter{page}{0}
104\pagenumbering{arabic}
105
106% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
107%
108\subsection{Overview}
109
110\flx is a library of routines that augments the functionality of the xforms
111library.  It consists of two main sections:
112%
113\begin{itemize}
114    \item[] {\sl Objects} \\
115            Functions that implement user--defined objects and widget
116            applications.
117    \item[] {\sl Utilities} \\
118            Functions intended to help programmers as they
119            develop their own interfaces using the xforms library.
120\end{itemize}
121
122
123\subsection{Design Goals and Request for Contributions}
124
125Development of \flx was undertaken to provide additional routines  that are not
126present in xforms, and to provide alternatives to some of the built--in
127routines of xforms.  The authors of xforms designed that library to be easily
128extended with user--defined objects; \flx is an attempt to gather togther some
129objects that have been designed by the users of xforms and utility routines into
130one convenient package.  Therefore, contributions to \flx are requested.  If
131you have designed a new xforms object, or if you have some utility routines
132that you think would be of use to others, submit them to
133\begin{quote}
134      mallozzir@cspar.uah.edu \\
135      Subject: flx submission
136\end{quote}
137for integration into \flx. Please provide the source
138code, a README file that explains the purpose of the utility, and if possible,
139a small example program that demonstrates the routine.  It is my hope that \flx
140will become a useful and convenient extension of xforms.  To do so,
141contributions from others are required!
142
143Note that utility routines should be xforms oriented.  That is, general
144c programming utility routines are not considered relevant for the \flx
145library.
146
147
148\subsection{Support}
149
150Although \flx routines are tested, software errors are inevitable.  Please
151send reports of code errors, or feature requests and suggestions to
152\begin{quote}
153      mallozzir@cspar.uah.edu \\
154      Subject: flx bug report
155\end{quote}
156All comments will be greatly appreciated.  Development of \flx occurs on a
157Pentium running RedHat Linux 2.0.27.  Testing under other platforms is
158restricted due to limited access to computers running other operating systems.
159
160
161\subsection{Legal}
162
163Permission to use, copy, and distribute this software for any purpose  and
164without fee is hereby granted, provided that the author's name and this notice
165appear in all copies and in supporting documentation. All distributions must
166include the original, unmodified source code. If the software is modified,
167notice of modifications must be given. The author's name shall not be otherwise
168used publicity pertaining to  distribution of the software without specific,
169written prior permission.
170
171The software is provided to you ``as--is'', and without warranty of any kind,
172express, implied or otherwise, including without limitation, any warranty
173of merchantability or fitness for a particular purpose.  In no event shall
174the author be liable to you or anyone else for any direct, special,
175incidental, indirect or consequential damages of any kind, or any damages
176whatsoever, including without limitation, loss of profit, loss of use,
177savings or revenue, or the claims of third parties, whether or not the
178author has been advised of the possibility of such loss, however caused
179and on any theory of liability, arising out of or in connection with the
180possession, use or performance of this software.
181
182This software is in no way affiliated with the University of Alabama,
183NASA and the US government, or the authors of the xforms library.
184
185The following is paraphrased from the xforms manual, and summarizes the
186xforms software license:
187
188\begin{quote}
189
190{\bf Forms Library} is {\em not} public domain.  It is copyright by T.C.\ Zhao
191and Mark Overmars, with all published and unpublished rights reserved.  However,
192permission to use for non--commercial and not-for-profit purposes is granted.
193You may not use xforms commercially (including in-house and contract/consulting
194use) without contacting (\code{xforms@world.std.com}) for a license
195arrangement.  Use of xforms for the sole purpose of running a publically
196available free software that requires it is not considered a commercial use.
197
198\end{quote}
199
200
201% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
202%
203\newpage
204\section{Objects}
205
206\hrule
207\vspace{0.5cm}
208
209
210\subsection{flx\_filebox}
211
212\code{flx\_filebox} is a file selection box that offers an alternative to
213the file selector that is part of xforms.
214To add an \code{flx\_filebox}, use the routine
215%
216{\ttfamily{
217\begin{quote}\begin{tabbing}
218    char *flx\_filebox ( \= const char *directory, \\
219                         \> const char *pattern, \\
220                         \> const char *default\_file )
221\end{tabbing}\end{quote}
222}}
223%
224Files in directory \code{directory} that match the pattern \code{pattern} will
225be shown in the form (see Figure~\ref{fig:flx_filebox}).   \code{default\_file}
226is the default file name.  Only a single selector can be visible on the screen
227at a time, and there is currently no facility for selecting multiple files.
228%
229\begin{figure}[!hbt]
230\begin{center}
231%      \epsfxsize=5in
232      \leavevmode\epsffile{figures/flxfilebox.ps}
233      \nobreak
234      \caption{
235      \code{flx\_filebox}
236      }
237      \vspace{0.35in}
238      \label{fig:flx_filebox}
239\end{center}
240\end{figure}
241%
242A filename can be selected by highlighting an entry with a single mouse click,
243and then selecting ``Ok''.  Alternatively, one can double click on the filename
244to immediately select the entry and return to the application program.
245
246The directory structure can be navigated by single clicking on directory
247entries in the left browser box.  The right browser will be updated with the
248file list from the new directory.
249
250Color filetypes are supported in \code{flx\_filebox}.  For example, regular
251files and directories are shown in black, symbolic links in cyan, etc.
252Selecting the ``Help'' button will invoke an \code{flx\_help\_dialog} (see
253below) that lists the filetype colors, and instructions for using
254\code{flx\_filebox}.
255
256
257
258\subsection{flx\_help\_dialog}
259
260\code{flx\_help\_dialog} is a utility used to display a simple help form.
261The function creates a form that displays the specified text, and a ``Dismiss''
262button.  The text can have embedded newline characters, and the form width
263will be based on the widest line.  Thus, for an aesthetically pleasing help
264form, you should try to make the text lines roughly the same length.
265To add an \code{flx\_help\_dialog}, use the routine
266%
267{\ttfamily{
268\begin{quote}\begin{tabbing}
269    FL\_FORM *flx\_help\_dialog ( \= const char *help\_text )
270\end{tabbing}\end{quote}
271}}
272%
273The function returns a pointer to the help dialog object.
274The help dialog that is used in \code{flx\_filebox} is shown in
275Figure~\ref{fig:flx_help_dialog}.
276%
277\begin{figure}[!hbt]
278\begin{center}
279%      \epsfxsize=5in
280      \leavevmode\epsffile{figures/flxhelpdialog.ps}
281      \nobreak
282      \caption{
283      flx\_help\_dialog
284      }
285      \vspace{0.35in}
286      \label{fig:flx_help_dialog}
287\end{center}
288\end{figure}
289
290
291
292\subsection{flx\_return\_button}
293
294\code{flx\_return\_button} implements a default return button that is similar
295in appearance to the Motif default button.  For an example of the appearance of
296an \code{flx\_return\_button}, see Figure~\ref{fig:flx_help_dialog}.  Pressing
297the $<$Return$>$ key when the form has window focus will invoke the callback
298function that you attach to the \code{flx\_return\_button}.  Note that if you
299create a form that contains both an \code{flx\_return\_button} and a text input
300object, the $<$Return$>$ button can no longer be used to invoke the text input
301callback.  For one example of how to avoid conflicts between return buttons and
302text input objects, see \code{flx\_filebox.c}.
303
304
305\subsection{flx\_show\_dialog}
306
307\code{flx\_show\_dialog} implements a set of popup dialog widgets whose
308function is similar to that of the \code{fl\_goodies} dialogs.  Currently the
309following types of dialogs are supported:
310%
311\begin{itemize}
312      \item[] error
313      \item[] info
314      \item[] question
315      \item[] message
316      \item[] warning
317\end{itemize}
318%
319To invoke an \code{flx\_show\_dialog}, use the following function:
320%
321{\ttfamily{
322\begin{quote}\begin{tabbing}
323     int flx\_show\_dialog ( \= const char *key, \\
324                             \> const char *text )
325\end{tabbing}\end{quote}
326}}
327%
328{\ttfamily key} is a pointer to one of the strings from the list above that
329denotes the type of dialog, and {\ttfamily text} is a pointer to the text that
330should appear in the dialog, which may have embedded newline characters.
331To set attributes of the dialogs, use the following routines
332before the call to \code{flx\_show\_dialog}.
333
334To set the color of the dialog text:
335%
336{\ttfamily{
337\begin{quote}\begin{tabbing}
338    flx\_set\_dialog\_lcol ( FL\_COLOR label\_color ) \\
339\end{tabbing}\end{quote}
340}}
341
342To set the dialog button inactive and active colors:
343%
344{\ttfamily{
345\begin{quote}\begin{tabbing}
346    flx\_set\_dialog\_color ( FL\_COLOR col1, FL\_COLOR col2 ) \\
347\end{tabbing}\end{quote}
348}}
349
350To set the background color of the dialog:
351%
352{\ttfamily{
353\begin{quote}\begin{tabbing}
354    flx\_set\_dialog\_bgcolor ( FL\_COLOR bg\_color ) \\
355\end{tabbing}\end{quote}
356}}
357
358To set the dialog font style and size:
359%
360{\ttfamily{
361\begin{quote}\begin{tabbing}
362    flx\_set\_dialog\_font ( int lstyle, int lsize ) \\
363\end{tabbing}\end{quote}
364}}
365
366
367\subsection{flx\_show\_input}
368
369This routine is similar to \code{flx\_show\_dialog}, but is used to obtain
370input from the user.  It is an alternative to \code{fl\_show\_input}.
371
372To invoke an \code{flx\_show\_input}, use the following function:
373%
374{\ttfamily{
375\begin{quote}\begin{tabbing}
376     char *flx\_show\_input ( \= int key, \\
377                              \> const char *message, \\
378                              \> const char *initial )
379\end{tabbing}\end{quote}
380}}
381%
382The function returns a pointer to the input string.
383{\ttfamily key} is an integer denoting one of the xforms input types
384(\code{FL\_NORMAL\_INPUT, FL\_INT\_INPUT}, etc),
385{\ttfamily text} is a pointer to the text that
386should appear in the dialog, which may have embedded newline characters, and
387{\ttfamily initial} is a pointer to the text that should appear as the initial
388value in the input box.   Set {\ttfamily initial} to \code{NULL} if you do
389not want the initial value set.
390To set attributes of the dialog, use the \code{flx\_set\_dialog...} routines
391described above before the call to \code{flx\_show\_input}.
392
393
394
395
396% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
397%
398\newpage
399\section{Utilities}
400
401\hrule
402\vspace{0.5cm}
403
404
405
406\subsection{flx\_scale\_form}
407
408\code{flx\_scale\_form} is a simple utility used to scale a form based
409on the size of the current font.  This routine will enable your form to look
410reasonable on machines that use different default font sizes. A reference scale
411factor  of width = 1.0, height = 1.0 is used, based on the size of a 75 dpi
412font.   The dimension of a test string is computed, and compared to the
413dimension of that string when using a 75 dpi font.  The scale factor is
414approximated based on the ratio of the two string dimensions.  After building a
415toplevel form, set its scale with the following function:
416%
417{\ttfamily{
418\begin{quote}\begin{tabbing}
419     void flx\_scale\_form ( \= FL\_FORM *form )
420\end{tabbing}\end{quote}
421}}
422%
423where {\ttfamily form} is a pointer to the new form.  Typically, this would
424be called just before {\ttfamily fl\_show\_form}.
425
426
427
428\subsection{flx\_sort\_browser}
429
430\code{flx\_sort\_browser} sorts an xforms browser object.  The browser contents
431are replaced with the sorted contents.   To sort a browser object, use
432%
433{\ttfamily{
434\begin{quote}\begin{tabbing}
435     void flx\_sort\_browser ( \= FL\_OBJECT *browser, \\
436                               \> int (*sorter) (const void *, const void *)) \\
437\end{tabbing}\end{quote}
438}}
439%
440The contents of the browser are sorted in ascending order according to a
441comparison function pointed to  by  \code{sorter()}, which  is  called  with
442two  arguments  that point to the objects being compared.  If \code{sorter()}
443is \code{NULL}, the browser is sorted alphabetically.  The actual sorting work
444is performed by the c library function \code{qsort()}.  See the \code{qsort()}
445man page for details on how to write your own comparison function.
446
447
448
449\subsection{flx\_justify\_input}
450
451\code{flx\_justify\_input} justifies the string in an input widget so that the
452right end of the string as aligned with the right edge of the input box.
453If the input widget is wider than the string width, this routine has no effect.
454To justify the input string, use
455%
456{\ttfamily{
457\begin{quote}\begin{tabbing}
458     void flx\_justify\_input ( \= FL\_OBJECT *inputObj, \\
459                                \> char *string, \\
460			        \> int style, \\
461			        \> int size ) \\
462\end{tabbing}\end{quote}
463}}
464%
465The \code{FL\_OBJECT} pointer denotes the input widget.  \code{string} is the
466string drawn in the input box, and \code{style} and \code{size} are  the xforms
467macros for the font style and size (\code{FL\_NORMAL\_STYLE},
468\code{FL\_NORMAL\_SIZE}, etc). This routine is meant to be called immediately
469after \code{fl\_set\_input}.
470
471
472% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
473%
474\newpage
475\section{Appendix}
476
477\hrule
478\vspace{0.5cm}
479
480
481
482\subsection{Object Class Numbers}
483
484The xforms library requires a unique identifer for each added object
485class.  These numbers must be in the range of 1001 to 4999.
486The \flx library begins class numbers at 3501.
487The following object class numbers are currently used:
488
489\begin{enumerate}
490      \setlength{\itemsep}{0pt} \setlength{\parsep}{0pt}
491      \item[] FLX\_RETURN\_BUTTON    3501
492\end{enumerate}
493
494%\begin{enumerate}
495%      \setlength{\itemsep}{0pt} \setlength{\parsep}{0pt}
496%      \item wingspan/setup\_vms
497%      \item wingspan/setup\_sun
498%      \item wingspan/setup\_irix
499%\end{enumerate}
500
501%
502%\begin{figure}[!hbt]
503%\begin{center}
504%      \epsfxsize=5in
505%      \leavevmode\epsffile{banner.ps}
506%      \nobreak
507%      \caption{
508%      WINGSPAN Startup Banner
509%      }
510%      \vspace{0.35in}
511%      \label{fig:banner}
512%\end{center}
513%\end{figure}
514%
515
516
517
518\end{document}
519