void Text::scroll_to(DimensionName dimension, Coord position) { // let the user scroll to the right (or down) past the current size. /* if (position > (upper(dimension) - cur_length(dimension))) { position = upper(dimension) - cur_length(dimension); } */ // if (position < lower(dimension)) { // position = lower(dimension); // } if (dimension == Dimension_X) { if (position < lower(dimension)) { position = lower(dimension); } } else { if (position > (upper(dimension) - cur_length(dimension))) { position = upper(dimension) - cur_length(dimension); } } if (position == cur_lower(dimension)) { return; } cur_lower(dimension, position); notify(dimension); damage(); }
Coord Adjustable::large_scroll(DimensionName d) const { Coord s = impl_->info_[d].large_; if (Math::equal(s, float(0), float(1e-4))) { s = cur_length(d) - 1; } return s; }
void Adjustable::constrain(DimensionName d, Coord& new_lower) const { Coord a = lower(d); Coord b = upper(d) - cur_length(d); if (new_lower < a) { new_lower = a; } else if (new_lower > b) { new_lower = b; } }
str make_str () { int n; str s; n = cur_length(); s = new_str(n); memcpy(s, cur_str, n); cur_str_ptr = cur_str; return s; }
Coord Adjustable::cur_upper(DimensionName d) const { return cur_lower(d) + cur_length(d); }
void tex::show_node_list(ptr p) { int n; if (cur_length() > depth_threshold) { if (p > null) print(" []"); return; } n = 0; while (p > null) { print_ln(); print_str(); incr(n); if (n > breadth_max) { print("etc."); return; } if (is_char_node(p)) { print_font_and_char(p); } else { switch (type(p)) { case HLIST_NODE: case VLIST_NODE: case UNSET_NODE: show_box1(p); break; case RULE_NODE: show_rule(p); break; case INS_NODE: show_insertion(p); break; case WHATSIT_NODE: show_whatsit(p); break; case GLUE_NODE: show_glue(p); break; case KERN_NODE: show_kern(p); break; case MATH_NODE: show_math(p); break; case LIGATURE_NODE: show_ligature(p); break; case PENALTY_NODE: show_penalty(p); break; case DISC_NODE: show_discretionary(p); break; case MARK_NODE: show_mark(p); break; case ADJUST_NODE: show_adjust(p); break; case STYLE_NODE: print_style(subtype(p)); break; case CHOICE_NODE: show_choice_node(p); break; case INNER_NOAD: case ORD_NOAD: case OP_NOAD: case BIN_NOAD: case REL_NOAD: case OPEN_NOAD: case CLOSE_NOAD: case PUNCT_NOAD: case RADICAL_NOAD: case OVER_NOAD: case UNDER_NOAD: case VCENTER_NOAD: case ACCENT_NOAD: case LEFT_NOAD: case RIGHT_NOAD: show_normal_noad(p); break; case FRACTION_NOAD: show_fraction_noad(p); break; default: print("Unknown node type!"); break; } } p = link(p); } }
void Text::page_backward(DimensionName dimension) { scroll_to(dimension, cur_lower(dimension) - cur_length(dimension)); }