]>
Commit | Line | Data |
---|---|---|
45516216 | 1 | struct SPStyle { |
2 | float value; | |
3 | float computed; | |
4 | }; | |
5 | template < typename _Iterator, typename _Container > class __normal_iterator { | |
6 | _Iterator _M_current; | |
7 | public:explicit __normal_iterator(const _Iterator & __i):_M_current(__i) | |
8 | { | |
9 | } | |
10 | const _Iterator & base() const { | |
11 | return _M_current; | |
12 | }}; | |
13 | template < typename _IteratorL, typename _IteratorR, | |
14 | typename _Container > inline int operator-(const __normal_iterator < | |
15 | _IteratorL, _Container > &__lhs, | |
16 | const __normal_iterator < | |
17 | _IteratorR, _Container > &__rhs) | |
18 | { | |
19 | return __lhs.base() - __rhs.base(); | |
20 | } | |
21 | ||
22 | template < typename _Tp > class allocator { | |
23 | }; | |
24 | template < typename _Tp, typename _Alloc > struct _Vector_base { | |
25 | struct _Vector_impl { | |
26 | _Tp *_M_start; | |
27 | _Tp *_M_finish; | |
28 | }; | |
29 | public: _Vector_impl _M_impl; | |
30 | }; | |
31 | template < typename _Tp, typename _Alloc = allocator < _Tp > >class vector:protected _Vector_base < _Tp, | |
32 | _Alloc > | |
33 | { | |
34 | public:typedef __normal_iterator < const _Tp *, | |
35 | void >const_iterator; | |
36 | unsigned int size() const { | |
37 | return const_iterator(this->_M_impl._M_finish) - | |
38 | const_iterator(this->_M_impl._M_start); | |
39 | } const _Tp & operator[] (unsigned int __n)const { | |
40 | }}; | |
41 | class Layout { | |
42 | public:class iterator; | |
43 | iterator end() const; | |
44 | unsigned lineIndex(iterator const &) const; | |
45 | struct Chunk; | |
46 | struct Character { | |
47 | Chunk const &chunk(Layout const *l) const { | |
48 | }}; | |
49 | struct Chunk { | |
50 | unsigned in_line; | |
51 | }; | |
52 | vector < Character > _characters; | |
53 | }; | |
54 | class Layout::iterator { | |
55 | public:unsigned _char_index; | |
56 | iterator(Layout const *p, unsigned c, int g):_char_index(c) { | |
57 | }}; | |
58 | inline Layout::iterator Layout::end() const | |
59 | { | |
60 | return iterator(this, _characters.size(), _characters.size()); | |
61 | } | |
62 | inline unsigned Layout::lineIndex(iterator const &it) const | |
63 | { | |
64 | return it._char_index == | |
65 | _characters.size()? 1 : _characters[0].chunk(this).in_line; | |
66 | }; | |
67 | void sp_te_adjust_linespacing_screen(double by) | |
68 | { | |
69 | Layout *layout; | |
70 | SPStyle *style; | |
71 | unsigned line_count = layout->lineIndex(layout->end()); | |
72 | double all_lines_height; | |
73 | double average_line_height = all_lines_height / line_count; | |
74 | if (style->computed) | |
75 | style->computed = by; | |
76 | else | |
77 | style->computed = (average_line_height) / average_line_height; | |
78 | if (style->value) | |
79 | style->value = by; | |
80 | else | |
81 | style->value = (average_line_height) / average_line_height; | |
82 | } |