Previous: Using the printrow class, Up: The printrow class



8.3.2 Row printing options

The way in which rows are printed by a printrow object is controlled by various options. These options are given by a printrow::options object.

     struct options {
       enum o_flags {
         numbers = 0x01,
         miss_numbers = 0x02
       };
       unsigned int flags;
       text_style style;
       dimension xspace, yspace;
       struct line_style {
         dimension width;
         colour col;
       };
       map<int, line_style> lines;
     
       void defaults(void);
     };

The flags member contains various flags; bit values are given by the enumerated type o_flags, and possible values for flags can be obtained by logically ORing these values together. The bits are as follows:

This option may be changed, with immediate effect, at any point during printing.

The style member controls the style in which the rows are printed; for the declaration of the text_style class, see The text_style class. This option may not be changed during printing.

The xspace and yspace members give the horizontal space between numbers in a row, and the vertical space between rows, respectively. For the declaration of the dimension class, see The dimension class. These options may not be changed during printing.

The lines member controls which “blue lines” are printed. Each element of the map has an integer, denoting the bell number, and a line_style element which defines the style of the line. The two members of line_style are a dimension object, giving the width of the line, and a colour object, giving the colour of the line. This option may be changed in between columns, but not in the middle of a column.

For example, suppose that we wish to print rows in 10-point Helvetica, with spacing of 12 points horizontally and vertically. We want to draw a blue line half a point thick for the second bell. The following code sets up a printrow::options object to accomplish this:

     printrow::options o;
     o.flags = printrow::options::numbers;
     o.style.size = 100;
     o.style.font = "Helvetica";
     o.xspace.n = 12;
     o.yspace.n = 12;
     line_style s; s.width.n = 1; s.width.d = 2; s.width.u = dimension::points;
     s.col.grey = false; s.col.red = 0; s.col.green = 0; s.col.blue = 1.0;
     o.lines[1] = s;

There is one member function of printrow::options.

— Function: void printrow::options::defaults (void);

This function sets up the printrow::options object to the defaults as given in the example above.