Color support – Crunch CRiSP File Editor 6 User Manual

Page 46

Advertising
background image

Page 46

Note that this timer mechanism is independent of the idle timer mechanism described elsewhere. The idle
timer mechanism is specifically designed to support the autosave functionality. In theory the autosave
mechanism could be built from the timer functionality since it is more generic (although it would be tricky to
build an autosave mechanism based on the number of keystrokes typed, which the autosave mechanism
does support). The timer mechanism is designed to allow certain classes of macros to poll external events,
e.g. files, at a leisurely pace. E.g. it is unadvisable to build a complicated hard real-time mechanism using
these primitives because of the inability to guarantee correct operation under all circumstances and
operating systems.

Color Support

CRiSP contains support for color. The color support is based on a very simple model which is designed to
try and hide some of the peculiarities of running on screens as varied as monochrome serial terminals, to
the X11 versions and DOS GUI versions.

The primary primitives for managing colors are the set_color() and get_color() functions. These functions
take a list or return a list of colors. Each element in the list is responsible for coloring a particular part of the
screen. E.g. the first element in the list is the normal background color.

Because of the peculiarities of color naming on different systems, CRiSP attempts to offer a facility which
can minimise portability problems with user macros when run on different hardware. CRiSP allows you to
dynamically select colors for different parts of the screen (using set_color()) and also to define a palette of
colors for certain of the other primitives available.

There are a number of primary display objects which can be allocated colors. Some of these colors are
obvious; some are the basis for CRiSPs syntax coloring. The table below lists all the colors that are known
by CRiSP.

Code

Mnemonic

Description

0

COL_BACKGROUND

Background color of the screen.

1

COL_FOREGROUND

Foreground color for all windows.

2

COL_SELECTED_WINDO
W

Color of selected window title.

3

COL_MESSAGES

Normal color of prompts and messages
and Line:/Col: fields.

4

COL_ERRORS

Error message color.

5

COL_HILITE_BACKGROU
ND

Color of background for a highlighted
area.

6

COL_HILITE_FOREGROU
ND

Color of foreground for a highlighted
area.

7

COL_INSERT_CURSOR

Color associated with the insert mode
cursor.

8

COL_OVERTYPE_CURS
OR

Color associated with the overtype mode
cursor

9

COL_BORDERS

Color associated with the window
borders.

10

COL_FG_NUMBERS

Color assigned to the foreground of
numbers.

11

COL_BG_NUMBERS

Color assigned to the background of
numbers.

12

COL_FG_COMMENTS

Foreground color for comments.

13

COL_BG_COMMENTS

Background color for comments.

14

COL_FG_STRINGS

Foreground color for string literals.

Advertising