1 2 /****************************************************************************** 3 * MODULE : concater.hpp 4 * DESCRIPTION: Typesetting concatenations in two stages. 5 * - produce an array of line items 6 * - handle brackets and scripts 7 * COPYRIGHT : (C) 1999 Joris van der Hoeven 8 ******************************************************************************* 9 * This software falls under the GNU general public license version 3 or later. 10 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE 11 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>. 12 ******************************************************************************/ 13 14 #ifndef CONCATER_H 15 #define CONCATER_H 16 #include "typesetter.hpp" 17 #include "Format/line_item.hpp" 18 #include "Boxes/construct.hpp" 19 20 #define MODE_JUSTIFY 0 21 #define MODE_LEFT 1 22 #define MODE_CENTER 2 23 #define MODE_RIGHT 3 24 25 class concater_rep { 26 edit_env env; // the environment 27 array<line_item> a; // the line items 28 bool rigid; // when surely not wrappable 29 30 // useful subroutines 31 void print (box b); 32 void print (int type, int op_type, box b); 33 void control (tree t, path ip); 34 void marker (path ip); 35 void ghost (string s, path ip); 36 void ghost (string s, path ip, color col); 37 void flag_ok (string s, path ip, color col); 38 void flag (string s, path ip, color col); 39 void print (space spc); 40 void penalty_min (int p); 41 void penalty_max (int p); 42 void with_limits (int status); 43 44 // textual markup 45 void typeset_substring (string s, path ip, int pos); 46 void typeset_math_substring (string s, path ip, int pos, int op_type); 47 void typeset_colored_substring (string s, path ip, int pos, string col); 48 void typeset_text_string (tree t, path ip, int start, int end); 49 void typeset_math_string (tree t, path ip, int start, int end); 50 void typeset_prog_string (tree t, path ip, int start, int end); 51 void typeset_document (tree t, path ip); 52 void typeset_paragraph (tree t, path ip); 53 void typeset_surround (tree t, path ip); 54 void typeset_concat (tree t, path ip); 55 void typeset_rigid (tree t, path ip); 56 void typeset_hspace (tree t, path ip); 57 void typeset_space (tree t, path ip); 58 void typeset_move (tree t, path ip); 59 void typeset_shift (tree t, path ip); 60 void typeset_resize (tree t, path ip); 61 void typeset_clipped (tree t, path ip); 62 void typeset_float (tree t, path ip); 63 void typeset_repeat (tree t, path ip); 64 void typeset_formatting (tree t, path ip, string var); 65 void typeset_decorated_box (tree t, path ip); 66 void typeset_line_note (tree t, path ip); 67 void typeset_page_note (tree t, path ip); 68 69 // mathematical markup 70 void typeset_around (tree t, path ip, bool colored); 71 void typeset_large (tree t, path ip, int type, int op_type, string prefix); 72 //void typeset_left (tree t, path ip); 73 //void typeset_middle (tree t, path ip); 74 //void typeset_right (tree t, path ip); 75 void typeset_bigop (tree t, path ip); 76 void typeset_long_arrow (tree t, path ip); 77 void typeset_lprime (tree t, path ip); 78 void typeset_rprime (tree t, path ip); 79 void typeset_below (tree t, path ip); 80 void typeset_above (tree t, path ip); 81 void typeset_script (tree t, path ip, bool right); 82 void typeset_frac (tree t, path ip); 83 void typeset_sqrt (tree t, path ip); 84 void typeset_wide (tree t, path ip, bool above); 85 void typeset_neg (tree t, path ip); 86 void typeset_tree (tree t, path ip); 87 void typeset_table (tree t, path ip); 88 void print_semantic (box b, tree sem); 89 void typeset_syntax (tree t, path ip); 90 91 // deactivated markup 92 void typeset_blue (tree t, path ip); 93 void typeset_src_open (tree t, path ip, string extra); 94 void typeset_src_middle (tree t, path ip, int i); 95 void typeset_src_close (tree t, path ip); 96 void typeset_src_args (tree t, path ip); 97 void typeset_src_tag (tree t, path ip); 98 void typeset_inactive (tree t, path ip); 99 void typeset_error (tree t, path ip); 100 101 // active macro mechanisms 102 void typeset_assign (tree t, path ip); 103 void typeset_with (tree t, path ip); 104 void typeset_compound (tree t, path ip); 105 void typeset_auto (tree t, path ip, tree macro); 106 void typeset_include (tree t, path ip); 107 void typeset_drd_props (tree t, path ip); 108 void typeset_eval (tree t, path ip); 109 void typeset_value (tree t, path ip); 110 void typeset_argument (tree t, path ip); 111 void typeset_eval_args (tree t, path ip); 112 void typeset_mark (tree t, path ip); 113 void typeset_expand_as (tree t, path ip); 114 void typeset_dynamic (tree t, path ip); 115 void typeset_executable (tree t, path ip); 116 void typeset_rewrite (tree t, path ip); 117 118 // miscellaneous active markup 119 void typeset_if (tree t, path ip); 120 void typeset_var_if (tree t, path ip); 121 void typeset_case (tree t, path ip); 122 void typeset_range (tree t, path ip); 123 void typeset_locus (tree t, path ip); 124 void typeset_set_binding (tree t, path ip); 125 void typeset_write (tree t, path ip); 126 void typeset_toc_notify (tree t, path ip); 127 void typeset_specific (tree t, path ip); 128 void typeset_flag (tree t, path ip); 129 130 // animations 131 void typeset_anim_compose (tree t, path ip); 132 void typeset_anim_repeat (tree t, path ip); 133 void typeset_anim_constant (tree t, path ip); 134 void typeset_anim_translate (tree t, path ip); 135 void typeset_anim_progressive (tree t, path ip); 136 void typeset_video (tree t, path ip); 137 void typeset_sound (tree t, path ip); 138 139 // graphical markup 140 void typeset_graphical (array<box>& bs, tree t, path ip); 141 void typeset_graphics (tree t, path ip); 142 void typeset_superpose (tree t, path ip); 143 void typeset_gr_group (tree t, path ip); 144 void typeset_gr_transform (tree t, path ip); 145 void typeset_gr_effect (tree t, path ip); 146 void typeset_text_at (tree t, path ip); 147 void typeset_math_at (tree t, path ip); 148 void typeset_point (tree t, path ip); 149 array<box> typeset_line_arrows (path ip); 150 void typeset_line (tree t, path ip, bool close); 151 void typeset_arc (tree t, path ip, bool close); 152 void typeset_spline (tree t, path ip, bool close); 153 void typeset_var_spline (tree t, path ip); 154 void typeset_cspline (tree t, path ip); 155 void typeset_fill (tree t, path ip); 156 void typeset_image (tree t, path ip); 157 void typeset_graphics_3d (tree t, path ip); 158 159 // markup for graphical user interface 160 void typeset_canvas (tree t, path ip); 161 void typeset_ornament (tree t, path ip); 162 163 // postprocessing of brackets and scripts 164 int prec (int i); 165 int succ (int i); 166 void pre_glue (); 167 void glue (box b, int ref, int arg); 168 void glue (box b, int ref, int arg1, int arg2); 169 void clean_and_correct (); 170 void handle_scripts (int start, int end); 171 void handle_matching (int start, int end); 172 void handle_brackets (); 173 void kill_spaces (); 174 175 public: 176 concater_rep (edit_env env, bool rigid= false); 177 void typeset (tree t, path ip); 178 void finish (); 179 180 friend class liner_rep; 181 friend class par_line_rep; 182 friend class typesetter_rep; 183 friend class document_rep; 184 185 friend box typeset_as_concat (edit_env env, tree t, path ip); 186 friend box typeset_as_box (edit_env env, tree t, path ip); 187 friend box typeset_as_atomic (edit_env env, tree t, path ip); 188 friend array<line_item> typeset_concat (edit_env env, tree t, path ip); 189 friend array<line_item> typeset_concat_range (edit_env env, tree t, path ip, 190 int i1, int i2); 191 friend array<line_item> typeset_marker (edit_env env, path ip); 192 }; 193 194 typedef concater_rep* concater; 195 196 box typeset_as_concat (edit_env env, tree t, path ip); 197 array<line_item> typeset_concat (edit_env env, tree t, path ip); 198 array<line_item> typeset_concat_range (edit_env env, tree t, path ip, 199 int i1, int i2); 200 array<line_item> typeset_marker (edit_env env, path ip); 201 202 #endif // defined CONCATER_H 203