2
/******************************************************************************
4
* DESCRIPTION: boxes whose dimensions are (partially) set by the user.
5
* - empty and plain boxes
7
* - overline and underline like boxes
8
* COPYRIGHT : (C) 1999 Joris van der Hoeven
9
*******************************************************************************
10
* This software falls under the GNU general public license and comes WITHOUT
11
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
12
* If you don't have this file, write to the Free Software Foundation, Inc.,
13
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14
******************************************************************************/
17
#include "Boxes/construct.hpp"
22
get_wide_parameters (SI x1, SI x2, SI penw, SI& width, SI& height) {
23
width = max (x2-x1, 10*penw)- (8*penw);
24
int ratio = width / penw;
25
int srrat = (int) sqrt ((double) ratio);
30
wide_hat_box (path ip, SI x1, SI x2, SI penw, color col) {
32
get_wide_parameters (x1, x2, penw, width, height);
36
xs[0]= ys[0]= xs[1]= ys[1]= 0;
37
bs[0]= line_box (decorate_middle (ip), 0, 0, width/2, height, penw, col);
38
bs[1]= line_box (decorate_middle (ip), width/2, height, width, 0, penw, col);
39
return composite_box (ip, bs, xs, ys);
43
wide_tilda_box (path ip, SI x1, SI x2, SI penw, color col) {
44
SI width, height, w, h, uw, uh, ww, hh;
45
get_wide_parameters (x1, x2, penw, width, height);
48
hh= (SI) (0.8660254 * ((double) h));
50
uw= (SI) (((double) w) / 4.2679492);
51
ww= (SI) (1.1339746 * ((double) h));
55
xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0;
56
bs[0]= arc_box (decorate_middle (ip),
57
0, -h, 2*uw, h, 60<<6, 180<<6, penw, col);
58
bs[1]= line_box (decorate_middle (ip),
59
3*uw/2, hh, w-(3*uw/2), h-hh, penw, col);
60
bs[2]= arc_box (decorate_middle (ip),
61
w- (2*uw), 0, w, 2*h, 240<<6, 360<<6, penw, col);
62
return composite_box (ip, bs, xs, ys);
66
wide_bar_box (path ip, SI x1, SI x2, SI penw, color col) {
67
return line_box (ip, 0, 0, max (penw, x2- x1), 0, penw, col);
71
wide_vect_box (path ip, SI x1, SI x2, SI penw, color col) {
72
SI width, height, arrow= 2*penw, delta=penw/2;
73
get_wide_parameters (x1, x2, penw, width, height);
78
xs[0]= ys[0]= xs[1]= ys[1]= xs[2]= ys[2]= 0;
79
bs[0]= line_box (decorate_middle (ip), 0, arrow, width, arrow, penw, col);
80
bs[1]= line_box (decorate_middle (ip),
81
width- arrow- delta, 0, width, arrow, penw, col);
82
bs[2]= line_box (decorate_middle (ip),
83
width+ delta- arrow, 2*arrow, width, arrow, penw, col);
84
return composite_box (ip, bs, xs, ys);
88
wide_check_box (path ip, SI x1, SI x2, SI penw, color col) {
90
get_wide_parameters (x1, x2, penw, width, height);
94
xs[0]= ys[0]= xs[1]= ys[1]= 0;
95
bs[0]= line_box (decorate_middle (ip), 0, height, width/2, 0, penw, col);
96
bs[1]= line_box (decorate_middle (ip), width/2, 0, width, height, penw, col);
97
return composite_box (ip, bs, xs, ys);
101
wide_breve_box (path ip, SI x1, SI x2, SI penw, color col) {
103
get_wide_parameters (x1, x2, penw, width, height);
104
return arc_box (ip, 0, 0, width, 2*height, 180<<6, 360<<6, penw, col);