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