]> Creatis software - bbtk.git/blob - kernel/doc/bbtkUsersGuide/bbtkUsersGuide.tex
334a98f2b99cd467675cda69739b497f7437e933
[bbtk.git] / kernel / doc / bbtkUsersGuide / bbtkUsersGuide.tex
1 % ==========================================
2 \documentclass[11pt,final,a4paper]{article}
3 \input{config.tex}
4 \begin{document}
5 \bbtkGuide[User's Guide]
6 % ==========================================
7
8
9 % ==========================================
10 \newpage
11 \hrule
12 \section{Introduction}
13 Note: pdf version of this User's Guide can be retrieved from the following URL:\\
14 \url{http://www.creatis.insa-lyon.fr/creatools/documentation}
15 % ==========================================
16 \subsection{What is bbtk ?}
17 % ==========================================
18 \BBTK(\bbtkns) is a set of tools 
19 (\CPP libraries and executables) 
20 providing a \CPP framework for the definition 
21 of elementary processing \emph{units}, called {\bf black boxes}, 
22 and the definition and execution of processing \emph{chains} 
23 made up of these black boxes. \\
24
25 %It's a part of the \texttt{Creatools suite} composed mainly of :
26 %\begin{verbatim}
27 % bbtk
28 % creaContours
29 % creaImageIO
30 % creaLib
31  
32 %\end{verbatim}
33 %which depend on the OpenSource libraries: 
34 %\begin{verbatim}
35 % gdcm 
36 % itk
37 % vtk
38 % wxWidgets
39 %\end{verbatim}
40
41 % ==========================================
42 \subsubsection{The black box philosophy}
43 % ==========================================
44
45 \href{http://www.answers.com/topic/black-box-theater}{The Answers Dictionary} defines a {\bf black box} as 
46 \emph{``A device or theoretical construct with known or specified performance characteristics 
47 but unknown or unspecified constituents and means of operation''} \\
48 \href{http://en.wikipedia.org/wiki/Black_box_\%28disambiguation\%29}{Wikipedia}
49 defines a {\bf black box} as 
50 \emph{``any component in a system in which only the input and output 
51 characteristics are of interest, without regard to its internal mechanism 
52 or structure''}. \\
53 We should merge these definitions: 
54 not only the inputs and outputs are of interest but also 
55 \emph{what the box does!}
56 Hence, we would say that a black box is any \emph{\bf documented} 
57 component of a system, letting the user know  
58 \emph{\bf what} the box is supposed to do and 
59 \emph{\bf how to use it}
60 but not \emph{\bf how it does it}. \\
61
62 \BBTK provides a systematic framework 
63 to encapsulate (or ``wrap'') any 
64 existing \texttt{C} or \CPP processing code into an object 
65 (a black box) having a {\bf generic symbolic interface}, where 
66
67 \begin{itemize}
68 \item{\bf generic} means that the interface is \emph{the same} 
69 for all boxes. Hence one does not need to know which particular 
70 method allows, say, to set a particular input or 
71 get a particular output of the box. 
72 One can use a black box in a purely abstract way. 
73 \item{\bf symbolic} means that a particular 
74 input or output is referenced by a 'name', that is by a symbol 
75 which identifies the input or output. 
76 It also means that symbolic information (text) is 
77 attached to a box: description of the box, author, 
78 description of its inputs and outputs, etc.
79 \end{itemize}
80
81 (Actually, genericity is achieved because the interface is symbolic. 
82 We let you think about this\dots)
83
84 Of course, symbolic data attached to a box may be 
85 {\bf queried}: what are the inputs/outputs of the box? 
86 what are their type? their description? etc.
87 This allows {\bf automatic documentation} of boxes. 
88
89 The abstract definition of black boxes is the most basic 
90 aspect of \BBTK architecture. 
91 Another key aspect is the grouping of black boxes into 
92 so called {\bf packages}, 
93 which are \emph{dynamic libraries} that can also 
94 be queried, in particular about the boxes they provide. 
95 The package structure then offers a mechanism similar to \emph{'plug-in'} mechanism.
96 \BBTK provides the methods to load a package at run-time, 
97 and create instances of the boxes it contains. 
98
99 These two mechanisms (black boxes and packages) 
100 then give the way to:
101
102 \begin{itemize}
103 \item The definition of an {\bf interpreted script language}, 
104 which allows to manipulate packages and boxes very easily in symbolic way. 
105 \BBTK provides one:  \bbs (the Black Box Script language) and its interpreter
106 \bbi (the Black Box Interpreter). 
107 \item {\bf Automatic documentation} of existing packages. 
108 \texttt{html} documentation of packages is proposed by 
109 \bbStudions.
110 \end{itemize}
111
112 Finally, these different components allow {\bf efficient}:
113
114 \begin{itemize}
115 \item {\bf capitalization and reuse} of existing processing units, 
116 including {\bf documentation} 
117 \item {\bf testing, prototyping} in a very simple script language
118 \item {\bf inter-operability} between atomic processings that 
119 have been written by different persons, using different libraries, etc. 
120 \end{itemize}
121
122 % ==========================================
123 \subsubsection{\bbtk components}
124 % ==========================================
125 \BBTK includes:
126 \begin{itemize}
127   \item A \CPP {\bf\emph{library}} - called \bbtk - which defines a framework 
128     (abstract classes) to develop black boxes and store them into 
129     dynamic libraries, called black box \emph{packages}.
130   \item Different {\bf\emph{"core" black box packages}}:
131     \begin{itemize}
132       \item {\bf\emph{std}}: the 'standard' package including basic useful boxes.
133       \item {\bf\emph{wx}}: basic graphical interface elements (widgets: sliders, buttons, etc. based on the \texttt{wxWidgets} library).  
134       \item {\bf\emph{itk}}: the basic image processing package, based on the \itk library.
135       \item {\bf\emph{vtk}}: the basic images and surfaces processing and visualization package, based on the \vtk library.
136       \item {\bf\emph{wxvtk}}: widget boxes based on the \vtk library (2D and 3D visualization and
137       interaction).
138       %\item {\bf\emph{creaImageIO}}: Provides hight level widgets to read images, including DICOM.
139       \item {\bf\emph{toolsbbtk}}: Tools for bbtk administration and package development.     
140     \end{itemize}
141   \item A {\bf\emph{development environment}}, called \bbStudio, which provides:
142     \begin{itemize}
143       \item An online {\bf\emph{script editor and interpreter}}
144       \item A powerful html {\bf\emph{help environment}}, integrating:       
145         \begin{itemize}
146           \item Online documentation scanning
147           \item Retrieving boxes on various criteria
148           \item Checking demos and examples
149         \end{itemize}
150       \end{itemize}
151       \item A standalone {\bf\emph{interpreter}}, called \bbins, which allows to 
152            execute \bbs scripts or commands.
153       \item {\bf\emph{Various development utilities}}:
154          \begin{itemize}
155             \item \bbfy generates the \CPP code of a black box from a 
156                description file written in \texttt{xml}.
157                 %\item \bbdoc generates the html documentation of a black box package 
158                 %(author, description, description of its black boxes : 
159                 %author, description, inputs, outputs, and so on).
160             \item \bbCreatePackage allows to create the basic file architecture 
161                to start the development of a new black box package.
162             \item \bbCreateBlackBox allows to create the basic file architecture 
163                to start the development of a new black box, that will be included in an already existing package.              
164             \item \texttt{bbs2cpp} translates a \texttt{.bbs} script into a \CPP file.
165             \item \bbc (sorry: Linux only, for the moment) that compiles \texttt{.bbs} scripts into executables.
166             \item \bbRegeneratePackageDoc which creates the html documentation of the Package.
167             \item \bbRegenerateBoxesLists which creates the html pages of the various lists of all the currenly installed boxes.
168             \item \bbPlugPackage which automatically incorporates a new package.                  
169          \end{itemize}
170       \item A full {\bf\emph{documentation}} that can be printed (pdf), browsed (html) and
171       queried through keywords.           
172 \end{itemize}
173
174 The general architecture of \BBTK 
175 is shown in figure \ref{bb-architecture}.
176
177 \begin{figure}[!ht]
178 \caption{\BBTK architecture}
179 \begin{center}
180 \includegraphics[width=0.6\textwidth]{bb-architecture.png}
181 \end{center}
182 \label{bb-architecture}
183 \end{figure}
184
185 %%\newpage
186
187 % ==========================================
188 \subsection{Content of this guide}
189 % ==========================================
190
191 Read this \texttt{Users' Guide} if you want to learn how to use 
192 \bbtk development environnement (\bbStudions) and how to write black box scripts.\\
193 If your aim is to write your own Packages and Black Boxes, you have to read the
194 \texttt{Package Developper's Guide}.
195
196 % ==========================================
197 \newpage
198 \hrule
199 \section{Getting started with bbStudio}
200 \label{bbStudio}
201 % ==========================================
202
203
204 % ==========================================
205 \subsection{The interface}
206 % ==========================================
207
208
209 %\vspace{0.5cm}\hrule
210 %\section{The Development environment (bbStudio)}
211 %\label{bbStudio}
212
213 Just run it, typing in a console \bbStudio 
214 or clicking on its icon or its menu entry.
215 You'll get something like in figure 
216 \ref{bbi-fig-bbStudio-gui}
217 (the exact appearance of \bbStudio is Operating System and \bbtk version dependent).
218
219 %At start, \bbStudio opens with a very minimal 'How to use' in the middle. 
220 %Don't forget to read it: it will vanish at the first mouse click. 
221
222
223 %\begin{figure}[!ht]
224 %\caption{The bbStudio Development environment interface at start time}
225 %\begin{center}
226 %\includegraphics[width=0.7\textwidth]{bbStudioMainPageStart.png}
227 %\end{center}
228 %\label{bbi-fig-bbStudio-gui-start}
229 %\end{figure}
230
231 %Let's have a look at the resized window :
232 \begin{figure}[!ht]
233 \caption{The bbStudio Development environment interface}
234 \begin{center}
235 \includegraphics[width=0.7\textwidth]{bbStudioMainPage.png}
236 \end{center}
237 \label{bbi-fig-bbStudio-gui}
238 \end{figure}
239
240 The interface is divided into four parts: \texttt{Files}, \texttt{Messages},
241  \texttt{Command}, \texttt{Help}.
242 It is written using the Advanced User Interface library of wxWidgets
243 (a.k.a. AUI),
244 whose 'docking manager' allows windows and toolbars to be floated/docked 
245 onto a frame.
246 Feel free to resize/reposition any part you want.
247 Your preferences will be kept next time you run again \bbStudions. 
248
249 %Please don't use this feature at learning time 
250 %(the snapshots of this document wouldn't match with your screen ...)
251
252 \subsubsection{'Files' part}
253 \label{bbi-FilesPart}
254
255 It is the \bbs script editor (see section \ref{Scripting} to learn about scripting).
256
257 If you load a file holding a script, it will be displayed in this area, and you will be
258 able to modify it, to save it, to save-as it and to run it, using the respective
259 lower-toolbar buttons (see figure \ref{lowertoolbar})
260
261 \begin{figure}[!ht]
262 \caption{The 'Files' lower toolbar}
263 \begin{center}
264 \includegraphics[width=0.7\textwidth]{lowertoolbar2.png}
265 \end{center}
266 \label{lowertoolbar}
267 \end{figure}
268
269
270 % \begin{itemize}
271 %   \item {\bf\emph{New file}}: Create a new file to hold a script
272 %   \item {\bf\emph{Open file}}: Open an already existing file holding a script 
273 %   \item {\bf\emph{Close file}}: Close a file holding a script
274 %   \item {\bf\emph{Save file}}: Save he current file (if modified)
275 %   \item {\bf\emph{Save file as}}: Save he current file under a different name
276 %   \item {\bf\emph{Run file}}: Execute the script you just loaded/modified/written
277 %   \item {\bf\emph{cursor position}}: column number : line number   
278 % \end{itemize}
279
280
281 \subsubsection{'Messages' part}
282 \label{bbi-MessagesPart}
283
284 Two kinds of messages will be output here:\\
285 \begin{itemize}
286 \item {\bf\emph{System messages:}} produced by the kernel, in case of a user mistyping, or an execution error.\\
287 \item {\bf\emph{Script messages:}} produced by the \bbtk equivalent of \texttt{printf} 
288 or \texttt{std::cout} in user programs.
289 \end{itemize}
290
291
292 \subsubsection{'Command' part}
293 \label{bbi-CommandPart}
294
295 You can type here \bbs commands which are executed on the fly.
296 The buttons are shortcuts to the most frequently used commands.
297 The command (or button) \texttt{help} permits to print in the \texttt{Message} zone the list of all recognized commands, while the command \texttt{help} \emph{command\_name} provides the help on the selected command.
298
299 \subsubsection{'Help' part}
300 \label{bbi-HelpContentsPart}
301
302 The 'Help' part of \bbStudio is used to browse the html help of \BBTKns. You can find there various guides (see section~\ref{sec:guides}) and detailed information about each black box available (see section~\ref{sec:boxes_help}). They can be browsed alphabetically, by package and by category. Two special categories, demos and examples, are available via direct links (see section~\ref{sec:demos_examples}).
303
304
305 % ==========================================
306
307
308
309
310 % ==========================================
311 % ==========================================
312 % ==========================================
313 % ==========================================
314 % ==========================================
315
316
317
318 % ==============================================
319 \subsection{Online Help}
320 % ==============================================
321
322 Various levels of help are supplied by \bbStudions.
323
324 % ==========================================
325 \subsubsection{Command-line help}
326 % ==========================================
327
328
329 The 'working' area (the left one, as opposed to the (\texttt{Help}) area, on the right side) is composed of: 
330 one single line area (\texttt{Command}), at the bottom, in which you can enter your commands, and 
331 a multiple line zone (\texttt{Messages}) in which the command interpreter prints out the result of your commands.
332 %The upper part contains the script editor; we shall not use it right now, you may reduce it.
333 Command-line help for the black box scripting language \bbsns (see \ref{Scripting}) can be obtained in this zone. \par
334 As mentioned above, the command (or button) \texttt{help} permits to print in the \texttt{Message} zone the list of all recognized commands, while the command \texttt{help} \emph{command\_name} displays in this zone the help about the selected command.\par
335 The command \texttt{help} \emph{package\_name} displays in the \texttt{Message} zone a short information about the selected package, provided that this package was previously loaded (Note that you can know which packages were loaded by executing the command \texttt{help packages}). Furthermore, it simultaneously displays in the right zone (\texttt{Help}) the corresponding full html help available.\par
336 In a similar way, one can obtain the information about any box from the loaded packages, by executing the command \texttt{help} \emph{box\_name}. Note that some boxes may be unavailable if the command \texttt{load} was used to load the package, since this command only loads the boxes in binary. Some boxes are defined in script files. To be sure that all the boxes from the package are loaded the command \texttt{include} is to be preferred.\par
337 You can also get the list of the objects currently present in the workspace, by executing the command \texttt{help workspace}.
338
339 % ==========================================
340 \subsubsection{Guides}
341 \label{sec:guides}
342 % ==========================================
343
344 All the guides can be browsed in html version in the \texttt{Help} part of \bbStudions. Their pdf versions (except Doxygen documentation) can be retrieved from:\\
345 \url{http://www.creatis.insa-lyon.fr/creatools/documentation}
346
347  \begin{itemize}      
348      \item {\bf\emph{User's Guide}}: This guide!
349      \item {\bf\emph{Package Developer's Guide}}: Step-by-step "How-to" for programmers who want to create their own
350      black boxes/packages.
351     % \item {\bf\emph{Developper's Guide}}: For bbtk kernel developpers only. (This one is probably not very much
352     %  up-to-date, since we spend more time in developping than writing documentation that's not of user concern).
353     % \item {\bf\emph{Reference Manual}}: Contains a exaustive description of all the features for all the commands.
354     %\item {\bf\emph{Booklet}}: Vade mecum.     
355      \item {\bf\emph{Doxygen Documentation}}: Doxygen source browser.\\ Automatically generated from source files. Should only concern the kernel developers.
356    \end{itemize}
357         
358
359   
360
361 % ==========================================
362 \subsubsection{Boxes Help}
363 \label{sec:boxes_help}
364 % ==========================================
365  Lists of currently available boxes from installed packages, sorted according to the following criteria:
366    \begin{itemize} 
367     \item {\bf\emph{Alphabetical list}}%: This is the 'zero-level' of retrieving.
368     \item {\bf\emph{List by package}}%: The boxes are indexed by package they belong to
369     \item {\bf\emph{List by category}}:
370      Each box is indexed by a list of keywords, called 'categories', such as '\texttt{read/write}',
371      '\texttt{filter}', '\texttt{viewer}', ...
372     A given box may belong to more than one \texttt{category}, however some categories are mutually exclusive.
373     Standard categories are:
374     \begin {itemize}
375        \item\texttt{atomic box}/\texttt{complex box}\\
376        Any box is either atomic or complex.\\
377        The former are 'atomic' units written in C++ and available in binary form.\\
378        Any pipeline built up as an assembly of several black boxes (atomic or complex), and described in \bbs script language is itself viewed as a complex black box, and hence tagged as belonging to the latter category.
379        \item\texttt{example} / \texttt{demo} / \texttt{application} (see \ref{sec:demos_examples})\\
380           These ones are scripts that produce a result when executed (i.e. they
381           execute a pipeline), as opposed to the scripts that only define complex boxes but do not instanciate and execute boxes. 
382           \begin {itemize}
383              \item\texttt{example}: It is just a (simple) example, for programmers, of how to use a given feature. The \texttt{Examples} link on the starting page links to the list of the boxes of this category.
384              \item\texttt{demo}: It can be a 'good looking' (a.k.a 'sexy') example of some sophisticated work, done only by using \texttt{bbtk}. The \texttt{Demos} link on the starting page links to the list of the boxes of this category.
385              \item\texttt{application}: It is a final application, end-user intended (e.g. association of a DICOM image browser, reader, viewer with some interaction and processing)    
386           \end {itemize}
387         \item\texttt{widget}: A piece of graphical interface (based on \texttt{wxWidgets}).
388         \item\texttt{dicom}: A box related to medical images in Dicom format.
389         \item\texttt{viewer}: A box allowing to view something (e.g. an image).
390         \item\texttt{read/write}: An I/O-related box.
391         \item\texttt{mesh}: A mesh-related box.
392         \item\texttt{filter}: A filter, mainly image filters.
393         \item\texttt{image}: An image-related box.
394         \item\texttt{3D object creator}: A box which creates a 3D object to be injected into a 3D view (e.g. a plane, a surface).
395         \item\texttt{math}: Maths of course.
396         \item\texttt{misc}: Miscellaneous...       
397     \end {itemize}
398   Remark that the list of categories is 'auto-extensible': each time a new box is created which belongs to a new category and the boxes list is regenerated, the new category appears in the list, holding the new box. The above list only contains the categories used in the packages provided with current \bbtk release.
399     \item {\bf\emph{ List of adaptors}}: The adaptors are a special type of black boxes that are used internally to perform type conversions. Although they are not end user intended, you may see their list. Adaptors belong to the \texttt{adaptor} category.
400   \end {itemize}
401   For each boxe, the html \texttt{Help} provides the informations necessary to use it: its name, its purpose, the descriptions of its inputs/outputs and the name of the package (or script file) that is to be loaded. Additionally, for all boxes but the atomic ones (i.e. for all boxes defined in \bbs script language), the corresponding script is available via [\texttt{source}] link. Actually, by clicking on this link one loads the script into the \texttt{Files} area where it can be analyzed, edited and executed.
402   
403 % ==========================================      
404 \subsubsection{The Package Browser}
405 \label{Package_Browser}
406 % ==========================================
407
408 The package browser is a standalone application that 
409 dynamically loads and queries the available packages. 
410 It is thus a smarter tool than the static html documentation.
411 You can run it with the command \texttt{bbPackageBrowser} 
412 or in \bbStudio using either the button of the 'Command' part 
413 or the menu entry 'Windows$>$Start Package Browser'. 
414 Remark that it may take some time to start because it loads all available 
415 packages at start.
416 Its appearance is reproduced in figure \ref{imPackage_Browser}.
417
418 \begin{figure}[!ht]
419 \caption{\label{imPackage_Browser}The Package Browser}
420 \begin{center}
421 \includegraphics[width=0.6\textwidth]{Package_Browser.png}
422 \end{center}
423 \end{figure}
424
425 It allows you to find boxes using a multi-criteria filtering principle : 
426 The boxes listed are the one whose attributes match \emph{all} the 
427 words entered in the 'Filter' part.
428 You can get the whole description of a given box clicking on its name.
429
430 Warnings : 
431
432 \begin{itemize}
433 \item It's case sensitive, i.e '\texttt{Button}' 
434 will give different results than '\texttt{button}'
435 \item You have to press enter in the filter zone to update the boxes list
436 \item A filtering string only has to match a subpart of the related attribute of a box.
437 For example, entering 'utt' in the 'Name' attribute will match a box called 'Button'.
438 \end{itemize}
439
440 Attributes :
441
442 \begin {itemize}
443 \item Package : The name of the package to which the box belongs (e.g. \texttt{wxvtk}, \texttt{std})
444 \item Name : The name of a box or an application (e.g. \texttt{Reader}, \texttt{example})
445 \item Description : A part of the description of a box (e.g. \texttt{3D}, \texttt{image})
446 \item Category : The categories of the box (e.g. \texttt{demo})
447 \item Input/Output Type : The \CPP type of an input or output (e.g. \texttt{int}, \texttt{vtkImageData*}, \texttt{std::string})
448 \item Input/Output Nature : The \texttt{nature} of an input or output (e.g. \texttt{file name}, \texttt{signal}) 
449 \end {itemize}
450
451 %If 'Show widgets' is selected then 
452
453
454 %%\newpage 
455
456
457
458 % ==========================================
459
460 %\newpage
461
462 % ==============================================
463 \subsection{Running Demos and Examples}
464 \label{sec:demos_examples}
465 % ==============================================
466
467 In the 'Help' part (See figure \ref{HelpContents}), select \texttt{Examples} link.
468
469 \begin{figure}[!ht]
470 \caption{\bbStudio 'Help' panel}
471 \begin{center}
472 \includegraphics[width=0.7\textwidth]{HelpContents.png}
473 \end{center}
474 \label{HelpContents}
475 \end{figure}
476
477 %\newpage
478
479 You will get a list of examples (See figure \ref{example}).
480
481 Note: due to an unfixed bug in Linux, you have to click on 'reload' to get it. \\ 
482
483
484 \begin{figure}[!ht]
485 \caption{Examples list}
486 \begin{center}
487 \includegraphics[width=0.7\textwidth]{example.png}
488 \end{center}
489 \label{example}
490 \end{figure}
491
492
493 %\begin{figure}[!ht]
494 %\caption{\label{BoxCategories}Box Categories}
495 %\begin{center}
496 %\includegraphics[width=0.7\textwidth]{BoxCategories.png}
497 %\end{center}
498 %\end{figure} 
499
500
501 Select \texttt{wx::exampleSlider}.
502  
503 \begin{figure}[!ht]
504 \caption{Html documentation of example 'exampleSlider'}
505 \begin{center}
506 \includegraphics[width=0.7\textwidth]{exampleSlider.png}
507 \end{center}
508 \label{exampleSlider}
509 \end{figure}
510
511 You can see information on the example and 
512 the graphical representation of the workflow defined by the script
513 (the elementary boxes that compose it, and their connections, see figure \ref{exampleSlider}).
514
515 Click on \texttt{[source]}, it will be loaded
516 in the 'Files' part, within the script editor (See figure \ref{exampleSliderSource});
517
518 \begin{figure}[!ht]
519 \caption{Source code of 'exampleSlider'}
520 \begin{center}
521 \includegraphics[width=0.7\textwidth]{exampleSliderSource.png}
522 \end{center}
523 \label{exampleSliderSource}
524 \end{figure}
525
526 Run it, using the 'Files' toolbar (see figure \ref{lowertoolbar})
527
528 You'll get something like in figure \ref{execSliderSource}.
529
530 \begin{figure}[!ht]
531 \caption{\label{execSliderSource}Execution of 'exampleSlider'}
532 \begin{center}
533 \includegraphics[width=0.7\textwidth]{execSliderSource.png}
534 \end{center}
535 \end{figure}
536
537 Feel free to move the slider, to check whether it actually works...
538
539 %\newpage
540
541 Just a few words on what you saw :
542 \begin{itemize}
543 \item{In the source code of the script}: \\
544         \begin{verbatim}
545    load std
546    load wx
547         \end{verbatim}
548         These \bbs commands load the packages std and wx
549         \begin{verbatim}
550    new Slider     slider
551    set slider.ReactiveOnTrack 1
552         \end{verbatim}
553         We create a \texttt{Slider} box called \emph{slider}.
554
555         We tell it to inform anybody that's interested in, that the cursor moved, each time it moved. 
556         The default behaviour is to inform only when cursor is released.
557         \begin{verbatim}
558    new OutputText text
559         \end{verbatim}
560         We create an \texttt{OutputText} box called \emph{text} 
561         (in which slider value will be displayed)
562
563         \begin{verbatim}
564    new LayoutLine layout
565         \end{verbatim}
566         We create a \texttt{LayoutLine} box called \emph{layout},
567         a widget box designed to embed other widgets (say, a main window)
568         \begin{verbatim}
569    connect slider.Widget    layout.Widget1
570    connect text.Widget      layout.Widget2
571         \end{verbatim}
572         We embed \emph{slider} and \emph{text} into  \emph{layout}.
573         \begin{verbatim}
574    connect slider.BoxChange text.BoxExecute
575    connect slider.Out       text.In
576         \end{verbatim}
577         We tell  \emph{slider} to inform \emph{text} every time it's modified.
578
579         We tell  \emph{slider} to pass its output value (\texttt{Out}) 
580         to \emph{text}  input value (\texttt{In})
581         \begin{verbatim}
582    exec layout
583         \end{verbatim}
584         We tell \emph{layout} to process itself. 
585         This also produces the execution of the boxes connected to it (the slider, the text).
586
587 \item{In the Help part}
588
589         You can see the graphical representation of the workflow (pipeline) created by the script, 
590         as in figure \ref{SmallGraph}.
591
592
593         \begin{figure}[!ht]
594         \caption{Graphical representation of a pipeline}
595         \begin{center}
596         \includegraphics[width=0.7\textwidth]{SmallGraph.png}
597         \end{center}
598         \label{SmallGraph}
599         \end{figure}
600
601         The representation includes 
602         both the graphical interface-related pipeline 
603         (\emph{slider} and \emph{text} are embedded into \emph{layout})
604          and the data processing-related pipeline 
605         (\emph{slider} warns \emph{text} immediately when it's modified, 
606         \emph{slider} passes \emph{text} its output value)\footnote{Yes, we know : all the arrows                       (graphical interface pipeline arrows and data processing arrows) 
607         are blue; using different colors is planned for next release...}.
608  
609         You can get a much more detailled graph, 
610         like in figure  \ref{LargeGraph}, 
611         just clicking on the button 
612         '\texttt{graph (detailled)}' in the toolbar of the \texttt{Command} part. 
613
614  
615         \begin{figure}[!ht]
616         \caption{Detailled graphical representation of a pipeline}
617         \begin{center}
618         \includegraphics[width=0.75\textwidth]{LargeGraph.png}
619         \end{center}
620         \label{LargeGraph}
621         \end{figure} 
622
623 \end{itemize}
624 %\newpage
625
626 % ==============================================
627 \subsection{The Menu}
628 % ==============================================
629
630 At last, let us have a look at \bbStudio menu.(See figure \ref{themenu})
631
632 \begin{figure}[!ht]
633 \caption{The bbStudio menu}
634 \begin{center}
635 \includegraphics[width=0.7\textwidth]{themenu.png}
636 \end{center}
637 \label{themenu}
638 \end{figure}
639
640 \begin {itemize}
641   \item{\texttt{File}}
642      \begin {itemize}
643         \item{\texttt{Open the bbtk configuration file}}
644         \item{\texttt{Quit}}
645      \end {itemize}       
646   \item{\texttt{Tools}}
647      \begin {itemize}
648         \item{\texttt{Create package}}:
649         Provides a graphical interface to help package developers to create a new empty package.
650         \item{\texttt{Create black box}}:
651         Provides a graphical interface to help package developers to create a new empty black box, and add it to an already existing package.   
652         \item{\texttt{Plug Package}}:
653         Incorporates a package into the list of known packages. Updates the html documentation.
654         \item{\texttt{Regenerate package doc}}:
655         If a package has changed (e.g. new boxes) this updates the package html documentation.
656         \item{\texttt{Regenerate boxes list}}:
657         Updates the boxes lists (alphabetical, by package, ...)
658         \item{\texttt{Regenerate all}}:
659         Regenerates all the packages documentations and the boxes lists (may be long...).
660         \item{\texttt{Show last graph}}:
661         Shows the last pipeline graph that was generated
662      \end {itemize}     
663   \item{\texttt{Options}}
664      \begin {itemize}
665         \item{\texttt{Reset before running}}: Before running a script, all the already created boxes are destroyed, 
666         all the already loaded packages are unloaded (this is the recommended option).   
667      \end {itemize}     
668   \item{\texttt{Windows}}
669   User may decide, for any reason of his own, to hide one or more panels:
670      \begin {itemize}
671         \item{\texttt{Show 'Files' panel}}
672         \item{\texttt{Show 'Help' panel}}
673         \item{\texttt{Show 'Command' panel}}
674         \item{\texttt{Show 'Messages' panel}}
675         \item{\texttt{Start Package browser}}: starts the package browser (see \ref{Package_Browser}).
676      \end {itemize}     
677   \item{\texttt{About}}
678      \begin {itemize}
679         \item{\texttt{About}}: Info about \texttt{bbStudio}.       
680      \end {itemize}     
681 \end {itemize}
682
683
684
685
686 % ==========================================
687 % ==========================================
688 % ==========================================
689 % ==========================================
690 \newpage
691 \hrule
692 \section{Writing black box scripts (\bbsns)}
693 \label{Scripting}
694 % ==========================================
695 % ==========================================
696 % ==========================================
697
698 This section introduces how to write down black box scripts (\bbsns) 
699 to create and execute pipelines. 
700
701 % ==========================================
702 \subsection{The commands}
703 % ==========================================
704 In \bbStudio, try typing in the \texttt{Command} area (in what follows, 
705 the commands entered by the user will be preceded by a prompt \textgreater):
706 \begin{verbatim}
707 > help 
708 \end{verbatim}
709
710 you get the list of the commands of the interpreter :
711 \begin{verbatim}
712 Available commands :
713  author
714  category
715  config
716  connect
717  debug
718  define
719  delete
720  description
721  endefine
722  endpackage
723  exec
724  graph
725  help
726  include
727  index
728  input
729  kind
730  load
731  message
732  new
733  newgui
734  output
735  package
736  print
737  quit
738  reset
739  set
740  unload
741 \end{verbatim}
742
743 To get help on a particular command type \texttt{help <command-name>},
744 for example:
745 \begin{verbatim}
746 > help author
747 \end{verbatim}
748
749 gives :
750 \begin{verbatim}
751  usage : author <string>
752   Adds the string <string> to the author information of the black box being defined
753 \end{verbatim}
754
755 The \texttt{help} command has multiple usages. 
756 It is used to get help about almost anything in the interpreter!
757 Type \texttt{'help help'} to get help on the \texttt{help} command itself :
758 \begin{verbatim}
759 > help help
760  usage : 
761          (1) help 
762          (2) help <command name> 
763          (3) help packages [all]
764          (4) help <package name> [all]
765          (5) help <black box type> 
766          (6) help <black box name>
767   Effect :
768          (1) Lists all available commands;
769          (2) Prints help on a particular command; 
770          (3) Lists the packages loaded and their black boxes.
771              Add 'all' to list adaptors; 
772          (4) Prints short help on the black boxes of a package.
773              Add 'all' to include adaptors; 
774          (5) Prints full help on a black box type; 
775          (6) Prints information on the inputs, outputs and connectionns
776              of a black box instance.
777 \end{verbatim}
778
779 %More information about what is a 'box' will be given in the 'Scripting' part of this manual.
780
781
782 % ==========================================
783 \subsection{Creating and executing black boxes}
784 % ==========================================
785
786 At start the interpreter does not know any black box. 
787 If you type \texttt{'help packages'}, which is 
788 the third form of the \texttt{help} command, you get :
789 \begin{verbatim}
790 > help packages
791 user
792   workspace
793 \end{verbatim}
794
795 which means that the interpretor only knows one package 
796 (library of black boxes) called \texttt{user}
797 and which contains a black box called \texttt{workspace}.
798 The \texttt{user} package is an internal package of the interpreter, 
799 which stores user-defined black box types. 
800 At start, it already contains 
801 one box, called \texttt{workspace}.
802 \texttt{workspace} is a special type of black box, 
803 called complex black box, whose purpose is 
804 to store other black boxes. 
805 Any black box you create in \bbStudio is stored 
806 in \texttt{workspace}  
807 (this will be explained in details in sections 
808 \ref{bbi-writing-scripts} and 
809 \ref{bbi-more-on-complex-black-boxes}). 
810
811 If you type \texttt{'help workspace'}, you get :
812 \begin{verbatim}
813 > help workspace
814  Complex Black Box <user::workspace>
815   User's workspace
816   By : bbtk
817   Category(s): complex box;
818   * No inputs
819   * No outputs
820   * No boxes
821 \end{verbatim}
822
823 In the text displayed, 
824 the \texttt{user::} prepended to the name \texttt{workspace} 
825 means that the box \texttt{workspace} 
826 belongs to the \texttt{user} package. 
827 Then comes a description and three lines which 
828 tell that \texttt{workspace} does not have any input 
829 nor output nor boxes yet.
830
831 In order to let the interpreter know of some black boxes, 
832 you must load another package. 
833 The \texttt{std} package is the ``standard'' package, 
834 which contains basic useful black boxes. 
835
836 To load it, type :
837 \begin{verbatim}
838 > include std
839 \end{verbatim}
840
841 Then if you type :
842 \begin{verbatim}
843 > help packages
844 \end{verbatim}
845
846 you get something like :
847
848 \begin{verbatim}
849
850  std
851    ASCII                   : ascii codes sequence to string - string to ascii...
852    Add                     : Adds its inputs
853    ConcatStrings           : String concatenation
854    Configuration           : Gets configuration informations
855    Div                     : Divides its inputs
856    ExecBbiCommand          : Executes bbi commands
857    ExecSystemCommand       : Executes system (O.S.) commands
858    GetVectorCharElement    : Gets the i-th element from the input vector (std...
859      ...
860    MagicBox                : Takes *any kind* of data and copies it to its ou...
861    MakeFileName            : Makes a kosher file name
862    Mul                     : Multiplies its inputs
863    MultipleInputs          : This box has multiple Void inputs and one Void o...
864    StringRelay             : Just copies the value of its input to its output...
865    StringSelect            : Outputs the string set to the ith input Ini (In0...
866  user
867    workspace 
868 \end{verbatim}
869
870 Now the interpreter knows the package \texttt{std} and the black boxes it provides,
871 such as the \texttt{Add} box, the \texttt{ConcatStrings} box, and so on. Remark that the 
872 content of \texttt{std} may vary from one version to another 
873 as new black boxes might be added to it. 
874 If you type :  
875 \begin{verbatim}
876 > help Add
877 \end{verbatim}
878
879 You'll get a text help, in the 'Message' part :
880 \begin{verbatim}
881 Black Box <std::Add>
882   Adds its inputs
883   By : laurent.guigues@creatis.insa-lyon.fr
884   Categories : atomic box;math;
885   * Inputs : 
886      'BoxExecute'     <bbtk::Void> [signal] : Any signal received by this input 
887                                               executes the box
888      'BoxProcessMode' <String>     []       : Sets the processing mode of the box 
889                                               (Pipeline | Always | Reactive)
890      'In1'            <Double>     []       : First number to add
891      'In2'            <Double>     []       : Second number to add
892   * Outputs : 
893      'BoxChange'      <bbtk::VoidS> [signal] : Signals modifications of the box
894      'Out'            <Double>     []       : Result
895 \end{verbatim}
896
897 After loading the package it belongs to, you can create an \emph{instance} of an \texttt{Add} box by 
898 the command \texttt{new}:
899
900 \begin{verbatim}
901 > new Add a
902 \end{verbatim}
903
904 The \texttt{'a'} at the end is the \emph{name} of the instance, 
905 which will be used to reference it later. 
906 It is important to distinguish a box \emph{type} 
907 and an \emph{instance} of a box type. 
908 The \texttt{Add} box of the package \texttt{std} is actually 
909 a \emph{box type} , like \texttt{int} is a data type 
910 in \texttt{C} langage. The \texttt{new} command allows to create 
911 an instance of a box type, exactly like \texttt{int i;} in 
912 a \texttt{C} code declares a variable of type \texttt{int} whose 
913 name is \texttt{i}. 
914 Of course, like in \texttt{C} Language, you can declare multiple boxes of the 
915 same type in \bbi. \\
916
917 After the creation of the box \texttt{a}, type :
918 \begin{verbatim}
919 > help workspace
920 \end{verbatim}
921
922 you get :
923 \begin{verbatim}
924 Complex Black Box <user::workspace>
925  User's workspace
926  By : bbtk
927  Category(s): complex box;
928  * No inputs
929  * No outputs
930  * Boxes : 
931     'a' <std::Add>
932 \end{verbatim}
933
934 which means that \bbi workspace now contains a black box named \texttt{a},
935 of type \texttt{std::Add}.
936
937
938 Type 
939 \begin{verbatim}
940 Help Add
941 \end{verbatim}
942  and have a look to the 'Help' Part (see figure : \ref{HelpAdd})
943   
944 \begin{figure}[!ht]
945 \caption{\label{HelpAdd}The html Help}
946 \begin{center}
947 \includegraphics[width=0.7\textwidth]{HelpAdd.png}
948 \end{center}
949 \end{figure}
950
951
952 You can see a description 
953 (the one which was provided by the author of the box), 
954 the author(s) of the box (usually e-mail adress(es)) and 
955 the categories to which the box belongs. 
956 Finally comes the lists of inputs and outputs of the box.
957 For each input or output, \bbi provides 
958 its \emph{name} , 
959 its \emph{type} (between \texttt{<} and  \texttt{>}, e.g. \texttt{<Int>})
960 and a description.    
961 Remark that the box \texttt{Add} is not a 'complex' black box 
962 but an 'atomic' box, hence its help does not 
963 include a pipeline graph. 
964
965 You can see that  \texttt{Add} boxes have two inputs, 
966 with name \texttt{In1} and \texttt{In2},
967 and an output, with name \texttt{Out}.
968
969 You can set the input \texttt{In1} 
970 of the \texttt{Add} box \texttt{a} to the value $1$ 
971 by the command :
972 \begin{verbatim}
973 > set a.In1 1 
974 \end{verbatim}
975
976 Similarly, setting the input \texttt{In2} of \texttt{a} to the value $2$
977 is done with :
978 \begin{verbatim}
979 > set a.In2 2
980 \end{verbatim}
981  
982 And you print the output \texttt{Out} of the box \texttt{a} with :
983 \begin{verbatim}
984 > print "result=$a.Out$"
985 result=3
986 \end{verbatim}
987
988 In the string passed to the \texttt{print} command, 
989 each substring enclosed between a couple of \$ is considered 
990 as the name of an output of a box. 
991 To process this special substrings, the interpretor :
992 \begin{enumerate}
993 \item Processes the box if needed (see below)
994 \item Converts the output of the box to a string if possible 
995 (see below)
996 \item Substitutes the result in the string to print
997 \item Postpones an implicit 'new line' character to the string
998 \end{enumerate}
999
1000 %\paragraph
1001
1002 Box processing is needed if :
1003
1004 \begin{itemize}
1005 \item either at least input has changed since last processing 
1006 \item or the input \texttt{'BoxProcessMode'} of the box is set to 
1007 \texttt{'Always'}, which forces box reprocessing. 
1008 \end{itemize}
1009
1010 Note that all boxes have an input named \texttt{'BoxProcessMode'}.
1011
1012 Another way to process the box \texttt{a} is to issue the command :
1013 \begin{verbatim}
1014 > exec a
1015 \end{verbatim}
1016
1017 however this command does not display anything (except if the 
1018 box itself displays something in its processing).
1019 It just processes the box if needed. 
1020 This command is used to execute boxes that do not have any output,  
1021 such as boxes that write something to a file or, display a 
1022 graphical interface, and so on. \newline
1023
1024 %To exit \bbi, type :
1025 %\begin{verbatim}
1026 %> quit
1027 %Good bye !
1028 %\end{verbatim}
1029
1030
1031
1032 % ==========================================
1033 \hrule
1034
1035 \paragraph{Summary}
1036 %\hrule
1037 \begin{itemize}
1038 \item The \texttt{include} command allows to load a package, and the complex black boxes that come with it..
1039 \item \texttt{help} gives help on :
1040 \begin{itemize} 
1041 \item Available commands if you just type \texttt{help}.
1042 \item A particular command if you type \texttt{help <command-name>}.
1043 \item All available packages and their boxes (without description) if you type \texttt{help packages}.
1044 \item A particular package and its boxes (with brief description) if you type \texttt{help <package-name>}.
1045 \item A particular black box type (with full description) if you type \texttt{help <box-type-name>}. In particular, \texttt{help workspace} displays information on the content of the \texttt{'workspace'} black box, which stores the boxes created by the user (by \texttt{new}).
1046 \end{itemize}
1047 %\item \texttt{list} displays the list of black box instances created so far (by \texttt{new}).
1048 \item \texttt{new}: creates an instance of a black box. 
1049 \item \texttt{set}: sets the value of an input of a black box. 
1050 \item Under any component of  \bbStudions, to reference the input called \texttt{i} 
1051 of a black box called \texttt{b} you must type \texttt{'b.i'}. 
1052 The same syntax holds for outputs.
1053 \item \texttt{print}: prints a string, substituting each substring of the form \$b.o\$ by the value of the output \texttt{o} of the black box \texttt{b}. Note that an
1054 implicit trailing 'new line character' is added at the final string.
1055 \item \texttt{exec}: runs, if needed, the process of a box. 
1056 %\item \texttt{quit}: quits \bbi.
1057 \end{itemize}
1058 \hrule
1059
1060 %\paragraph{Note :}
1061 %A more 'modern' way to proceed is to run \texttt{bbStudio}, drag and drop the  \texttt{Command} bookmark to the lower \texttt{Welcome to bbStudio!} bar.
1062 %Wou'll get something like in figure \ref{bbCommandPlusHelp}:
1063
1064 %\begin{figure}[!ht]
1065 %\caption{\label{bbCommandPlusHelp}
1066 %An other way to run the command interpreter}
1067 %\begin{center}
1068 %\includegraphics[width=0.5\textwidth]{bbCommandPlusHelp.png}
1069 %\end{center}
1070 %\end{figure}
1071
1072 % ==========================================
1073
1074 % ==========================================
1075 \subsection{Connecting black boxes}
1076 \label{bbi-connecting-black-boxes}
1077 % ==========================================
1078
1079 \BBTK allows to create 
1080 and execute processing chains, 
1081 also called \emph{pipelines}, 
1082 by connecting black boxes.
1083 This section explains how to do it with examples. 
1084 Read section \ref{bbi-more-on-pipeline-processing} to get 
1085 more information on pipeline processing.
1086
1087 First start \bbStudio and load the package \texttt{std}, typing :
1088 \begin{verbatim}
1089 > include std
1090 \end{verbatim}
1091 in the 'Command' part.
1092
1093 Assume you want to compute $1+2+3$. You can do it by 
1094 chaining two \texttt{Add} boxes, as shown in figure 
1095 \ref{bbi-fig-connecting-black-boxes-1}. 
1096
1097 \begin{figure}[!ht]
1098 \caption{\label{bbi-fig-connecting-black-boxes-1} A simple pipeline which adds 3 numbers}
1099 \begin{center}
1100 \includegraphics[width=0.5\textwidth]{1plus2plus3.png}
1101 \end{center}
1102 \end{figure}
1103
1104
1105 The \bbi instructions to create and execute this pipeline are :
1106 \begin{verbatim}
1107 > new Add a
1108 > new Add b
1109 > connect a.Out b.In1
1110 > set a.In1 1
1111 > set a.In2 2
1112 > set b.In2 3
1113 > print $b.Out$
1114 \end{verbatim}
1115
1116 You will see the (very expected) result :
1117 \begin{verbatim}
1118 6
1119 \end{verbatim}
1120
1121 The first three commands build the pipeline, 
1122 the next three set \texttt{a} and \texttt{b} black boxes inputs and the last one 
1123 prints \texttt{b} black box output (the pipeline is executed before printing, because the interpretor 'knows' the box  \texttt{b}, 
1124 whose output is requested, is not up to date).
1125  
1126 The command \texttt{'connect a.Out b.In1'} ``plugs'' the output 
1127 \texttt{Out} of the box \texttt{a} into the input \texttt{In1} of the 
1128 box \texttt{b}. 
1129 Once the boxes are connected, the processing of the two boxes are chained :
1130 getting the output of \texttt{b} requires getting its inputs, 
1131 hence getting the output of \texttt{a} which is connected to it. 
1132 This pipeline mechanism can recurse into arbitrary long 
1133 chains of boxes (see \ref{bbi-more-on-pipeline-processing} 
1134 for details).
1135
1136
1137 Lets' consider an other, more image oriented, example :
1138
1139 \begin{verbatim}
1140 > include vtk
1141 > include wx
1142 > include itk
1143 > include wxvtk
1144
1145 > new FileSelector fileDialog
1146 > new ImageReader  reader 
1147 > new Slider       slider
1148 > new Viewer2D     viewer
1149
1150 > connect fileDialog.Out   reader.In 
1151 > connect reader.Out       viewer.In
1152 > connect slider.Out       viewer.Slice
1153 > connect slider.BoxChange viewer.BoxExecute
1154
1155 > exec viewer
1156 \end{verbatim}
1157
1158 Some explainations : the \texttt{include} instructions load the necessary packages. \\
1159
1160 \texttt{FileSelector} will pop a File Selector, at run time, that will out the user chosen file name. \\
1161 \texttt{Slider} will pop a Slider, at run time, that will out an integer, used later as a slice number.\\ 
1162 \texttt{ImageReader} will read any itk readable file, whose name is passed as a std::string, and return a pointer on an itk image.\\
1163 \texttt{Viewer2D} displays a plane, whose number is specified by an integer.\\
1164 \\
1165 \texttt{connect fileDialog.Out   reader.In} plugs the output of the File Selector (a std::string) to the input of the reader (a std::string, too).\\
1166 \texttt{connect reader.Out       viewer.In} plugs the output of the reader (an bbtk::any<bbitk::ImagePointer> which is a type defined by the
1167 itk package which can hold any itk image pointer) to the input of the Viewer (a vtkImageData *)\\
1168 \texttt{connect slider.Out       viewer.Slice} plugs the output of the slider (an int) to an other output (named Slide) of the viewer.\\
1169 \texttt{connect slider.BoxChange viewer.BoxExecute} says the viewer that it must re process itself any time the slider is modified.\\
1170 \\
1171 \texttt{exec viewer} processes the viewer.
1172
1173
1174 This would correspond to the graph in figure \ref{bbi-simplegraph}
1175
1176
1177 \begin{figure}[!ht]
1178 \caption{\label{bbi-simplegraph}(Very) simple Graph of a (very) simple pipeline}
1179 \begin{center}
1180 \includegraphics[width=0.8\textwidth]{bbi-simplegraph.png}
1181 \end{center}
1182 \end{figure}
1183    
1184 Of course, to be able to connect two boxes, 
1185 the output and the input must be compatibles. 
1186 You can always connect an output to an input of the \emph{same} type, 
1187 but you can do more, thanks to particular (hidden) black boxes called {\bf adaptors}.
1188
1189 An adaptor is a black box which has at least one input, called \texttt{In}, 
1190 and at least one ouput called \texttt{Out} and whose role is to convert 
1191 a data of the type of \texttt{In} 
1192 into a data of the type of \texttt{Out} (other inputs or outputs may serve 
1193 to parameter the adaptor or retreive other useful information).
1194
1195 Under \bbStudions, if you type :
1196 \begin{verbatim}
1197 > load std
1198 > help std all
1199 \end{verbatim}
1200 you get :
1201 \begin{verbatim}
1202  Package std v1.0.0 - laurent.guigues@creatis.insa-lyon.fr
1203  Basic useful black boxes
1204  Black boxes : 
1205       ...
1206    BoolToString        [DA]  : Converts a Bool (bool) into a string
1207    CastBoolToChar      [DA]  : Static cast from Bool (bool) to Char (signed c...
1208    CastBoolToDouble    [DA]  : Static cast from Bool (bool) to Double (double...
1209       ...
1210    CastBoolToUChar     [DA]  : Static cast from Bool (bool) to UChar (unsigne...
1211    CastBoolToUInt      [DA]  : Static cast from Bool (bool) to UInt (unsigned...
1212       ...
1213    CastUIntToBool      [DA]  : Static cast from UInt (unsigned int) to Bool (...
1214    CastUIntToChar      [DA]  : Static cast from UInt (unsigned int) to Char (...
1215    CastUIntToDouble    [DA]  : Static cast from UInt (unsigned int) to Double...
1216       ...      
1217
1218 \end{verbatim}
1219
1220 \texttt{[DA]}  stands for \emph{default adaptor}.
1221
1222 Once you have loaded the package \texttt{std}, you can 
1223 plug an output of type \texttt{char} into an input of type \texttt{double}. 
1224 When the interpreter encounters the \texttt{connect} command, 
1225 it looks for an adequate \emph{adaptor} in the  loaded packages. 
1226 In our case, as the package \texttt{std} provides the 
1227 \texttt{CastUCharToDouble} adaptor, the interpreter automatically creates an 
1228 instance of this adaptor and place it \emph{between} 
1229 the output and the input you want to connect 
1230 (however this adaptor is hidden to you, 
1231 it is embedded into the created connection and does not appear 
1232 as an existing black box). 
1233 When the pipeline is processed the 
1234 adaptor converts the output data into the required input type, 
1235 in a totally transparent way.
1236 In our example, the \texttt{CastUCharToDouble} adaptor 
1237 would simply cast the value of the \texttt{char} into a \texttt{double}, 
1238 however arbitrarily complex type conversion may be done.\\
1239 \texttt{WARNING}: these adaptors are \texttt{C++ static cast}, i.e., there is, right now,
1240  no 'intelligent' conversion (only truncation) e.g. think to \texttt{CastDoubleToUChar}!
1241
1242 %\begin{verbatim}
1243 %Question (for info-dev): 
1244 %if two adaptors with the same input and output types exist 
1245 %in two different packages, currenly loaded, 
1246 %which one is chosen by the interpreter at connection time?
1247 %A feature is missing to specify explicitely which one user wants to choose 
1248 %(use a namespace notation ?)
1249
1250 %-> Role of default adaptors
1251 %\end{verbatim}
1252
1253 Note that the \texttt{set} and \texttt{print} commands of interpreter 
1254 work with adaptors from \texttt{string} to the type of the input to set 
1255 or from the type of the output to print to \texttt{string}. 
1256 Hence in order to \texttt{set} or \texttt{print} values the adequate 
1257 adaptors must be available in the packages currently loaded. \\
1258
1259
1260 % ==========================================
1261 \hrule
1262 \paragraph{Summary}
1263 %\hrule
1264 \begin{itemize}
1265 \item The \texttt{connect} command allows to connect two black boxes
1266 \item You can connect two black boxes if (and only if): 
1267 \begin{itemize}
1268 \item The output and the input are of the same type, or
1269 \item There is an adaptor black box in the packages loaded which 
1270 converts data of the output type into data of the input type
1271 \end{itemize}
1272 \item \texttt{help <package name>} does not display the adaptors of the package. To see them use : \texttt{help <package name> all}.
1273 including adaptors
1274 \end{itemize}
1275 \hrule
1276 % ==========================================
1277
1278 % ==========================================
1279 \subsection{Creating complex black boxes}
1280 \label{bbi-complex-black-boxes}
1281 % ==========================================
1282
1283 Remember the pipeline of figure 
1284 \ref{bbi-fig-connecting-black-boxes-1}, which 
1285 computed the sum of three doubles.
1286 You can consider it as a whole and define 
1287 a new black box type, which will be a \emph{complex black box}, 
1288 having three inputs and one output, 
1289 as shown in figure \ref{bbi-fig-complex-black-box-1}.
1290
1291 \begin{figure}[!ht]
1292 \caption{\label{bbi-fig-complex-black-box-1} Creating the complex black box \texttt{Add3}}
1293 \begin{center}
1294 \includegraphics[width=0.5\textwidth]{Add3.png}
1295 \end{center}
1296 \end{figure}
1297
1298 The \bbi commands to define this complex black box are 
1299 the following :
1300
1301 \begin{verbatim}
1302 > load std
1303 >
1304 > define Add3
1305 >
1306 > new Add a
1307 > new Add b
1308 > connect a.Out b.In1
1309 >
1310 > author "myself"
1311 > description "adds 3 doubles"
1312 > input x a.In1 "first double to add"
1313 > input y a.In2 "second double to add"
1314 > input z b.In2 "third double to add"
1315 > output result b.Out "output"
1316 >
1317 > endefine
1318 \end{verbatim}
1319
1320 Explainations :
1321
1322 As we will use \texttt{Add} boxes, we need to load the package \texttt{std}, which is done in first line.
1323
1324 The command \texttt{define} then starts the definition 
1325 of the complex box type, which will be called \texttt{Add3}. 
1326
1327 The next three lines define the pipeline, 
1328 exactly in the same way than outside a complex box definition. 
1329
1330 The commands \texttt{author}, \texttt{description}, \texttt{input} 
1331 and \texttt{output} are commands specific to complex boxes definition :
1332
1333 \texttt{author} and \texttt{description} are used for the documentation 
1334 of the new box. You can provide multiple \texttt{author} or 
1335 \texttt{description} commands, the arguments of the commands will 
1336 be concatenated to produce the final author and description strings.
1337
1338 \texttt{input} and \texttt{output} are used to define the inputs and outputs 
1339 of the new complex box. 
1340 Their syntax is the same : for each new input/output you need to say 
1341 to which internal input/output it corresponds and to provide 
1342 a help string documenting the input/output.
1343 In our example, we define that the box \texttt{Add3} has 
1344 three inputs : \texttt{x}, \texttt{y} and \texttt{z}. 
1345 The input \texttt{x} corresponds to the input \texttt{In1} of the 
1346 internal box \texttt{a}. 
1347 In the same way, the external input \texttt{y} 
1348 corresponds to the internal input \texttt{a.In2}, and 
1349 the external input \texttt{In3} to \texttt{b.In2}. 
1350 The only output of the new box is called \texttt{result}
1351 and corresponds to \texttt{b.Out}. 
1352 The figure \ref{bbi-fig-complex-black-box-1} 
1353 illustrates the external to internal 
1354 input/output correspondence.
1355
1356 Finally, the \texttt{endefine} command ends the definition of the 
1357 new box type.
1358
1359 After this definition, if you ask for help 
1360 on packages, you get :
1361 \begin{verbatim}
1362 > help packages
1363 std
1364   Add
1365   ...
1366 user
1367   Add3
1368   workspace
1369 \end{verbatim}
1370
1371 The \texttt{user} package now contains a new black box type, called 
1372 \texttt{Add3}. If you ask for help on this type of box, you get :
1373 \begin{verbatim}
1374 > help Add3
1375 Complex Black Box <user::Add3>
1376  adds 3 doubles
1377  By : myself
1378  * Inputs : 
1379     'x'      <double> : first double to add
1380     'y'      <double> : second double to add
1381     'z'      <double> : third double to add
1382  * Outputs : 
1383     'result' <double> : output
1384  * Boxes : 
1385     'a' <std::Add>
1386     'b' <std::Add>
1387 \end{verbatim}
1388
1389 and you can use it like any other box, for example type :
1390
1391 \begin{verbatim}
1392 > new Add3 a
1393 > set a.x 1
1394 > set a.y 2
1395 > set a.z 3
1396 > print $a.result$
1397 6
1398 \end{verbatim}
1399
1400
1401 As a side note, we can say that, for consistency reasons, it would have been better to name  
1402 \texttt{In1}, \texttt{In2} and \texttt{In3} the inputs of the black box \texttt{Add3}, 
1403 since all the 'natural entry' of a box is named \texttt{In}, or \texttt{In}\emph{x} if there are more than one  'natural
1404 entry'
1405 .
1406 \newline
1407 % ==========================================
1408 \hrule
1409 \paragraph{Summary}
1410 %\hrule
1411 \begin{itemize}
1412 \item The \texttt{define/endefine} commands allows to define complex black box types, i.e. types of black boxes made up of other black boxes. 
1413 Inside a \texttt{define/endefine} block :
1414 \begin{itemize}
1415 \item The \texttt{author} and \texttt{description} commands allow to document the new type of box
1416 \item The \texttt{input} and \texttt{output} commands allow to define the inputs and outputs of the new type of box, that is to which inputs and outputs 
1417 of internal boxes they correspond.  
1418 \end{itemize}
1419 \end{itemize}
1420 \hrule
1421 % ==========================================
1422
1423 % ==========================================
1424 \subsection{Writing scripts files}
1425 \label{bbi-writing-scripts}
1426 % ==========================================
1427
1428 Once you have defined a new type of complex box, you 
1429 may like to reuse it. To do this, you can simply 
1430 write the \bbs commands defining the new box 
1431 into a text file and afterwards include that file in \bbins. 
1432 Doing this, you start writing \bbs scripts.
1433 The conventional (and mandatory) extension for such scripts is \texttt{bbs} 
1434 (black box script).
1435 For consistency reasons, you are requested to prepend \texttt{bb} to the name.
1436
1437 For example, the \texttt{Add3} complex box we previously worked on 
1438 can be defined in the \texttt{bbAdd3.bbs} file :
1439
1440 \begin{file}{bbAdd3.bbs}
1441 \begin{verbatim}
1442 # Defines the Add3 black box which adds 3 doubles 
1443 load std
1444
1445 define Add3
1446   # I am the author 
1447   author "myself"
1448   description "adds 3 doubles"
1449   # Pipeline creation
1450   new Add a
1451   new Add b
1452   connect a.Out b.In1
1453   # Inputs definition
1454   input x a.In1 "first double to add
1455   input y a.In2 "second double to add
1456   input z b.In2 "third double to add"
1457   # Output definition
1458   output result b.Out "output"
1459 endefine
1460 \end{verbatim}
1461 \end{file}
1462
1463 Lines starting with a \texttt{\#} character or a \texttt{\//\//} character are ignored, they 
1464 are considered as comments by the interpreter.
1465 To use this file in \bbStudions, click on the \texttt{include} button, and browse your filestore to find the file.
1466
1467 \begin{verbatim}
1468 > include bbAdd3.bbs
1469 > help Add3
1470 Complex Black Box <user::Add3>
1471  adds 3 doubles
1472  By : myself
1473  * Inputs : 
1474     'x'      <double> : first double to add
1475     'y'      <double> : second double to add
1476     'z'      <double> : third double to add
1477  * Outputs : 
1478     'result' <double> : output
1479  * Boxes : 
1480     'a' <std::Add>
1481     'b' <std::Add>
1482 >
1483 and so on ...
1484 \end{verbatim}
1485
1486 If the file has the \texttt{bbs} extension, you can ommit it and just type :
1487 \begin{verbatim}
1488 > include Add3
1489 \end{verbatim}
1490
1491 \subsection{Creating complex black boxes that use complex black boxes}
1492 \label{bbi-complex-complex-black-boxes}
1493
1494
1495 Of course, you can include script files in other script files, 
1496 like in the following example :
1497
1498 \begin{file}{bbAdd4.bbs}
1499 \begin{verbatim}
1500 # Defines the Add4 black box which adds 4 doubles 
1501 include Add3
1502
1503 define Add4
1504   author "myself"
1505   description "adds 4 doubles"
1506   new Add3 a
1507   new Add b
1508   connect a.Out b.In1
1509   input In1 a.In1 "first double to add
1510   input In2 a.In2 "second double to add
1511   input In3 a.In3 "third double to add"
1512   input In4 b.In2 "fourth double to add"
1513   output Out b.Out "output"
1514 endefine
1515 \end{verbatim}
1516 \end{file}
1517
1518
1519 The inner boxes have they own entries (In1, In2, In3 for box a, In1, In2 for box b )\\
1520 Only the inputs In1, In2, In3 of box a and the input In2 of box b is of interest for the end user, but he dosn't want to have to
1521 care neither about the inner boxes name, nor about the names of their Inputs.\\
1522 The writer of the complex box has the ability to give these inputs a meaningfull name !
1523 \begin{verbatim}
1524   input In3 a.In3 "third double to add"
1525   input In4 b.In2 "fourth double to add"
1526 \end{verbatim}
1527
1528
1529 \subsection{Naming Conventions}
1530 \label{bbi-Naming Conventions}
1531
1532
1533 % ==========================================
1534 %\hrule
1535 %\paragraph{Naming Conventions}
1536 %\hrule
1537
1538 %\hrule
1539 % ==========================================
1540 \begin{itemize}
1541 \item
1542 File names : 
1543 For consistency reasons, you are requested to prepend \texttt{bb}, and postpone an extention \texttt{.bbs},
1544 to the names of the files that hold a \texttt{complex black box} definition.
1545
1546 For example, the \texttt{Add3} complex box we previously worked on 
1547 can be defined in the \texttt{bbAdd3.bbs} file.
1548 \item
1549 Search Paths :
1550 For consistency reasons, the names of dynamic libraries holding the packages start by \texttt{bb}.
1551 For instance, the package \texttt{wx} will be in the library \texttt{bbwx.dll} (Windows) or \texttt{libbbwx.so}
1552 (Linux).
1553
1554
1555 \end{itemize}
1556 % ==========================================
1557 \hrule
1558
1559 \paragraph{Summary}
1560 %\hrule
1561 \begin{itemize}
1562 \item The \texttt{include} command tells the interpreter to include a script file.
1563 \item Lines starting with a \texttt{\#} or with a \texttt{\//\//} are considered as comments by the interpreter.
1564 \item Lines between a line starting with a \texttt{\//*} an a line ending with a \texttt{*\//} are considered as comments by the interpreter.
1565 \end{itemize}
1566
1567 \hrule
1568 % ==========================================
1569
1570 % ==========================================
1571 \subsection{Creating command line applications}
1572 \label{bbi-command-line-app}
1573 % ==========================================
1574
1575 Now that you know how to create complex black boxes 
1576 (with \texttt{define/endefine}), think 
1577 back to the \texttt{workspace} object. 
1578 Remember that it is also 
1579 a \texttt{complex black box}. 
1580 Actually, when you type interpreter commands 
1581 outside a \texttt{define/endefine} block, 
1582 you progressively define the \texttt{workspace} 
1583 complex black box.
1584 You can think of it like if at start the interpreter
1585 was issuing a command \texttt{'define workspace'} 
1586 and then letting you define the interior of the box 
1587 \texttt{workspace}.
1588
1589 Remember that the command \texttt{inputs} 
1590 allows to define an input of a complex box. 
1591 Now, if you use the command \texttt{input} 
1592 outside a \texttt{define/endefine} block then 
1593 it defines an input of the \texttt{workspace} box, 
1594 that is an input of the \emph{main program}. 
1595 This input will then be connected to the 
1596 parameters that the user passes to the command line.
1597
1598 For example, consider the script : 
1599
1600 \begin{file}{add.bbs}
1601 \begin{verbatim}
1602 load std
1603 new Add a
1604 input x a.In1 "first number to add"
1605 input y a.In2 "second number to add"
1606 print "x+y=$a.Out$"
1607 \end{verbatim}
1608 \end{file}
1609
1610 The third and fourth lines define two inputs \texttt{x} 
1611 and \texttt{y}. When you execute this script, 
1612 you can pass these two arguments on the command line, 
1613 like this :
1614
1615 \begin{verbatim}
1616 > bbi add x=1 y=1
1617 x+y=2
1618 \end{verbatim}
1619
1620 You can also invoke \bbi the option \texttt{-h}, 
1621 which gives help on the \texttt{workspace} box :
1622
1623 \begin{verbatim}
1624 > bbi add -h
1625  User's workspace
1626  By : bbi (internal)
1627  * Inputs : 
1628     'x' <double> : first number to add
1629     'y' <double> : second number to add
1630 \end{verbatim}
1631
1632 To get a better help, use the \texttt{description} 
1633 and \texttt{author} commands :
1634
1635 \begin{file}{add.bbs}
1636 \begin{verbatim}
1637 description "Adds two numbers"
1638 author "foo@bar.com"
1639 load std
1640 new Add a
1641 input x a.In1 "first number to add"
1642 input y a.In2 "second number to add"
1643 print "x+y=$a.Out$"
1644 \end{verbatim}
1645 \end{file}
1646
1647 Now if you ask for help on the \texttt{add} script, you get :
1648
1649 \begin{verbatim}
1650 > bbi add -h
1651  Adds two numbers
1652  By : foo@bar.com
1653  * Inputs : 
1654     'x' <double> : first number to add
1655     'y' <double> : second number to add
1656 \end{verbatim}
1657
1658 Rather than getting the inputs of a script 
1659 from the command line, you can ask \bbi to 
1660 prompt the user for the values, using the \texttt{-t}
1661 commutator :
1662
1663 \begin{verbatim}
1664 > bbi add -t
1665 x=[the program waits for user answer]2
1666 y=[the program waits for user answer]5
1667 x+y=7
1668 \end{verbatim}
1669
1670 You can also use the \texttt{-g} commutator. 
1671 \bbi then prompts the user in graphical mode, 
1672 displaying a dialog box for each input,
1673 like in fig. \ref{bb-input-dialog-box}.
1674
1675 \begin{figure}[!ht]
1676 \caption{\label{bb-input-dialog-box}Input dialog box}
1677 \begin{center}
1678 \includegraphics[width=0.6\textwidth]{enter-the-value-of-x.png}
1679 \end{center}
1680 \end{figure}
1681
1682 Note that for both \texttt{-t} and \texttt{-g} options, 
1683 the input from the user is a \texttt{string} and 
1684 \bbi converts it to the right input type using 
1685 an \texttt{adaptor}, hence the right adaptors must be loaded.
1686
1687 % ==========================================
1688 \hrule
1689 \paragraph{Summary}
1690 %\hrule
1691 \begin{itemize}
1692 \item The \texttt{input}, \texttt{description} and \texttt{author} commands,
1693 when they are used outside a \texttt{define/endefine} block allow 
1694 to define the inputs, description and author of the main program.
1695 \item Inputs of the main program can be passed on the command line 
1696 using the syntax \texttt{<input-name>=<value>}. 
1697 No white space is allowed, if the value or the input name 
1698 contains white spaces, enclose them 
1699 between double quotes, e.g. \texttt{"parameter with white spaces = gnu's not unix"}.
1700 \item The \texttt{-h} option of \bbi prints help on the main program.
1701 \item The \texttt{-t} option of \bbi orders the program to prompt for its inputs in text mode.
1702 \item The \texttt{-g} option of \bbi orders the program to prompt for its inputs in graphical mode.
1703 \end{itemize}
1704 \hrule
1705 % ==========================================
1706
1707 % ==========================================
1708 \subsection{Using graphical interface boxes (widget boxes)}
1709 \label{bbi-widget}
1710 % ==========================================
1711
1712 % ==========================================
1713 %\subsubsection{Overview}
1714 %\label{bbi-overview}
1715 % ==========================================
1716
1717 Basic graphical interface components are provided in the package \texttt{wx}, 
1718 such as buttons, sliders, file open/save dialogs, etc.
1719
1720 As first example, type the following commands in \bbi :
1721 \begin{verbatim}
1722 > load wx 
1723 > new InputText t
1724 > print $t.Out$\n
1725 \end{verbatim}
1726
1727 When you type \texttt{enter} after the last line, 
1728 a window pops up in which you can entrer a text.
1729 When you close the window, the text you entered is printed by 
1730 the \texttt{print} command.
1731
1732 Type \texttt{help wx}, you get something like :
1733 \begin{verbatim}
1734  Package wx v1.0.0- info-dev@creatis.insa-lyon.fr
1735  Basic graphical interface elements (sliders, buttons ...) based on wxWidgets
1736  Black boxes : 
1737    ColourSelector        : Colour Selector dialog (bbfication of wxColourSele...
1738    ColourSelectorButton  : A button which displays a colour picker dialog whe...
1739    CommandButton         : Button which executes bbi commands
1740    DirectorySelector     : Pops up a directory selection dialog (wxDirDialog)
1741    FileSelector          : Pops up a file selection dialog for reading or sav...
1742    InputText             : A zone in which the user can enter a text (wxTextC...
1743    LayoutLine            : LayoutLine widget (wxBoxSizer)
1744    LayoutSplit           : Widget which splits a window in two fixed size par...
1745    LayoutTab             : LayoutTab widget (wxNotebook)
1746    OutputText            : Text zone to be inserted into a window (wxStaticTe...
1747    RadioButton           : RadioButton group widget 0-9 entries
1748    Slider                : Slider widget (wxSlider)
1749 \end{verbatim}
1750
1751 You can reproduce the same experiment as above using a 
1752 \texttt{Slider} or a \texttt{FileDialog} rather than a \texttt{InputText}..
1753
1754
1755 %There are two kinds of widgets : ``terminal'' widgets and ``container'' widgets.
1756 %The \texttt{InputText}, \texttt{FileDialog} or \texttt{Slider} widgets 
1757 %are ``terminal'' widgets. 
1758 %``container'' widgets are of another kind : they are 
1759 % ==========================================
1760 %\subsubsection{Layout widgets}
1761 %\label{bbi-layout-widgets}
1762 % ==========================================
1763
1764 There is a special kind of widget, called '\texttt{Layout}', designed to  
1765 contain other widgets in order to build larger dialog boxes. 
1766
1767 For example, the \texttt{LayoutSplit} widget is a container which 
1768 ``splits'' a window into two parts, either horizontally or vertically, 
1769 each part including another widget. 
1770 The initial size of the two parts can be fixed by the input 'Proportion' 
1771 and be adjusted by the user thanks to a ``handle''.
1772
1773 The example \texttt{exampleLayoutSplit} demonstrates its use. 
1774 Run it : it displays a window with two sliders. 
1775 Move the sliders and close the window. 
1776 Now look at the source file to see how this is done :
1777
1778 \begin{file}{scripts/test/testSplit.bbs}
1779 \begin{verbatim}
1780 load wx
1781
1782 new Slider s1
1783 new Slider s2
1784
1785 new LayoutSplit s
1786 connect  s1.Widget s.Widget1
1787 connect  s2.Widget s.Widget2
1788
1789 exec s
1790 \end{verbatim}
1791 \end{file}
1792
1793 First, the two sliders \texttt{s1} and \texttt{s2} are created.
1794 A \texttt{LayoutSplit} box \texttt{s} is also created. 
1795 The \texttt{connect} commands then ``includes'' the sliders in the 
1796 split widget. 
1797 The input \texttt{Widget} is common to all widget boxes : 
1798 every widget can be inserted into another widget. 
1799 The outputs \texttt{Widget1},\texttt{Widget2}  are specific of \emph{layout} 
1800 widgets 
1801 (in \bbi type \texttt{help Slider}: 
1802 you will see the output \texttt{Widget}; 
1803 type \texttt{help LayoutSplit}: 
1804 you will see the inputs \texttt{Widget1} and \texttt{Widget2} 
1805 and the output \texttt{Widget}). 
1806 When you connect the \texttt{Widget} output of a box  
1807 to the \texttt{Widget}i input of a layout widget, 
1808 you order to include the widget in the layout.
1809 Of course, the order of connection is important. 
1810 In our case, the slider \texttt{s1} is included first, 
1811 then the slider \texttt{s2}: \texttt{s1} will be placed 
1812 on top of \texttt{s2} (the \texttt{LayoutSplit} box is 
1813 implemented that way, but this is arbitrary choice).
1814
1815 Right now, there are only \emph{three} layout widgets in the \texttt{wx} package : 
1816 \begin{itemize} 
1817 \item {the \texttt{LayoutSplit} widget} we just described
1818
1819 \item {the \texttt{LayoutLine} widget} can have multiple children 
1820 (\texttt{Widget1}, \texttt{Widget2},\dots \texttt{Widget9} inputs) and 
1821 divides its window into as much parts as children, 
1822 each part of equal size. 
1823 The orientation of the \texttt{LayoutSplit} or of the \texttt{LayoutLine}  can be changed by the input \texttt{Orientation}.
1824 With only those two layout widgets you can already create 
1825 complex dialog boxes 
1826 (of course layouts can be nested, which leads to tree-like 
1827 structures of widgets). \\
1828 See the script \texttt{exampleComplexLayoutSplit\_In\_LayoutSplit} for an example.
1829
1830 \item {The \texttt{LayoutTab}  widget} arranges its children 
1831 in different pages or 'tabs' (\texttt{wxNotebook}-based).
1832 The label of each page is the name of the widget it contains.
1833
1834 \end{itemize}
1835
1836
1837 %=====> TODO \\
1838
1839
1840 %One word about a special widget in the package \texttt{wx}: 
1841 %the \texttt{Button}... to be continued.
1842
1843 % ==========================================
1844 \subsection{Deeper in the boxes}
1845 \label{bbi-deep-box}
1846 % ==========================================
1847
1848 \subsubsection{Default and mandatory inputs and outputs}
1849 \begin{itemize}
1850 \item Any \texttt{atomic} black box has two default Inputs, which are created by the system :
1851 \begin{itemize}
1852   \item {\bf\emph{BoxExecute}}    : Any signal received by this input executes the box
1853   \item {\bf\emph{BoxProcessMode}}: Sets the processing mode of the box :
1854   \begin{itemize}
1855     \item {\bf\emph{Pipeline}}:% bbBackwardUpdate() calls Process() only if Status == MODIFIED \\
1856                                  The box executes itself only when an input was changed (normal pipeline processing).
1857     \item {\bf\emph{Reactive}}: %bbSetModifiedStatus() calls bbUpdate() \\
1858                                  Re-processes immediately when \emph{any input} changes.\\
1859                                  To be more selective, better use 
1860         '\texttt{connect A.BoxChange B.BoxExecute}'.    
1861     \item {\bf\emph{Always}}  :% bbUpdate() always calls Process. \\
1862                                  Usefull for 'sources', that must be processed, even when no input changed (e.g.: FileSelector, ColorSelector)\\
1863                                  This one is not end user intended (for Package developer only)
1864   \end{itemize}   
1865 \end{itemize}
1866 \item And one default output :
1867 \begin{itemize}
1868   \item {\bf\emph{BoxChange}} : Signals any modification of the box. This output may be connected if necessary to the \emph{BoxExecute} 
1869   input of an other box : each time the boxes changes (e.g. a Slider is moved) the box it is connected to will be forced to update.
1870 \end{itemize}
1871
1872 If you create complex boxes, it is a good idea to define those inputs and outputs to be able 
1873 to force the execution of your complex box or be aware of its changes...
1874
1875 \item Any {\bf widget} box has five Inputs, that will be dealt with only if the box is not connected to the \emph{Widget}i of any \emph{Layout} box :  
1876 \begin{itemize}
1877   \item {\bf\emph{WinHeight}}: Height of the window 
1878   \item {\bf\emph{WinWidth}} : Width of the window  
1879   \item {\bf\emph{WinTitle}} : Title of the window
1880   \item {\bf\emph{WinClose}} : Any received signal closes the window
1881   \item {\bf\emph{WinHide}}  : Any received signal hides the window
1882   \item {\bf\emph{WinDialog}}: When set to 'true', creates a \emph{dialog window}, that blocks the pipeline until it is closed (\emph{modal})   
1883 \end{itemize}
1884
1885 If you define a complex widget box, it is a good idea to define these inputs to be able 
1886 to customize your window settings.
1887
1888 \item Any {\bf widget} box has one mandatory Output :
1889
1890 \begin{itemize}
1891   \item {\bf\emph{Widget}}: that is the \texttt{wxWindow} itself. If it's not connected to the \texttt{Widget}\emph{i} of any \emph{Layout box}, then the box  will create its own window (frame or dialog) on execution. If it's connected to the \texttt{Widget}\texttt{\emph{i}} of a \texttt{Layout box}, 
1892      it will be embedded in its parent window.
1893 \end{itemize}    
1894
1895 If you define a complex widget box, it is a good idea to use this standard name for your window output
1896
1897 \item Any {\bf Layout} box (i.e. \emph{LayoutLine}, \emph{LayoutSplit} or \emph{LayoutTab}) has one or more mandatory Inputs :
1898 \begin{itemize}
1899   \item {\bf\emph{Widget}}\texttt{i}: e.g. a \emph{LayoutSplit} box (Widget which splits a window in two resizeable parts) 
1900        has two Input parameters \emph{Widget1} and \emph{Widget2}, used to embed the child windows.\\
1901        e.g. a  \emph{LayoutLine} divides the window in up to 9 (depending on the number of inputs \emph{Widget}i) fixed size parts.  
1902 \end{itemize} 
1903
1904 If you define a complex layout box, it is a good idea to use these standard names for your 
1905 sub-windows inputs.
1906
1907 \end{itemize}
1908
1909
1910 % ==========================================
1911 %\subsection{More on ...}
1912 %\label{bbi-more-on}
1913 % ==========================================
1914
1915 % ==========================================
1916 %\subsubsection{Black box packages}
1917 %\label{bbi-more-on-packages}
1918 % ==========================================
1919 %There are various others user-intended packages :
1920
1921 %\begin{verbatim}
1922 %---> Were moved in a 'Reference Manual' ?\\
1923 %---> Any suggestion welcome!
1924 %\end{verbatim}
1925
1926 %\begin{itemize}
1927 %\item{vtk} \\
1928 %\item{itk} \\
1929 %\item{...} \\
1930 %\end{itemize}
1931 % ==========================================
1932 %\subsubsection{Pipeline processing}
1933 %\label{bbi-more-on-pipeline-processing}
1934 % ==========================================
1935 %\begin{itemize}
1936 %\item the ``control'' mechanism in bbi.
1937
1938 %When a box is requested to update itself, it asks (recursively) each one of its inputs if it was modified.\\
1939 %In normal pipe-line mode, it will be re-processed if at least one of its imputs was actually modified, as the output of a previous box.
1940
1941 %(switch exec commands, e.g. Button)
1942 %\item the role of ProcessMode to update widgets.
1943 %\end{itemize}
1944
1945 %\subsubsection{Advanced issues}
1946 %\paragraph{Reducing the number of inputs of a box}
1947
1948 % ==========================================
1949 %\subsubsection{Errors}
1950 %\label{bbi-more-on-errors}
1951
1952 % ==========================================
1953
1954
1955 % ==========================================
1956 %\vspace{0.5cm}
1957 \hrule 
1958 \newpage
1959 \section{Using third party Package}
1960 \label{Third_Party_Package}
1961 % ==========================================
1962 % ==========================================
1963 \subsection{Installing a Package}
1964 \label{Installing_a_Package}
1965
1966 % ==========================================
1967 \subsubsection{Linux users}
1968 \label{Installing_a_Package_for_Linux_users}
1969
1970 After compiling a Package, at install time, think of using :
1971 \begin {verbatim}
1972 su - 
1973 make install
1974 \end{verbatim}
1975
1976 and neither :
1977 \begin {verbatim}
1978 su 
1979 make install
1980 \end{verbatim}
1981
1982 nor :
1983 \begin {verbatim}
1984 sudo make install
1985 \end{verbatim}
1986
1987 otherwise package documentation will not be generated. \\
1988
1989 Think of updating your environment variable LD\_LIBRARY\_PATH (in .bashrc in
1990 you're using bash), to add the path to the shared library
1991 libbb\emph{YourNewPackageName}.so
1992
1993
1994 % ==========================================
1995 \subsubsection{Windows users}
1996 \label{Installing_a_Package_for_Windows_users}
1997 % ==========================================
1998 Think of updating your environment variable LD\_LIBRARY\_PATH to add the path to the dynamic library
1999 bb\emph{YourNewPackageName}.dll
2000
2001 % ==========================================
2002 \subsection{Plugging in a Package}
2003 \label{Plugging_in_a_Package}
2004 % ==========================================
2005
2006 \bbStudio makes it easy for you : in the menu \texttt{Tools} just click on the 
2007 option \texttt{Plug Package}. You will be asked to '\texttt{Select
2008 package directory}'. Browse untill you find the install or the build directory,
2009 depending whether you installed the package or not.
2010
2011 \bbStudio will update the configuration file, generate the 'Package
2012 documentation', and update the 'Boxes Lists'.
2013
2014 You will be able to use the new package just as you did for any other \bbtk
2015 canonical Package.
2016
2017 % ==========================================
2018 \subsection{Hard incorporating of a Package}
2019 \label{Hard_incorporating_of_a_Package}
2020 % ==========================================
2021
2022 If the Package you want to use is supplied in a non standard way (e.g.: you
2023 where given one ore more dynamic libraries (\texttt{.dll} or \texttt{.so}), and/or
2024 one or more directories containing \bbtk scripts (\texttt{.bbs})
2025 you can edit your \bbtk configuration and add the appropriate 
2026 paths, see \ref{The_configuration_file}.
2027
2028 %\end{itemize}
2029 % ==========================================
2030 \subsection{Updating the documentation}
2031 \label{Updating_the_documentation}
2032 % ==========================================
2033 You may add your own boxes (simple boxes, if you are aware enough in \CPP
2034 language, or complex boxes if you are aware enough in bbtk scripting).
2035
2036 To update the html help of this package,
2037 use the option \texttt{Regenerate package doc} 
2038 in the menu \texttt{Tools} of \texttt{bbStudio}.
2039 You'll be prompted for the Package name. 
2040 Avoid using the \texttt{-a} option (Regenerate all), since it's time consumming.
2041
2042 To update html boxes lists with the new boxes,
2043 use the option \texttt{Regenerate Boxes Lists} 
2044 in the menu \texttt{Tools} of \texttt{bbStudio}.
2045
2046 % ==========================================
2047 \subsection{Using the package}
2048 \label{Using_the_package}
2049 % ==========================================
2050
2051 The only thing you have to do is to \texttt{include} or \texttt{load} the package, 
2052 within a script, or from the \texttt{Command} part, 
2053 and enjoy the black boxes it contains.
2054
2055 % ==========================================%\subsection{Packages you'll probably want to use }
2056 %\label{Packages_you_ll_want_to_use}
2057 % ==========================================
2058 %\begin {itemize}
2059 %\item{\texttt{creaLib}} \\
2060 %a.k.a \texttt{crea}. It's a set of 'low level' utilities, needed by other
2061 %packages (an, sure,  useful as well for people that doesn't use bbtkns.
2062 %\item{\texttt{creaContours}} \\
2063 %Provides sophisticated widgets for managing 3D R.O.I. (Regions of interest)
2064 %\item{\texttt{creaImageIO}} \\
2065 %Allows browsing, selectionning, ordering directories containing images of almost any type
2066 %(including DICOM)
2067 %\end {itemize}
2068 %\newpage
2069  
2070 % ==========================================
2071 %\vspace{0.5cm}
2072 \hrule
2073 \newpage
2074 \section{Using black boxes in \CPP programs}
2075 \label{cpp}
2076 % ==========================================
2077
2078 A very useful feature is that you may use any widget 
2079 black box within a \CPP program 
2080 without worrying about writing a \wx main application.\\
2081
2082 Let's look a the following bbs script :
2083
2084 \begin{verbatim}
2085 # Load the packages
2086 load std
2087 load wx
2088
2089 # Create the Objects
2090 new Slider     slider
2091 new OutputText text
2092 new LayoutLine layout
2093
2094 # Graphical pipeline
2095 connect slider.Widget    layout.Widget1
2096 connect text.Widget      layout.Widget2
2097
2098 # Execution pipeline
2099 connect slider.BoxChange text.BoxExecute
2100 connect slider.Out       text.In
2101
2102 # Go!
2103 exec layout
2104 \end{verbatim}
2105
2106 User wants to create a slider and an output text, within a LayoutLine, 
2107 and display the slider value in the output text.
2108 Think about the (little!) nightmare to code the same, in 'raw C++', using wxWidgets.
2109
2110 The following \CPP code does the same :
2111
2112 \begin{verbatim}
2113 #include <bbtkFactory.h>
2114 #include <bbwxSlider.h>
2115 #include <bbwxOutputText.h>
2116 #include <bbwxLayoutLine.h>
2117
2118 int main(int argv, char* argc[])
2119 {
2120   try
2121     {
2122       // we need to intanciate a bbtk::Factory to be aware of the adaptors
2123       bbtk::Factory::Pointer factory = bbtk::Factory::New();
2124       
2125       // Load the packages
2126       // ----------------  
2127       factory->LoadPackage("std");
2128       factory->LoadPackage("wx");
2129       
2130       // Create the Objects
2131       // ------------------      
2132       bbwx::Slider::Pointer     slider   = bbwx::Slider::New("slider");
2133       bbwx::OutputText::Pointer text     = bbwx::OutputText::New("text");
2134       bbwx::LayoutLine::Pointer layout   = bbwx::LayoutLine::New("layout");
2135       
2136       // Graphical pipeline
2137       bbtk::Connection::Pointer c1       = bbtk::Connection::New(slider,"Widget",
2138                                                                  layout,"Widget1");
2139                                                            
2140       bbtk::Connection::Pointer c2       = bbtk::Connection::New(text,"Widget",
2141                                                                  layout,"Widget2");
2142                                                                                                                                                                            
2143       // Execution pipeline
2144       // ------------------
2145       
2146       // We have to pass the 'factory', in order to call automatically an adaptor,
2147       // if necessary.
2148       bbtk::Connection::Pointer s2t      = bbtk::Connection::New(slider,"Out",
2149                                                                  text,"In",
2150                                                                  factory);      
2151       bbtk::Connection::Pointer c3       = bbtk::Connection::New(slider,"BoxChange",
2152                                                                  text,"BoxExecute");      
2153       layout->bbSetInputWinDialog(true);
2154       
2155       // Go!
2156       // ---     
2157       layout->bbExecute();
2158
2159     }
2160   catch (bbtk::Exception e)
2161     {
2162       bbtk::MessageManager::SetMessageLevel("Error",1);
2163       e.Print();
2164     }
2165 }
2166
2167 In this code, we use the headers of the \texttt{bbwx} \CPP library, 
2168 which define the black boxes of the \texttt{wx} package. 
2169
2170 to be continued ...
2171
2172 \end{verbatim}
2173
2174 % ==========================================
2175 \hrule
2176 \newpage
2177 \section{\bbs language reference}
2178 \label{bbi-reference}
2179 % ==========================================
2180
2181 % ==========================================
2182 \subsection{Pipeline creation and execution related commands}
2183 \label{bbi-reference-creation-execution}
2184 % ==========================================
2185 % See table \ref{bbi-reference-box}
2186
2187 % ==========================================
2188 \begin{table}[!ht]
2189 \caption{\label{bbi-reference-box} \bbs pipeline creation and execution related commands.}
2190 \small
2191 \begin{tabular}{|lcm{6cm}|}
2192 \hline
2193 Command & Parameters & Effect \\ \hline
2194
2195 \texttt{new} & \texttt{<box-type>} \texttt{<box-name>}& 
2196 Creates a box of type \texttt{box-type} and name  
2197 \texttt{box-name}.\\ \hline
2198
2199 \texttt{newgui} & \texttt{<box-name>} \texttt{<gui-box-name>} &
2200 Automatically creates a graphical user interface with name \texttt{gui-box-name}
2201 for the black box \texttt{box-name} and connects it to the box inputs\\ \hline 
2202
2203 \texttt{delete} & \texttt{<box-name>} & 
2204 Destroys the box named \texttt{box-name}\\ \hline 
2205
2206 \texttt{connect} & \texttt{<box1.output>} \texttt{<box2.input>} & 
2207 Connects the output 
2208 \texttt{output} of the box named \texttt{box1} 
2209 to the input \texttt{input} of the box named \texttt{box2} \\ \hline 
2210
2211 \texttt{set} & \texttt{<box.input>} \texttt{<value>} &
2212 Sets the input \texttt{input} of 
2213 the box named \texttt{box} to the value \texttt{value}.
2214 An \texttt{adaptor} must exist
2215 in the packages loaded which converts a \texttt{std::string} 
2216 to the type of the input \texttt{input}. \\ \hline 
2217
2218 \texttt{exec} & \texttt{<box-name>} & 
2219 Executes the box named \texttt{box-name}.
2220 If needed the boxes 
2221 connected to its inputs 
2222 are also processed recursively (pipeline processing).\\ \hline 
2223 & \texttt{freeze} & 
2224  Allows to block execution commands while keeping definition commands active (this one is not for end user)\\ \hline 
2225 & \texttt{unfreeze} & 
2226  Turns back to 'normal' mode (this one is not for end user).\\ \hline 
2227 \end{tabular}
2228 \end{table}
2229 % ==========================================
2230
2231 \newpage
2232
2233 % ==========================================
2234 \subsection{Package related commands}
2235 \label{bbi-reference-package}
2236
2237 \begin{table}[!ht]
2238 \caption{\label{tabbbi-reference-interpreter_1}\bbs package related commands. }% (part 1).}
2239 \small
2240 \begin{tabular}{|lcm{6cm}|}
2241 \hline
2242 Command & Parameters & Effect \\ \hline
2243
2244
2245 \texttt{include} & \texttt{<package-name>} & 
2246 Loads the package \texttt{package-name} and includes all its complex box definition scripts. \\ \hline 
2247
2248 \texttt{load} & \texttt{<package-name>} & 
2249 Loads the atomic black boxes of package \texttt{package-name}.
2250 Loads the dynamic library but not the complex boxes defined in the scripts shipped with the package. 
2251 Use it only if you know that you won't work with its complex black boxes \\ \hline 
2252
2253 \texttt{unload} & \texttt{<package-name>}& 
2254 Unloads the package \texttt{package-name}. 
2255 The package must have been previously loaded. 
2256 No box of a type defined in this package must still exist.\\ \hline 
2257
2258 \texttt{reset} & - & Deletes all boxes and unloads all packages so 
2259 that the interpreter gets back to its initial state \\ \hline 
2260
2261
2262 \texttt{package} &  \texttt{<package-name>} &  
2263 All complex black boxes definitions until the next \texttt{endpackage} 
2264 will be stored into the package \texttt{package-name}  \\ \hline 
2265
2266 \texttt{endpackage} & - & 
2267 Closes a \texttt{package} command  \\ \hline 
2268
2269
2270 \end{tabular}
2271 \end{table}
2272 \newpage
2273
2274 % ==========================================
2275 \subsection{Interpreter related commands}
2276 \label{bbi-reference-interpreter}
2277 % ==========================================
2278 %See table \ref{tabbbi-reference-interpreter_1} and \ref{tabbbi-reference-interpreter_2}
2279 % ==========================================
2280 \begin{table}[!ht]
2281 \caption{\label{tabbbi-reference-interpreter_1}\bbs intepreter related commands. }% (part 1).}
2282 \small
2283 \begin{tabular}{|lcm{6cm}|}
2284 \hline
2285 Command & Parameters & Effect \\ \hline
2286
2287
2288 \texttt{help} & - & 
2289 Prints help on available commands \\ \hline 
2290
2291 & \texttt{<command-name>} & 
2292 Prints help on the command \texttt{command-name} \\ \hline 
2293
2294 & \texttt{packages} & 
2295 Prints help on available packages and their box types 
2296 (without description)\\ \hline 
2297
2298 & \texttt{<package-name>} & 
2299 Prints help on the package \texttt{package-name} and its boxes 
2300 (with brief description). 
2301 The package must have been previously loaded \\ \hline 
2302
2303 & \texttt{<box-type>} & 
2304 Prints help (with full description) on the type of box 
2305 \texttt{box-type}. 
2306 The box type must belong to a package which has been previously loaded \\ \hline 
2307
2308 \texttt{message}
2309 & - & 
2310 Prints information on available kinds of messages and their current level\\ \hline 
2311
2312  & \texttt{<kind>} \texttt{<level>} & 
2313 Sets the level of verbosity of the interpreter for the kind of messages 
2314 \texttt{kind} to \texttt{level}.\\ \hline 
2315
2316
2317 \texttt{include} & \texttt{<file-name>} & 
2318 Includes and executes the content of the file named \texttt{file-name} 
2319 exactly like if you were typing its content at the place were the 
2320 \texttt{include} command is. \\ \hline 
2321
2322 \texttt{print} & \texttt{<string>} & 
2323 Prints the string after substituting each token of the form \texttt{\$box.output\$} by the adaptation to string of the value of the 
2324 output \texttt{output} of the box named \texttt{box}. 
2325 An \texttt{adaptor} must exist
2326 in the packages loaded which converts 
2327 the type of the output \texttt{output}
2328 to a \texttt{std::string}.
2329 \\ \hline 
2330
2331 \texttt{graph} & ... & 
2332 Generates the html doc including the pipeline graph for a given complex box \\ \hline
2333
2334 \texttt{index} & ... & 
2335 Generates the html index of currently loaded boxes types \\ \hline
2336
2337 \texttt{config} & - & Displays the configuration parameters\\ \hline 
2338
2339
2340 \texttt{debug} & \texttt{<debug-directive>} & 
2341 [expr|-C|-D] 
2342   Prints debug info on living bbtk objects containing the string \texttt{expr} (default expr=''). 
2343          \texttt{-C} checks the factory integrity.
2344          \texttt{-D} turns on objects debug info after main ends\\ \hline 
2345
2346 \texttt{quit} & - & Exits the interpreter\\ \hline 
2347
2348 \end{tabular}
2349 \end{table}
2350 % ==========================================
2351
2352 \newpage
2353
2354 % ==========================================
2355 \subsection{Complex black box definition related commands}
2356 \label{bbi-reference-black-box-definition}
2357 % ==========================================
2358
2359 %See table \ref{bbi-reference-complex-box} 
2360 % ==========================================
2361 \begin{table}[!ht]
2362 \caption{\label{bbi-reference-complex-box} \bbs complex black box definition related commands.}
2363 \small
2364 \begin{tabular}{|lcm{6cm}|}
2365 \hline
2366 Command & Parameters & Effect \\ \hline
2367
2368
2369 \texttt{define} & \texttt{<box-type>} [\texttt{<package-name>}] & 
2370 Starts the definition of a complex black box of type
2371 \texttt{box-type}. If \texttt{<package-name>} is provided then includes the 
2372 box in the given package (otherwise it is defined in the current package, 
2373 i.e. \texttt{user} if outside a \texttt{package/endpackage} block). \\ \hline 
2374
2375 \texttt{endefine} & - & 
2376 Ends the definition of a complex black box type\\ \hline 
2377
2378 \texttt{author} & \texttt{<string>} & 
2379 Concatenate the string to the author string 
2380 of the current complex black box.\\ \hline 
2381
2382 \texttt{description} & \texttt{<string>} & 
2383 Concatenate the string to the description of the current complex black box. 
2384 \\ \hline 
2385
2386 \texttt{category} & \texttt{<string>} & 
2387 Specifies the \texttt{categories} of the current complex black box. 
2388 The categories must be separated by semicolons, e.g. "\texttt{widget;image}"\\ \hline 
2389
2390 \texttt{kind} & \texttt{<box kind>} & 
2391 Specifies the \texttt{kind} of the current complex black box 
2392 ( ADAPTOR, DEFAULT\_ADAPTOR, WIDGET\_ADAPTOR, DEFAULT\_WIDGET\_ADAPTOR )\\ \hline 
2393
2394 \texttt{input} & \texttt{<name>} \texttt{<box.input>} \texttt{<help>} & 
2395 Defines a new input for the current complex black box, 
2396 named \texttt{name}. 
2397 It is defined as corresponding to 
2398 the input \texttt{input} of the box \texttt{box}.
2399  
2400 \texttt{<help>} is the help string for the new input.
2401 The box \texttt{box} must already have been created in the complex box 
2402 and of course have an input named \texttt{input}.\\ \hline 
2403
2404 \texttt{output} & \texttt{<name>} \texttt{<box.output>} \texttt{<help>} & 
2405 Defines a new output for the current complex black box, 
2406 named \texttt{name}. 
2407 It is defined as corresponding to 
2408 the output \texttt{output} of the box \texttt{box}. 
2409 \texttt{<help>} is the help string for the new output.
2410 The box \texttt{box} must already have been created in the complex box and of course have an output named \texttt{output}. \\ \hline 
2411
2412 \end{tabular}
2413 \end{table}
2414
2415 %\newpage
2416 Note : if outside a \texttt{define/endefine} block then the current complex black box 
2417 is '\texttt{user::workspace}', that is the main program equivalent 
2418 (this is how applications are documented).
2419 This remark holds for all complex black box related commands.
2420
2421
2422
2423
2424
2425
2426
2427
2428 % ==========================================
2429 % ==========================================
2430 % ==========================================
2431 % ==========================================
2432 % ==========================================
2433 % ==========================================
2434 % ==========================================
2435 % ==========================================
2436 % ==========================================
2437 % ==========================================
2438 %\hrule
2439 \newpage
2440 \section{Install and run time issues}
2441 % ==========================================
2442
2443
2444
2445
2446 %%==============================================================================================
2447 %%==============================================================================================
2448 \subsection{\bbtk configuration file}
2449 \label{The_configuration_file}
2450 %%==============================================================================================
2451 %%==============================================================================================
2452
2453 At start, \bbtk applications (\bbStudio, \bbi) try 
2454 to open an \texttt{xml} 
2455 configuration file named \texttt{bbtk\_config.xml}. 
2456 The search order is 
2457 \begin{enumerate}
2458 \item The current directory
2459 \item The subdir \texttt{.bbtk} of the user's home directory. 
2460 \begin{itemize} 
2461 \item On \texttt{Unix}, the home directory is the
2462 one stored by the environnement variable \texttt{HOME}, 
2463 typically \texttt{/home/username}.
2464 \item On \texttt{Windows}, the home directory is 
2465 the user's profile directory stored by the environnement 
2466 variable \texttt{USERPROFILE}, 
2467 typically \texttt{C:$\backslash$ Documents and Settings$\backslash$ username}.
2468 \end{itemize}
2469 \item If none of these two paths contains the file then it creates 
2470 a new one in the \texttt{.bbtk} directory. 
2471 \end{enumerate}
2472
2473
2474 Information on \bbtk configuration is 
2475 obtained in \bbStudio by clicking on the 
2476 \texttt{Config} button of the \texttt{Command} part toolbar.
2477
2478 If you did not installed other packages than the ones 
2479 provided by \bbtk, you get something like :
2480
2481 \begin{verbatim}
2482  =============
2483  Configuration
2484  =============
2485  bbtk_config.xml    : [/home/guigues/.bbtk/bbtk_config.xml]
2486  Documentation Path : [/usr/local/bin/../share/bbtk/doc]
2487  Data Path          : [/usr/local/bin/../share/bbtk/data]
2488  Temp Directory     : []
2489  File Separator     : [/]
2490  BBS Paths   
2491  --- [.]
2492  --- [/usr/local/bin/../share/bbtk/bbs]
2493  PACKAGE Paths : 
2494  --- [.]
2495  --- [/usr/local/bin/../lib]
2496 \end{verbatim}
2497
2498 The first line let you know which configuration file is currently used.
2499
2500 You can open this file using \bbStudio menu \texttt{Files$>$Open bbtk Config file}.
2501
2502 You will get something like :
2503
2504 \begin{verbatim}
2505 <?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
2506 <config>
2507   <bbs_path>     </bbs_path>
2508   <package_path> </package_path>
2509   <default_temp_dir> $ </default_temp_dir>
2510 </config>
2511 \end{verbatim}
2512
2513 The \texttt{xml} tags \texttt{bbs\_path} and \texttt{package\_path} 
2514 allow to set additionnal directories in which to search 
2515 for \bbs files and packages dynamic libraries.
2516
2517 For example, if you add the line :
2518 \begin{verbatim}
2519   <bbs_path> /home/guigues/bbs </bbs_path>
2520 \end{verbatim}
2521
2522 Then the interpreter will search for \bbs in the folder \texttt{/home/guigues/bbs}, 
2523 which allows a command like \texttt{'include bbMyBox.bbs'} to work if 
2524 the folder \texttt{/home/guigues/bbs} contains the file \texttt{bbMyBox.bbs}.
2525
2526 The same, the \texttt{xml} tag \texttt{<package\_path>} let you 
2527 set additional path in which to find a package dynamic library, 
2528 hence allowing to load additionnal packages with the \texttt{'load'} command.
2529
2530 All \bbs and package paths are summmarized in the 
2531 information output when pressing 'Config' in \bbStudio. 
2532 You can see that two \bbs paths are always set :
2533 \begin{itemize}
2534 \item The current directory (\texttt{.})
2535 \item The \bbs folder of \bbtk 
2536 \end{itemize}
2537 Also, two package paths are always set :
2538 \begin{itemize}
2539 \item The current directory (\texttt{.})
2540 \item The libraries folder of \bbtk 
2541 \end{itemize}
2542
2543 Additional paths set in your \texttt{bbtk\_config.xml} are added after those standard paths.
2544 Note that the order displayed is the one in which the folders are searched when 
2545 \texttt{include} or \texttt{load} commands are issued.
2546
2547
2548 %%==============================================================================================
2549
2550 \subsection{Misc}
2551 \begin {itemize}
2552 %\item{make} \\
2553 %For some strange reasons (?!?), at \texttt{cmake} time, 
2554 %you may be warned that an error occured while documentation generation.\\
2555 %Take it easy, \texttt{make} again!\\
2556
2557 \item{\bbStudio} is written using the Advanced User Interface library of wxWidgets.
2558 If, after some hazardous floating/docking operations onto the frame, you feel
2559 very unhappy with the result, just remove from the hidden directory
2560 \texttt{.bbtk} the file named \texttt{bbStudio.aui}. \\ 
2561
2562  
2563 \end {itemize}
2564
2565
2566
2567 \end{document}
2568
2569