Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 4183461<Chapter Label="ch:intro"><Heading>Introduction and Overview</Heading>23<Section Label="sec:intro"><Heading>Introduction</Heading>45The motivation of the package <Package>Browse</Package> was to provide6better functionality for displaying two-dimensional arrays of data (e.g.,7character tables): moving through the data without loosing row and8column labels, searching for text, displaying extra information, hiding9information, allowing interactive user input, ...10<P/>11We wanted to achieve this by using the capabilities of the terminal12emulations in which &GAP; is running, and not by some external graphical13user interface. For this we have chosen to use the widely available14<C>C</C>-library <C>ncurses</C>, see <Cite Key="NCursesWeb"/>.1516It contains functions to find out terminal capabilities,17to change properties of terminals, to place text, to handle several windows18with overlapping, ... To use these functions the terminal is switched19to a <Emph>visual mode</Emph> <Index>visual mode</Index>20so that the display of the non-visual21mode of your terminal in which &GAP; is running is not clobbered.22<P/>23<Package>Browse</Package> has now three levels of functionality:24<List >25<Mark>A low level interface to <C>ncurses</C></Mark>26<Item>27This may be interesting for all kinds of applications which want28to display text with some markup including29<Index>colors as text attributes</Index>colors,30maybe in several windows,31using the available capabilities of a terminal.32</Item>33<Mark>A medium level interface to a generic function <Ref34Func="NCurses.BrowseGeneric"/></Mark>35<Item>36This is for displaying two-dimensional arrays of data, handles37labels for rows and columns, searching, sorting, binding keys to38actions, ...39If you want to implement such applications for further kinds of data,40first look at the examples41in Section <Ref Func="BrowseData.IsBrowseTable" Style="Number"/>,42then check what can be copied from the examples43in Chapter <Ref Chap="ch:appl"/>,44and consult the descriptions45in Chapters <Ref Chap="chap:browse-user"/>46and <Ref Chap="chap:browse-prg"/>.47</Item>48<Mark>Applications of these interfaces</Mark>49<Item>50We provide some applications of the <C>ncurses</C> interface and51of the generic <Ref Func="NCurses.BrowseGeneric"/> function. These may be52interesting for end users, and also as examples for programmers of53further applications. This includes (of course) a method for54browsing through character tables, functions for browsing through data55collections, several games,<Index>game</Index>56and an interface for demos.57</Item>58</List>5960Users interested only in these applications should perhaps just try61<C>NCurses.Demo()</C>.6263</Section>6465<Section Label="sec:overview"><Heading>Overview</Heading>6667<Subsection Label="ssec:ov_ncurses">68<Heading>The <C>ncurses</C> interface</Heading>6970Chapter <Ref Chap="ch:curses"/> describes &GAP;'s interface to the71<C>ncurses</C> <C>C</C>-library. The imported <C>C</C>-functions are shortly72explained, but for further details we refer to the documentation of that73library. There are also a few utility functions on &GAP; level, such as74<Ref Func="NCurses.SetTerm"/>, which simplify the use of the library.75<P/>76The concept of an <Emph>attribute line</Emph><Index>attribute line</Index>,77see <Ref78Func="NCurses.IsAttributeLine"/>, helps to deal with text with markup79for its display in a terminal window.80<P/>81This chapter is for users who want to write their own applications of82<C>ncurses</C>.83</Subsection>8485<Subsection Label="ssec:ov_ncappl"><Heading>Applications of86<C>ncurses</C></Heading>87In Chapter <Ref Chap="ch:util"/> we describe some interactive applications88of the <C>ncurses</C> interface. For example, there is <Ref89Func="NCurses.Select"/> for asking a user to choose one or several of a90given list of items. There is also a demo function <Ref91Func="NCurses.Demo"/> which we use to92demonstrate features of the <Package>Browse</Package> package, but it93may be interesting for other kinds of demos as well.94</Subsection>9596<Subsection Label="ssec:ov_genbrowse">97<Heading>The interface to browse two-dimensional arrays</Heading>98Chapters <Ref Chap="chap:browse-user"/> and <Ref99Chap="chap:browse-prg"/> describe the interface to a100generic function <Ref Func="NCurses.BrowseGeneric"/> which can be used for an101interactive display of two-dimensional arrays of data. The first of102these covers the basic functionality which may be sufficient for many103applications and the second gives more technical details. With104interactive display we mean that it is not only possible to scroll105through the data, but one can search for strings, sort by rows or columns,106select entries, bind arbitrary actions to keys and mouse events,107ask for help, and more.108</Subsection>109110<Subsection Label="ssec:ov_browseappl">111<Heading>Applications of the generic function112<C>NCurses.BrowseGeneric</C></Heading>113In Chapter <Ref Chap="ch:appl"/> we describe several applications which114are using the generic <Ref Func="NCurses.BrowseGeneric"/> interface115introduced before.116They are provided as prototype applications and so we include some117implementation remarks in their documentation.118<P/>119Users who just want to use these applications hopefully do not need to120read this <Package>Browse</Package> manual, all applications are coming121with built-in help windows.122<P/>123There are different kinds of applications.124First, there are methods for browsing through character tables and tables125of marks (our original motivation for this package). Then there are126applications for browsing through data collections, e.g., the data127available through the <Package>AtlasRep</Package> package, the &GAP;128bibliography or the sections of the &GAP; manuals. Finally, there are129several games like Sam Loyd's fifteen puzzle (generalized), peg solitaire,130and Sudoku (including functions to create new puzzles and to solve131puzzles).132</Subsection>133</Section>134135136<Section Label="sec:pkg_userprefs">137<Heading>User preferences provided by the &Browse; package</Heading>138139See <Ref Func="SetUserPreference" BookName="ref"/>140for &GAP;'s user preferences mechanism,141and <Ref Func="BrowseUserPreferences"/>142for viewing and modifying user preferences.143144<Subsection Label="subsec:EnableMouseEvents">145<Heading>The user preference <C>EnableMouseEvents</C></Heading>146147This user preference defines whether mouse events are enabled by default148in visual mode (value <K>true</K>) or not149(value <K>false</K>, this is the default).150During the &GAP; session, the value can be changed using151<Ref Func="NCurses.UseMouse"/>.152Inside browse applications based on <Ref Func="NCurses.BrowseGeneric"/>153or <Ref Func="NCurses.Select"/>,154the value can be toggled usually by hitting the <B>M</B> key.155156</Subsection>157158<Subsection Label="subsec:SelectHelpMatches">159<Heading>The user preference <C>SelectHelpMatches</C></Heading>160161In the case that the &GAP; help system finds multiple matches,162<K>true</K> (the default) means that the user can choose one entry163from a list that is shown via <Ref Func="NCurses.Select"/>,164and <K>false</K> means that the matches are just shown in a pager.165166</Subsection>167168<Subsection Label="subsec:SelectPackageName">169<Heading>The user preference <C>SelectPackageName</C></Heading>170171In the case that <Ref Func="LoadPackage" BookName="ref"/> is called172with a prefix of some package names,173<K>true</K> (the default) means that the user can choose one matching entry,174and <K>false</K> means that the matches are just printed.175176</Subsection>177178</Section>179180</Chapter>181182183184