1 
2 /******************************************************************************
3 * MODULE     : construct.hpp
4 * DESCRIPTION: the exported box construction routines
5 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
6 *******************************************************************************
7 * This software falls under the GNU general public license version 3 or later.
8 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
9 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
10 ******************************************************************************/
11 
12 #ifndef CONSTRUCT_H
13 #define CONSTRUCT_H
14 #include "boxes.hpp"
15 #include "array.hpp"
16 #include "font.hpp"
17 #include "command.hpp"
18 
19 class frame;
20 
21 /******************************************************************************
22 * Ornament parameters
23 ******************************************************************************/
24 
25 class ornament_parameters_rep: concrete_struct {
26 public:
27   tree shape, tst;
28   SI lw, bw, rw, tw;
29   double lext, bext, rext, text;
30   SI lpad, bpad, rpad, tpad;
31   brush bg, xc;
32   array<brush> border;
33 
34   inline
ornament_parameters_rep(tree shape2,tree tst2,SI lw2,SI bw2,SI rw2,SI tw2,double lx,double bx,double rx,double tx,SI lpad2,SI bpad2,SI rpad2,SI tpad2,brush bg2,brush xc2,array<brush> border2)35   ornament_parameters_rep (tree shape2, tree tst2,
36                            SI lw2, SI bw2, SI rw2, SI tw2,
37 			   double lx, double bx, double rx, double tx,
38                            SI lpad2, SI bpad2, SI rpad2, SI tpad2,
39 			   brush bg2, brush xc2, array<brush> border2):
40     shape (shape2), tst (tst2),
41     lw (lw2), bw (bw2), rw (rw2), tw (tw2),
42     lext (lx), bext (bx), rext (rx), text (tx),
43     lpad (lpad2), bpad (bpad2), rpad (rpad2), tpad (tpad2),
44     bg (bg2), xc (xc2), border (border2) {}
45   friend class ornament_parameters;
46 };
47 
48 class ornament_parameters {
49   CONCRETE(ornament_parameters);
50   inline
ornament_parameters(tree shape2,tree tst2,SI lw2,SI bw2,SI rw2,SI tw2,double lx,double bx,double rx,double tx,SI lpad2,SI bpad2,SI rpad2,SI tpad2,brush bg2,brush xc2,array<brush> border2)51   ornament_parameters (tree shape2, tree tst2,
52                        SI lw2, SI bw2, SI rw2, SI tw2,
53 		       double lx, double bx, double rx, double tx,
54 		       SI lpad2, SI bpad2, SI rpad2, SI tpad2,
55 		       brush bg2, brush xc2, array<brush> border2):
56     rep (tm_new<ornament_parameters_rep> (shape2, tst2,
57                                           lw2, bw2, rw2, tw2,
58 					  lx, bx, rx, tx,
59                                           lpad2, bpad2, rpad2, tpad2,
60 					  bg2, xc2, border2)) {}
61 };
62 CONCRETE_CODE(ornament_parameters);
63 
64 inline ornament_parameters
copy(ornament_parameters ps)65 copy (ornament_parameters ps) {
66   return ornament_parameters (ps->shape, ps->tst,
67                               ps->lw, ps->bw, ps->rw, ps->tw,
68 			      ps->lext, ps->bext, ps->rext, ps->text,
69                               ps->lpad, ps->bpad, ps->rpad, ps->tpad,
70 			      ps->bg, ps->xc, ps->border);
71 }
72 
73 /******************************************************************************
74 * Construction routines for boxes
75 ******************************************************************************/
76 
77 box empty_box (path ip, int x1=0, int y1=0, int x2=0, int y2=0);
78 box dummy_box (path ip, int x1=0, int y1=0, int x2=0, int y2=0);
79 box marker_box (path ip, int x1, int y1, int x2, int y2, box ref);
80 box test_box (path ip);
81 box line_box (path ip, SI x1, SI y1, SI x2, SI y2, pencil pen);
82 box arc_box (path ip, SI x1, SI y1, SI x2, SI y2, int a1, int a2, pencil p);
83 box polygon_box (path ip, array<SI> x, array<SI> y, brush fill);
84 box polygon_box (path ip, array<SI> x, array<SI> y, brush fill, pencil pen);
85 box image_box (path ip, url u, SI w, SI h, int alpha, int px);
86 
87 box text_box (path ip, int pos, string s, font fn, pencil pen);
88 box delimiter_box (path ip, string s, font fn, pencil pen, SI y1, SI y2);
89 box delimiter_box (path ip, string s, font fn, pencil pen,
90                    SI bot, SI top, SI mid, SI real_bot, SI real_top);
91 box big_operator_box (path ip, string s, font fn, pencil pen, int n);
92 box wide_box (path ip, string s, font fn, pencil pen, SI width);
93 box wide_stix_box (path ip, string s, font fn, pencil pen, SI width);
94 box bracket_box (path ip, int br_type, pencil pen, SI y1, SI y2);
95 box wide_hat_box (path ip, SI x1, SI x2, pencil pen);
96 box wide_tilda_box (path ip, SI x1, SI x2, pencil pen);
97 box wide_bar_box (path ip, SI x1, SI x2, pencil pen);
98 box wide_vect_box (path ip, SI x1, SI x2, pencil pen);
99 box wide_check_box (path ip, SI x1, SI x2, pencil pen);
100 box wide_breve_box (path ip, SI x1, SI x2, pencil pen);
101 box wide_invbreve_box (path ip, SI x1, SI x2, pencil pen);
102 box wide_squbr_box (path ip, SI x1, SI x2, pencil pen);
103 box wide_sqobr_box (path ip, SI x1, SI x2, pencil pen);
104 box control_box (path ip, tree t, font fn);
105 box control_box (path ip, box b, font fn);
106 box control_box (path ip, lazy lz, font fn);
107 
108 box concat_box (path ip, array<box> bs, array<SI> spc, bool indent= false);
109 box phrase_box (path ip, array<box> bs, array<SI> spc);
110 box stack_box (path ip, array<box> bs, array<SI> spc);
111 box composite_box (path ip, array<box> bs, bool bfl= true);
112 box composite_box (path ip, array<box> bs, array<SI> x, array<SI> y,
113 		   bool bfl= true);
114 box table_box (path ip, array<box> bs, array<SI> x, array<SI> y,
115                array<string> halign, int cols);
116 box superpose_box (path ip, array<box> bs, bool bfl= true);
117 box scatter_box (path ip, array<box> bs, array<SI> x, array<SI> y);
118 box cell_box (path ip, box b, SI x0, SI y0, SI x1, SI y1, SI x2, SI y2,
119 	      SI bl, SI br, SI bb, SI bt, brush fg, brush bg);
120 box remember_box (path ip, box b);
121 box highlight_box (path ip, box b, box xb, ornament_parameters ps);
122 box highlight_box (path ip, box b, SI w, brush col, brush sunc, brush shad);
123 
124 box frac_box (path ip, box b1, box b2, font fn, font sfn, pencil pen);
125 box sqrt_box (path ip, box b1, box b2, box sqrtb, font fn, pencil pen);
126 box neg_box (path ip, box b, font fn, pencil pen);
127 box tree_box (path ip, array<box> bs, font fn, pencil pen);
128 box wide_box (path ip, box ref, string s, font fn, pencil p, bool wf, bool af);
129 box repeat_box (path ip, box ref, box repeat, SI xoff=0);
130 box limit_box (path ip, box ref, box lo, box hi, font fn, bool glued);
131 box script_box (path ip, box b1, box b2, font fn);
132 box left_script_box (path ip, box ref, box b1, box b2, font fn, int level);
133 box right_script_box (path ip, box ref, box b1, box b2, font fn, int level);
134 box side_box (path ip, box ref, box l1, box l2, box r1, box r2, font f, int l);
135 box specific_box (path ip, box b, string filter, font fn);
136 box toc_box (path ip, string kind, string title, font fn);
137 box flag_box (path ip, box b, SI h, pencil dark, brush light);
138 box info_box (path ip, SI h, pencil dark, brush light);
139 box scrollbar_box (path ip, box b, bool vertical, SI span, tree t);
140 
141 box symbol_box (path ip, box b, int n);
142 box shorter_box (path ip, box b, int n);
143 box frozen_box (path ip, box b);
144 box move_box (path ip, box b, SI x, SI y, bool chf= false, bool bigf= false);
145 box shift_box (path ip, box b, SI x, SI y, bool chf= false, bool bigf= false);
146 box resize_box (path ip, box b, SI x1, SI y1, SI x2, SI y2,
147 		bool chf= false, bool adjust= false);
148 box vresize_box (path ip, box b, SI y1, SI y2);
149 box transformed_box (path ip, box b, frame f);
150 box effect_box (path ip, array<box> bs, tree eff);
151 box clip_box (path ip, box b, SI x1, SI y1, SI x2, SI y2);
152 box clip_box (path ip, box b, SI x1, SI y1, SI x2, SI y2,
153 	      tree xt, tree yt, SI scx, SI scy);
154 box vcorrect_box (path ip, box b, SI top_cor, SI bot_cor);
155 box page_box (path ip, tree page, int page_nr, SI w, SI h,
156 	      array<box> bs  , array<SI> bs_x  , array<SI> bs_y,
157 	      array<box> decs, array<SI> decs_x, array<SI> decs_y);
158 box locus_box (path ip, box b, list<string> ids, SI pixel);
159 box locus_box (path ip, box b, list<string> ids, SI pixel, string ref, string anchor);
160 box macro_box (path ip, box b, font big_fn= font (), int btype= STD_BOX);
161 box tag_box (path ip, path tip, box b, tree keys);
162 box note_box (path ip, box b, box note, SI nx, SI ny);
163 
164 box anim_compose_box (path ip, array<box> b);
165 box anim_repeat_box (path ip, box b);
166 box anim_constant_box (path ip, box b, int l);
167 box anim_translate_box (path ip, box b, int len, SI sx, SI sy, SI ex, SI ey);
168 box anim_progressive_box (path ip, box b, int len, rectangle r1, rectangle r2);
169 box sound_box (path ip, url u, SI h);
170 box video_box (path ip, url u, SI w, SI h, int a, int msecs, bool rep, int px);
171 
172 #endif // defined CONSTRUCT_H
173