]>
Commit | Line | Data |
---|---|---|
1 | typedef unsigned int size_t; | |
2 | typedef struct _GObject {} GObject; | |
3 | namespace std { | |
4 | struct input_iterator_tag { | |
5 | }; | |
6 | struct forward_iterator_tag:public input_iterator_tag { | |
7 | }; | |
8 | struct bidirectional_iterator_tag:public forward_iterator_tag { | |
9 | }; | |
10 | struct random_access_iterator_tag:public bidirectional_iterator_tag { | |
11 | }; | |
12 | template < typename _Iterator > struct iterator_traits { | |
13 | }; | |
14 | template < typename _Tp > struct iterator_traits <_Tp * > { | |
15 | typedef random_access_iterator_tag iterator_category; | |
16 | typedef int difference_type; | |
17 | }; | |
18 | } | |
19 | namespace __gnu_cxx { | |
20 | using std::iterator_traits; | |
21 | template < typename _Iterator, | |
22 | typename _Container > class __normal_iterator { | |
23 | protected:_Iterator _M_current; | |
24 | public:typedef typename iterator_traits < | |
25 | _Iterator >:: | |
26 | iterator_category iterator_category; | |
27 | typedef typename iterator_traits < | |
28 | _Iterator >::difference_type difference_type; | |
29 | explicit __normal_iterator(const _Iterator & | |
30 | __i):_M_current(__i) { | |
31 | } const _Iterator & base() const { | |
32 | return _M_current; | |
33 | }}; | |
34 | template < typename _IteratorL, typename _IteratorR, | |
35 | typename _Container > inline typename __normal_iterator < | |
36 | _IteratorL, | |
37 | _Container >::difference_type operator-(const __normal_iterator < | |
38 | _IteratorL, | |
39 | _Container > &__lhs, | |
40 | const __normal_iterator < | |
41 | _IteratorR, | |
42 | _Container > &__rhs) { | |
43 | return __lhs.base() - __rhs.base(); | |
44 | } | |
45 | namespace std { | |
46 | class exception { | |
47 | }; | |
48 | } template < typename _Tp > class new_allocator { | |
49 | public:typedef size_t size_type; | |
50 | typedef const _Tp *const_pointer; | |
51 | typedef const _Tp & const_reference; | |
52 | template < typename _Tp1 > struct rebind { | |
53 | typedef new_allocator < _Tp1 > other; | |
54 | }; | |
55 | }; | |
56 | } | |
57 | ||
58 | namespace std { | |
59 | template < typename _Tp > | |
60 | class allocator:public __gnu_cxx::new_allocator < _Tp > { | |
61 | }; | |
62 | } | |
63 | ||
64 | namespace NR { | |
65 | typedef double Coord; | |
66 | enum Dim2 { | |
67 | X = 0, Y | |
68 | }; | |
69 | } | |
70 | extern double fabs(double __x) throw() __attribute__ ((__const__)); | |
71 | namespace NR { | |
72 | class Point { | |
73 | public:inline Point() { | |
74 | } inline Coord operator[] (unsigned i)const { | |
75 | }}; | |
76 | } | |
77 | ||
78 | namespace Inkscape { | |
79 | enum MessageType { | |
80 | NORMAL_MESSAGE, WARNING_MESSAGE, ERROR_MESSAGE, | |
81 | INFORMATION_MESSAGE | |
82 | }; | |
83 | namespace GC { | |
84 | enum ScanPolicy { | |
85 | SCANNED, ATOMIC | |
86 | }; | |
87 | enum CollectionPolicy { | |
88 | AUTO, MANUAL | |
89 | }; | |
90 | template < ScanPolicy default_scan = | |
91 | SCANNED, CollectionPolicy default_collect = | |
92 | AUTO > class Managed { | |
93 | }; | |
94 | class Finalized { | |
95 | public:Finalized() { | |
96 | }}; | |
97 | class Anchored { | |
98 | protected:Anchored():_anchor(__null) | |
99 | { | |
100 | } private:struct Anchor:public Managed < SCANNED, | |
101 | MANUAL > { | |
102 | }; | |
103 | mutable Anchor *_anchor; | |
104 | }; | |
105 | } | |
106 | namespace UI { | |
107 | namespace View { | |
108 | class View:public GC::Managed <>, public GC::Finalized, | |
109 | public GC::Anchored { | |
110 | }; | |
111 | }}} struct SPDesktop:public Inkscape::UI::View::View { | |
112 | double current_zoom() const { | |
113 | }}; | |
114 | enum SPMarkerLoc { | |
115 | SP_CSS_UNIT_NONE, SP_CSS_UNIT_PX, SP_CSS_UNIT_PT, SP_CSS_UNIT_PC, | |
116 | SP_CSS_UNIT_MM, SP_CSS_UNIT_CM, SP_CSS_UNIT_IN, SP_CSS_UNIT_EM, | |
117 | SP_CSS_UNIT_EX, SP_CSS_UNIT_PERCENT | |
118 | }; | |
119 | struct SPILengthOrNormal { | |
120 | unsigned unit:4; | |
121 | float value; | |
122 | float computed; | |
123 | }; | |
124 | struct SPStyle { | |
125 | SPILengthOrNormal line_height; | |
126 | }; | |
127 | namespace std { | |
128 | template < typename _Tp, typename _Alloc > struct _Vector_base { | |
129 | typedef typename _Alloc::template rebind < | |
130 | _Tp >::other _Tp_alloc_type; | |
131 | struct _Vector_impl:public _Tp_alloc_type { | |
132 | _Tp *_M_start; | |
133 | _Tp *_M_finish; | |
134 | }; | |
135 | public:_Vector_impl _M_impl; | |
136 | }; | |
137 | template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:protected _Vector_base < _Tp, | |
138 | _Alloc > | |
139 | { | |
140 | typedef _Vector_base < _Tp, _Alloc > _Base; | |
141 | typedef vector < _Tp, _Alloc > vector_type; | |
142 | typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; | |
143 | public:typedef _Tp value_type; | |
144 | typedef typename _Tp_alloc_type::const_pointer const_pointer; | |
145 | typedef typename _Tp_alloc_type:: | |
146 | const_reference const_reference; | |
147 | typedef __gnu_cxx::__normal_iterator < const_pointer, | |
148 | vector_type > const_iterator; | |
149 | typedef size_t size_type; | |
150 | const_iterator begin() const { | |
151 | return const_iterator(this->_M_impl._M_start); | |
152 | } const_iterator end() const { | |
153 | return const_iterator(this->_M_impl._M_finish); | |
154 | } size_type size() const { | |
155 | return size_type(end() - begin()); | |
156 | } const_reference operator[] (size_type __n) const { | |
157 | }}; | |
158 | } | |
159 | struct SPObject:public GObject { | |
160 | SPStyle *style; | |
161 | }; | |
162 | struct SPItem:public SPObject { | |
163 | }; | |
164 | namespace Inkscape { | |
165 | namespace Text { | |
166 | class Layout { | |
167 | public:class iterator; | |
168 | inline iterator begin() const; | |
169 | inline iterator end() const; | |
170 | inline unsigned lineIndex(iterator const &it) const; | |
171 | NR::Point characterAnchorPoint(iterator const &it) | |
172 | const; | |
173 | struct CursorShape { | |
174 | } _empty_cursor_shape; | |
175 | struct Chunk; | |
176 | struct Glyph { | |
177 | }; | |
178 | struct Character { | |
179 | inline Chunk const &chunk(Layout const *l) const { | |
180 | }}; | |
181 | struct Chunk { | |
182 | unsigned in_line; | |
183 | }; | |
184 | struct Line { | |
185 | }; | |
186 | std::vector < Line > _lines; | |
187 | std::vector < Character > _characters; | |
188 | std::vector < Glyph > _glyphs; | |
189 | class PredicateLineToCharacter { | |
190 | Layout const *const _flow; | |
191 | public:inline PredicateLineToCharacter(Layout const | |
192 | *flow):_flow | |
193 | (flow) { | |
194 | }}; | |
195 | }; | |
196 | class Layout::iterator { | |
197 | public:friend class Layout; | |
198 | private:Layout const | |
199 | *_parent_layout; | |
200 | int _glyph_index; | |
201 | unsigned _char_index; | |
202 | bool _cursor_moving_vertically; | |
203 | double _x_coordinate; | |
204 | inline iterator(Layout const *p, unsigned c, | |
205 | int g):_parent_layout(p), | |
206 | _glyph_index(g), _char_index(c), | |
207 | _cursor_moving_vertically(false), | |
208 | _x_coordinate(0.0) { | |
209 | }}; | |
210 | inline Layout::iterator Layout::end() const { | |
211 | return iterator(this, _characters.size(), | |
212 | _glyphs.size()); | |
213 | } inline unsigned Layout::lineIndex(iterator const &it) const { | |
214 | return it._char_index == | |
215 | _characters.size()? _lines.size() - | |
216 | 1 : _characters[it._char_index].chunk(this).in_line; | |
217 | }}}; | |
218 | Inkscape::Text::Layout const *te_get_layout(SPItem const *item) | |
219 | { | |
220 | } | |
221 | void sp_te_adjust_linespacing_screen(SPItem * text, | |
222 | Inkscape::Text::Layout:: | |
223 | iterator const &start, | |
224 | Inkscape::Text::Layout:: | |
225 | iterator const &end, SPDesktop * desktop, | |
226 | double by) | |
227 | { | |
228 | Inkscape::Text::Layout const *layout = te_get_layout(text); | |
229 | SPStyle *style = (((SPObject *) (text))->style); | |
230 | unsigned line_count = layout->lineIndex(layout->end()); | |
231 | double all_lines_height = | |
232 | layout->characterAnchorPoint(layout->end())[NR::Y] - | |
233 | layout->characterAnchorPoint(layout->begin())[NR::Y]; | |
234 | double average_line_height = | |
235 | all_lines_height / (line_count == 0 ? 1 : line_count); | |
236 | double zby = | |
237 | by / (desktop->current_zoom() * (line_count == 0 ? 1 : line_count)); | |
238 | switch (style->line_height.unit) { | |
239 | case SP_CSS_UNIT_NONE: | |
240 | default: | |
241 | if (fabs(style->line_height.computed) < 0.001) | |
242 | style->line_height.computed = by < 0.0 ? -0.001 : 0.001; | |
243 | else | |
244 | style->line_height.computed *= | |
245 | (average_line_height + zby) / average_line_height; | |
246 | case SP_CSS_UNIT_EM: | |
247 | case SP_CSS_UNIT_EX: | |
248 | case SP_CSS_UNIT_PERCENT: | |
249 | if (fabs(style->line_height.value) < 0.001) | |
250 | style->line_height.value = by < 0.0 ? -0.001 : 0.001; | |
251 | else | |
252 | style->line_height.value *= | |
253 | (average_line_height + zby) / average_line_height; | |
254 | } | |
255 | } |