CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

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

Path: gap4r8 / pkg / Browse / doc / intro.xml
Views: 418346
1
2
<Chapter Label="ch:intro"><Heading>Introduction and Overview</Heading>
3
4
<Section Label="sec:intro"><Heading>Introduction</Heading>
5
6
The motivation of the package <Package>Browse</Package> was to provide
7
better functionality for displaying two-dimensional arrays of data (e.g.,
8
character tables): moving through the data without loosing row and
9
column labels, searching for text, displaying extra information, hiding
10
information, allowing interactive user input, ...
11
<P/>
12
We wanted to achieve this by using the capabilities of the terminal
13
emulations in which &GAP; is running, and not by some external graphical
14
user interface. For this we have chosen to use the widely available
15
<C>C</C>-library <C>ncurses</C>, see <Cite Key="NCursesWeb"/>.
16
17
It contains functions to find out terminal capabilities,
18
to change properties of terminals, to place text, to handle several windows
19
with overlapping, ... To use these functions the terminal is switched
20
to a <Emph>visual mode</Emph> <Index>visual mode</Index>
21
so that the display of the non-visual
22
mode of your terminal in which &GAP; is running is not clobbered.
23
<P/>
24
<Package>Browse</Package> has now three levels of functionality:
25
<List >
26
<Mark>A low level interface to <C>ncurses</C></Mark>
27
<Item>
28
This may be interesting for all kinds of applications which want
29
to display text with some markup including
30
<Index>colors as text attributes</Index>colors,
31
maybe in several windows,
32
using the available capabilities of a terminal.
33
</Item>
34
<Mark>A medium level interface to a generic function <Ref
35
Func="NCurses.BrowseGeneric"/></Mark>
36
<Item>
37
This is for displaying two-dimensional arrays of data, handles
38
labels for rows and columns, searching, sorting, binding keys to
39
actions, ...
40
If you want to implement such applications for further kinds of data,
41
first look at the examples
42
in Section <Ref Func="BrowseData.IsBrowseTable" Style="Number"/>,
43
then check what can be copied from the examples
44
in Chapter <Ref Chap="ch:appl"/>,
45
and consult the descriptions
46
in Chapters <Ref Chap="chap:browse-user"/>
47
and <Ref Chap="chap:browse-prg"/>.
48
</Item>
49
<Mark>Applications of these interfaces</Mark>
50
<Item>
51
We provide some applications of the <C>ncurses</C> interface and
52
of the generic <Ref Func="NCurses.BrowseGeneric"/> function. These may be
53
interesting for end users, and also as examples for programmers of
54
further applications. This includes (of course) a method for
55
browsing through character tables, functions for browsing through data
56
collections, several games,<Index>game</Index>
57
and an interface for demos.
58
</Item>
59
</List>
60
61
Users interested only in these applications should perhaps just try
62
<C>NCurses.Demo()</C>.
63
64
</Section>
65
66
<Section Label="sec:overview"><Heading>Overview</Heading>
67
68
<Subsection Label="ssec:ov_ncurses">
69
<Heading>The <C>ncurses</C> interface</Heading>
70
71
Chapter <Ref Chap="ch:curses"/> describes &GAP;'s interface to the
72
<C>ncurses</C> <C>C</C>-library. The imported <C>C</C>-functions are shortly
73
explained, but for further details we refer to the documentation of that
74
library. There are also a few utility functions on &GAP; level, such as
75
<Ref Func="NCurses.SetTerm"/>, which simplify the use of the library.
76
<P/>
77
The concept of an <Emph>attribute line</Emph><Index>attribute line</Index>,
78
see <Ref
79
Func="NCurses.IsAttributeLine"/>, helps to deal with text with markup
80
for its display in a terminal window.
81
<P/>
82
This chapter is for users who want to write their own applications of
83
<C>ncurses</C>.
84
</Subsection>
85
86
<Subsection Label="ssec:ov_ncappl"><Heading>Applications of
87
<C>ncurses</C></Heading>
88
In Chapter <Ref Chap="ch:util"/> we describe some interactive applications
89
of the <C>ncurses</C> interface. For example, there is <Ref
90
Func="NCurses.Select"/> for asking a user to choose one or several of a
91
given list of items. There is also a demo function <Ref
92
Func="NCurses.Demo"/> which we use to
93
demonstrate features of the <Package>Browse</Package> package, but it
94
may be interesting for other kinds of demos as well.
95
</Subsection>
96
97
<Subsection Label="ssec:ov_genbrowse">
98
<Heading>The interface to browse two-dimensional arrays</Heading>
99
Chapters <Ref Chap="chap:browse-user"/> and <Ref
100
Chap="chap:browse-prg"/> describe the interface to a
101
generic function <Ref Func="NCurses.BrowseGeneric"/> which can be used for an
102
interactive display of two-dimensional arrays of data. The first of
103
these covers the basic functionality which may be sufficient for many
104
applications and the second gives more technical details. With
105
interactive display we mean that it is not only possible to scroll
106
through the data, but one can search for strings, sort by rows or columns,
107
select entries, bind arbitrary actions to keys and mouse events,
108
ask for help, and more.
109
</Subsection>
110
111
<Subsection Label="ssec:ov_browseappl">
112
<Heading>Applications of the generic function
113
<C>NCurses.BrowseGeneric</C></Heading>
114
In Chapter <Ref Chap="ch:appl"/> we describe several applications which
115
are using the generic <Ref Func="NCurses.BrowseGeneric"/> interface
116
introduced before.
117
They are provided as prototype applications and so we include some
118
implementation remarks in their documentation.
119
<P/>
120
Users who just want to use these applications hopefully do not need to
121
read this <Package>Browse</Package> manual, all applications are coming
122
with built-in help windows.
123
<P/>
124
There are different kinds of applications.
125
First, there are methods for browsing through character tables and tables
126
of marks (our original motivation for this package). Then there are
127
applications for browsing through data collections, e.g., the data
128
available through the <Package>AtlasRep</Package> package, the &GAP;
129
bibliography or the sections of the &GAP; manuals. Finally, there are
130
several games like Sam Loyd's fifteen puzzle (generalized), peg solitaire,
131
and Sudoku (including functions to create new puzzles and to solve
132
puzzles).
133
</Subsection>
134
</Section>
135
136
137
<Section Label="sec:pkg_userprefs">
138
<Heading>User preferences provided by the &Browse; package</Heading>
139
140
See <Ref Func="SetUserPreference" BookName="ref"/>
141
for &GAP;'s user preferences mechanism,
142
and <Ref Func="BrowseUserPreferences"/>
143
for viewing and modifying user preferences.
144
145
<Subsection Label="subsec:EnableMouseEvents">
146
<Heading>The user preference <C>EnableMouseEvents</C></Heading>
147
148
This user preference defines whether mouse events are enabled by default
149
in visual mode (value <K>true</K>) or not
150
(value <K>false</K>, this is the default).
151
During the &GAP; session, the value can be changed using
152
<Ref Func="NCurses.UseMouse"/>.
153
Inside browse applications based on <Ref Func="NCurses.BrowseGeneric"/>
154
or <Ref Func="NCurses.Select"/>,
155
the value can be toggled usually by hitting the <B>M</B> key.
156
157
</Subsection>
158
159
<Subsection Label="subsec:SelectHelpMatches">
160
<Heading>The user preference <C>SelectHelpMatches</C></Heading>
161
162
In the case that the &GAP; help system finds multiple matches,
163
<K>true</K> (the default) means that the user can choose one entry
164
from a list that is shown via <Ref Func="NCurses.Select"/>,
165
and <K>false</K> means that the matches are just shown in a pager.
166
167
</Subsection>
168
169
<Subsection Label="subsec:SelectPackageName">
170
<Heading>The user preference <C>SelectPackageName</C></Heading>
171
172
In the case that <Ref Func="LoadPackage" BookName="ref"/> is called
173
with a prefix of some package names,
174
<K>true</K> (the default) means that the user can choose one matching entry,
175
and <K>false</K> means that the matches are just printed.
176
177
</Subsection>
178
179
</Section>
180
181
</Chapter>
182
183
184