]>
Commit | Line | Data |
---|---|---|
45516216 | 1 | namespace __gnu_cxx { |
2 | template < typename _Iterator > struct iterator_traits { | |
3 | typedef int difference_type; | |
4 | }; | |
5 | template < typename _Iterator, | |
6 | typename _Container > class __normal_iterator { | |
7 | _Iterator _M_current; | |
8 | public:typedef typename iterator_traits < | |
9 | _Iterator >:: | |
10 | difference_type difference_type; | |
11 | explicit __normal_iterator(const _Iterator & | |
12 | __i):_M_current(__i) { | |
13 | } const _Iterator & base() const { | |
14 | return _M_current; | |
15 | }}; | |
16 | template < typename _IteratorL, typename _IteratorR, | |
17 | typename _Container > inline typename __normal_iterator < | |
18 | _IteratorL, | |
19 | _Container >::difference_type operator-(const __normal_iterator < | |
20 | _IteratorL, | |
21 | _Container > &__lhs, | |
22 | const __normal_iterator < | |
23 | _IteratorR, | |
24 | _Container > &__rhs) { | |
25 | return __lhs.base() - __rhs.base(); | |
26 | } | |
27 | template < typename _Tp > class new_allocator { | |
28 | public:typedef const _Tp *const_pointer; | |
29 | typedef const _Tp & const_reference; | |
30 | template < typename _Tp1 > struct rebind { | |
31 | typedef new_allocator < _Tp1 > other; | |
32 | }; | |
33 | }; | |
34 | } | |
35 | struct SPStyle { | |
36 | float value; | |
37 | float computed; | |
38 | }; | |
39 | namespace std { | |
40 | template < typename _Tp > | |
41 | class allocator:public __gnu_cxx::new_allocator < _Tp > { | |
42 | }; | |
43 | template < typename _Tp, typename _Alloc > struct _Vector_base { | |
44 | typedef typename _Alloc::template rebind < | |
45 | _Tp >::other _Tp_alloc_type; | |
46 | struct _Vector_impl:public _Tp_alloc_type { | |
47 | _Tp *_M_start; | |
48 | _Tp *_M_finish; | |
49 | }; | |
50 | public: _Vector_impl _M_impl; | |
51 | }; | |
52 | template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:protected _Vector_base < _Tp, | |
53 | _Alloc > | |
54 | { | |
55 | typedef _Vector_base < _Tp, _Alloc > _Base; | |
56 | typedef vector < _Tp, _Alloc > vector_type; | |
57 | typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; | |
58 | public:typedef _Tp value_type; | |
59 | typedef typename _Tp_alloc_type::const_pointer const_pointer; | |
60 | typedef typename _Tp_alloc_type:: | |
61 | const_reference const_reference; | |
62 | typedef __gnu_cxx::__normal_iterator < const_pointer, | |
63 | vector_type > const_iterator; | |
64 | unsigned int size() const { | |
65 | return const_iterator(this->_M_impl._M_finish) - | |
66 | const_iterator(this->_M_impl._M_start); | |
67 | } const_reference operator[] (unsigned int __n)const { | |
68 | }}; | |
69 | } | |
70 | ||
71 | namespace Text { | |
72 | class Layout { | |
73 | public:class iterator; | |
74 | iterator end() const; | |
75 | unsigned lineIndex(iterator const &it) const; | |
76 | struct Chunk; | |
77 | struct Character { | |
78 | Chunk const &chunk(Layout const *l) const { | |
79 | }}; | |
80 | struct Chunk { | |
81 | unsigned in_line; | |
82 | }; | |
83 | std::vector < Character > _characters; | |
84 | }; | |
85 | class Layout::iterator { | |
86 | public:unsigned _char_index; | |
87 | iterator(Layout const *p, unsigned c, int g):_char_index(c) { | |
88 | }}; | |
89 | inline Layout::iterator Layout::end() const { | |
90 | return iterator(this, _characters.size(), _characters.size()); | |
91 | } inline unsigned Layout::lineIndex(iterator const &it) const { | |
92 | return it._char_index == | |
93 | _characters.size()? 1 : _characters[0].chunk(this).in_line; | |
94 | }}; | |
95 | void sp_te_adjust_linespacing_screen(double by) | |
96 | { | |
97 | float value; | |
98 | float computed; | |
99 | Text::Layout * layout; | |
100 | SPStyle *style; | |
101 | unsigned line_count = layout->lineIndex(layout->end()); | |
102 | double all_lines_height; | |
103 | double average_line_height = all_lines_height / line_count; | |
104 | switch (1) { | |
105 | default: | |
106 | if (style->computed) | |
107 | style->computed = by; | |
108 | else | |
109 | style->computed = | |
110 | (average_line_height) / average_line_height; | |
111 | if (style->value) | |
112 | style->value = by; | |
113 | else | |
114 | style->value = | |
115 | (average_line_height) / average_line_height; | |
116 | } | |
117 | } |