YSTest: DSReader.cpp 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

DSReader.cpp
浏览该文件的文档.
1 /*
2 © 2010-2016, 2019 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #include "DSReader.h" // for ystdex::max;
29 #include <algorithm> // for std::copy_n;
30 #include YFM_YSLib_UI_YWindow
31 #include YFM_YSLib_Service_TextLayout
32
33 namespace YSLib
34 {
35
36 using namespace Drawing;
37 using namespace Text;
38 using ystdex::next_if_eq;
39
40 namespace
41 {
42
47 template<typename _tBi>
48 _tBi
49 FindPreviousChar(_tBi s, _tBi b, char32_t c = char32_t())
50 {
51 // while(b < --s && *s != c)
52 while(b != --s && *s != c)
53 ;
54 return s;
55 }
56
61 template<typename _tBi>
62 _tBi
63 FindLineFeed(const TextRegion& r, _tBi s, _tBi e)
64 {
65 const SDst wmax(r.GetWidth() - GetHorizontalOf(r.Margin));
66 SDst w(0);
67
68 // while(s < e && *s != '\n')
69 while(s != e && *s != '\n')
70 {
71 if(IsPrint(*s))
72 {
73 w += SDst(r.Font.GetAdvance(*s));
74 if(w >= wmax)
75 break;
76 }
77 ++s;
78 }
79 return s;
80 }
81
86 template<typename _tBi>
87 _tBi
88 FindPreviousLineFeed(TextRegion& r, _tBi s, _tBi b)
89 {
90 // if(b < s)
91 if(b != s)
92 {
93 const auto e(s);
94
95 for(auto t(FindPreviousChar(s, b, '\n')); t != e;
96 t = FindLineFeed(r, t, e))
97 {
98 s = t;
99 if(*t == '\n')
100 ++t;
101 }
102 }
103 return s;
104 }
105
110 template<typename _tIn, class _tArea, class _tCon>
111 inline void
112 AdjustForNewline(_tArea& area, _tIn& i, _tCon& c)
113 {
114 i = FindLineFeed(area, next_if_eq(i, '\n'), end(c));
115 }
116
121 template<typename _tIn, class _tArea, class _tCon>
122 inline void
123 AdjustPrevious(_tArea& area, _tIn& i, _tCon& c)
124 {
125 i = FindPreviousLineFeed(area, i, begin(c));
126 }
127
139 void
140 CopyScrollArea(YSLib::UI::BufferedTextArea& src_area,
141 size_t src_offset, YSLib::UI::BufferedTextArea& dst_area,
142 size_t dst_offset, ptrdiff_t offset, size_t n)
143 {
144 YAssert(n != 0, "Invalid number of lines found.");
145 YAssert(n <= size_t(abs(offset)), "Invalid offset found.");
146
147 const SDst w(src_area.GetWidth());
148
149 YAssert(w == dst_area.GetWidth(), "Distinct screen widths found.");
150 yunseq(src_offset *= w, dst_offset *= w, n *= w);
151 dst_area.Scroll(offset);
152 yunseq(std::copy_n(src_area.GetBufferPtr() + src_offset, n,
153 dst_area.GetBufferPtr() + dst_offset),
154 std::copy_n(src_area.GetBufferAlphaPtr() + src_offset, n,
155 dst_area.GetBufferAlphaPtr() + dst_offset));
156 src_area.Scroll(offset);
157 }
158
164 void
165 MoveScrollArea(YSLib::UI::BufferedTextArea& area_up,
166 YSLib::UI::BufferedTextArea& area_dn, ptrdiff_t offset, SDst n)
167 {
168 // XXX: Conversion to 'SPos' might be implementation-defined.
169 YAssert(SPos(area_up.GetHeight()) - area_up.Margin.Bottom - SPos(n) > 0,
170 "No enough space of areas found.");
171
172 const SDst up_btm(SDst(ystdex::max<SPos>(area_up.Margin.Bottom, 0)));
173
174 if(YB_UNLIKELY(area_up.GetHeight() <= up_btm + n))
175 {
176 auto src_off(SDst(ystdex::max<SPos>(area_dn.Margin.Top, 0))),
177 dst_off(SDst(area_up.GetHeight() - up_btm - n));
178 auto* p_src(&area_dn);
179 auto* p_dst(&area_up);
180 SDst clr_off;
181
182 // NOTE: Copy area is moved towards bottom, i.e. the browsering area is
183 // scrolled to top.
184 if(offset > 0)
185 {
186 std::swap(p_src, p_dst),
187 std::swap(src_off, dst_off),
188 clr_off = SDst(ystdex::max<SPos>(area_up.Margin.Top, 0));
189 }
190 else
191 clr_off = area_dn.GetHeight()
192 - SDst(ystdex::max<SPos>(area_dn.Margin.Bottom, 0)) - n;
193 CopyScrollArea(*p_src, src_off, *p_dst, dst_off, offset, size_t(n));
194 p_src->ClearLine(clr_off, n);
195 }
196 }
197
199 YB_ATTR_nodiscard YB_PURE std::uint16_t
200 CheckOverRead(const TextRegion& r)
201 {
202 const auto b(FetchLastLineBasePosition(r, r.GetHeight()));
203
204 // XXX: Conversion to 'SPos' might be implementation-defined.
205 return r.Pen.Y < b ? (b - r.Pen.Y) / SPos(GetTextLineHeightExOf(r)) : 0;
206 }
207
208 } // unnamed namespace;
209
210 namespace DS
211 {
212
213 namespace UI
214 {
215
216 DualScreenReader::DualScreenReader(SDst w, SDst h_up, SDst h_down,
217 FontCache& fc_)
218 : p_text(), fc(fc_), i_top(), i_btm(), overread_line_n(0), scroll_offset(0),
219 Margin(4, 4, 4, 4),
220 area_up(Rect({}, w, h_up), fc), area_dn(Rect({}, w, h_down), fc)
221 {
222 SetFontSize(),
223 SetColor(),
224 SetLineGap(),
225 area_up.Background = nullptr,
226 area_dn.Background = nullptr;
227 }
228
229 void
230 DualScreenReader::SetLineGap(std::uint8_t g)
231 {
232 if(area_up.LineGap != g)
233 {
234 yunseq(area_up.LineGap = g, area_dn.LineGap = g);
235 UpdateView();
236 }
237 }
238
239 void
240 DualScreenReader::SetVisible(bool b)
241 {
242 using YSLib::UI::Invalidate;
243
244 SetVisibleOf(area_up, b), SetVisibleOf(area_dn, b);
245 Invalidate(area_up);
246 Invalidate(area_dn);
247 }
248
249 void
250 DualScreenReader::SetFont(const Font& fnt)
251 {
252 yunseq(area_up.Font = fnt, area_dn.Font = fnt);
253 }
254 void
255 DualScreenReader::SetFontSize(FontSize s)
256 {
257 area_up.Font.SetSize(s),
258 area_dn.Font.SetSize(s);
259 // NOTE: Margins shall be adjusted before output.
260 }
261
262 void
263 DualScreenReader::AdjustForFirstNewline()
264 {
265 AdjustForNewline(area_up, i_top, *p_text);
266 }
267
268 void
269 DualScreenReader::AdjustForPrevNewline()
270 {
271 AdjustPrevious(area_up, i_top, *p_text);
272 }
273
274 void
275 DualScreenReader::AdjustMargins()
276 {
277 yunseq(area_up.Margin = Margin, area_dn.Margin = Margin);
278 AdjustBottomMarginOf(area_up), AdjustBottomMarginOf(area_dn);
279 {
280 const SPos v((area_up.Margin.Bottom - area_up.Margin.Top) / 2);
281
282 yunseq(area_up.Margin.Top += v, area_up.Margin.Bottom -= v);
283 }
284 {
285 const SPos v((area_dn.Margin.Bottom - area_dn.Margin.Top) / 2);
286
287 yunseq(area_dn.Margin.Top += v, area_dn.Margin.Bottom -= v);
288 }
289 }
290
291 FontSize
292 DualScreenReader::AdjustScrollOffset()
293 {
294 return bool(p_text) && scroll_offset != 0
295 ? ScrollByPixel(GetTextLineHeightExOf(area_up) - scroll_offset) : 0;
296 }
297
298 void
299 DualScreenReader::Attach(YSLib::UI::Window& wnd_up,
300 YSLib::UI::Window& wnd_dn)
301 {
302 wnd_up += area_up,
303 wnd_dn += area_dn;
304 }
305
306 void
307 DualScreenReader::Detach()
308 {
309 using YSLib::UI::Window;
310
311 if(const auto p_con
312 = dynamic_cast< Window*>(FetchContainerPtr(area_up).get()))
313 *p_con -= area_up;
314 if(const auto p_con
315 = dynamic_cast< Window*>(FetchContainerPtr(area_dn).get()))
316 *p_con -= area_dn;
317 }
318
319 bool
320 DualScreenReader::Execute(Command cmd)
321 {
322 if(YB_UNLIKELY(!p_text || p_text->GetTextSize() == 0))
323 return {};
324 if(YB_UNLIKELY(~cmd & Scroll))
325 return {};
326 if(AdjustScrollOffset() != 0)
327 return {};
328 if(cmd & Up)
329 {
330 if(YB_UNLIKELY(IsTextTop()))
331 return {};
332 }
333 else if(YB_UNLIKELY(IsTextBottom()))
334 return {};
335 YAssert(area_up.LineGap == area_dn.LineGap, "Distinct line gaps found.");
336 // TODO: Assert the fonts are same.
337 cmd &= ~Scroll;
338 if(cmd & Line)
339 {
340 const FontSize h(area_up.Font.GetHeight()), hx(h + GetLineGap());
341
342 if(cmd & Up)
343 {
344 MoveScrollArea(area_up, area_dn, hx, SDst(h));
345 SetCurrentTextLineNOf(area_up, 0);
346 AdjustForPrevNewline();
347 CarriageReturn(area_up);
348 PutLine(area_up, next_if_eq(i_top, '\n'), p_text->end(), '\n');
349 if(overread_line_n > 0)
350 --overread_line_n;
351 else
352 AdjustPrevious(area_up, i_btm, *p_text);
353 }
354 else
355 {
356 MoveUpForLastLine(-hx, h);
357 // NOTE: The buffer is not ensured with null character at end.
358 CarriageReturn(area_dn);
359 i_btm = PutLastLine();
360 AdjustForFirstNewline();
361 }
362 Invalidate();
363 }
364 else
365 {
366 auto ln(area_up.GetTextLineNEx() + area_dn.GetTextLineNEx());
367
368 if(cmd & Up)
369 while(ln--)
370 AdjustForPrevNewline();
371 else
372 while(ln-- && !IsTextBottom())
373 {
374 AdjustForNewline(area_dn, i_btm, *p_text);
375 AdjustForFirstNewline();
376 }
377 UpdateView();
378 }
379 return true;
380 }
381
382 void
383 DualScreenReader::Invalidate()
384 {
385 using YSLib::UI::Invalidate;
386
387 Invalidate(area_up);
388 Invalidate(area_dn);
389 if(ViewChanged)
390 ViewChanged();
391 }
392
393 void
394 DualScreenReader::Locate(size_t pos)
395 {
396 const auto s(Deref(p_text).GetTextSize());
397
398 if(s == 0)
399 {
400 Reset();
401 Invalidate();
402 return;
403 }
404 if(pos == 0)
405 i_top = p_text->begin();
406 else if(pos < s)
407 {
408 i_top = p_text->GetIterator(pos);
409 ++i_top;
410 AdjustForPrevNewline();
411 }
412 else
413 return;
414 UpdateView();
415 }
416
417 void
418 DualScreenReader::LoadText(ifstream& file, Encoding enc)
419 {
420 if(file.is_open())
421 {
422 if(const auto p_buf = file.rdbuf())
423 {
424 p_text.reset(new Text::TextFileBuffer(*p_buf, enc));
425 yunseq(i_top = p_text->begin(), i_btm = p_text->end());
426 UpdateView();
427 return;
428 }
429 else
430 ShowError(u"文件缓冲区打开失败！");
431 }
432 else
433 ShowError(u"文件打开失败！");
434 }
435
436 void
437 DualScreenReader::MoveUpForLastLine(ptrdiff_t off, size_t h)
438 {
439 MoveScrollArea(area_up, area_dn, off, SDst(h));
440
441 std::uint16_t n(area_dn.GetTextLineNEx());
442
443 YAssert(n != 0, "No Enough height.");
444 SetCurrentTextLineNOf(area_dn, --n);
445 }
446
447 Text::TextFileBuffer::iterator
448 DualScreenReader::PutLastLine()
449 {
450 return PutLine(area_dn, next_if_eq(i_btm, '\n'), p_text->end(), '\n');
451 }
452
453 void
454 DualScreenReader::Reset()
455 {
456 area_up.ClearImage(),
457 area_dn.ClearImage();
458 AdjustMargins();
459 area_up.ResetPen(),
460 area_dn.ResetPen();
461 }
462
463 FontSize
464 DualScreenReader::ScrollByPixel(Drawing::FontSize h)
465 {
466 const FontSize ln_h_ex(GetTextLineHeightExOf(area_up));
467
468 YAssert(scroll_offset < ln_h_ex, "Invalid scroll offset found.");
469 if(YB_UNLIKELY(i_btm == Deref(p_text).end()
470 || scroll_offset + h > ln_h_ex))
471 return 0;
472 MoveUpForLastLine(-h, h);
473 // NOTE: The buffer is not ensured with null character at end.
474 CarriageReturn(area_dn);
475 if(YB_LIKELY((scroll_offset += h) < ln_h_ex))
476 {
477 area_dn.Pen.Y += ln_h_ex - scroll_offset;
478 PutLastLine();
479 }
480 else
481 {
482 i_btm = PutLastLine();
483 AdjustForFirstNewline();
484 scroll_offset = 0;
485 }
486 Invalidate();
487 return h;
488 }
489
490 void
491 DualScreenReader::ShowError(const char16_t* str)
492 {
493 UnloadText();
494 Reset();
495 PutString(area_up, Nonnull(str));
496 Invalidate();
497 }
498
499 void
500 DualScreenReader::Stretch(SDst h)
501 {
502 RestrictInClosedInterval<SDst>(h, 0, MainScreenHeight - 40);
503 h = MainScreenHeight - h;
504
505 const SDst w(area_dn.GetWidth());
506
507 SetSizeOf(area_dn, Size(w, h)),
508 area_dn.SetSize(w, h);
509 UpdateView();
510 }
511
512 void
513 DualScreenReader::UnloadText()
514 {
515 yunseq(i_top = Text::TextFileBuffer::iterator(),
516 i_btm = Text::TextFileBuffer::iterator(),
517 p_text = nullptr);
518 }
519
520 void
521 DualScreenReader::UpdateView()
522 {
523 if(YB_UNLIKELY(!p_text || p_text->GetTextSize() == 0))
524 return;
525 Reset();
526 {
527 auto i_new(PutString(area_up, next_if_eq(i_top, '\n'),
528 p_text->end()));
529
530 if(YB_UNLIKELY(i_new == p_text->end()))
531 {
532 i_btm = i_new;
533 overread_line_n = CheckOverRead(area_up) + area_dn.GetTextLineNEx();
534 }
535 else
536 {
537 i_btm = PutString(area_dn, i_new, p_text->end());
538 overread_line_n = CheckOverRead(area_dn);
539 }
540 }
541 if(YB_LIKELY(!IsTextBottom() && *i_btm == '\n'))
542 --i_btm;
543 Invalidate();
544 }
545
546 } // namespace UI;
547
548 } // namespace DS;
549
550 } // namespace YSLib;
551
YSLib::Drawing::SPos
YB_ATTR_nodiscard yconstfn YB_PURE x x x Bottom YB_ATTR_nodiscard yconstfn YB_PURE x Right y x Top y x Bottom y Bottom YB_ATTR_nodiscard yconstfn YB_PURE x Right y x Top y x Bottom y Bottom YB_ATTR_nodiscard yconstfn YB_PURE SPos(x.Right *ptrdiff_t(n))
YB_ATTR_nodiscard
#define YB_ATTR_nodiscard
标记返回值不被忽略的属性。
Definition: ydef.h:715
CHRLib::e
const char const char * e
Definition: CharacterProcessing.h:112
YSLib::DS::UI::DualScreenReader::Command
Command
命令类型。
Definition: DSReader.h:64
platform::Nonnull
YB_PURE _type && Nonnull(_type &&p) ynothrowv
断言并返回非空参数。
Definition: Debug.h:518
ystdex::cpp2017::swap
void swap(optional< _type > &x, optional< _type > &y)
Definition: optional.h:888
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:536
YSLib::UI::BufferedTextArea
缓冲文本区域。
Definition: TextArea.h:79
YSLib::DS::UI::DualScreenReader::area_up
YSLib::UI::BufferedTextArea area_up
上下屏幕对应文本区域。
Definition: DSReader.h:127
YB_PURE
#define YB_PURE
指示函数或函数模板实例为纯函数。
Definition: ydef.h:919
YSLib::Drawing::c
The boundary is out of the const Graphics const Rect const Point const Point Color c const Rect const Rect Color c
Definition: YDraw.h:174
YSLib::UI::Styles::Window
@ Window
窗口背景。
Definition: YStyle.h:311
YSLib::Drawing::TextRegion::Scroll
void Scroll(ptrdiff_t n)
缓冲区特效：整体移动 n 像素。
Definition: TextRenderer.cpp:186
YSLib::Drawing::r
The boundary is out of the const Graphics const Rect const Point const Point Color c const Rect const Rect & r
Definition: YDraw.h:174
YSLib::DS::UI::DualScreenReader::ScrollByPixel
Drawing::FontSize ScrollByPixel(Drawing::FontSize)
向下滚屏指定像素行。
Definition: DSReader.cpp:464
YSLib::DS::UI::DualScreenReader::AdjustForFirstNewline
void AdjustForFirstNewline()
Definition: DSReader.cpp:263
YSLib::Drawing::FetchLastLineBasePosition
YB_ATTR_nodiscard YF_API YB_PURE SPos FetchLastLineBasePosition(const TextState &, SDst)
取指定文本状态在指定高的区域中表示的最底行的基线位置（纵坐标）。
Definition: TextLayout.cpp:60
CHRLib::CharSet::Encoding
Encoding
字符流编码标识。
Definition: Encoding.h:59
YSLib::UI::fc
fc
Definition: Console.h:93
YSLib::Drawing::GetTextLineHeightExOf
GetTextLineHeightExOf
Definition: TextBase.h:169
YSLib::Drawing::TextState::Pen
Point Pen
笔坐标。
Definition: TextBase.h:98
YSLib::DS::UI::DualScreenReader::PutLastLine
Text::TextFileBuffer::iterator PutLastLine()
Definition: DSReader.cpp:448
YSLib::DS::UI::DualScreenReader::AdjustForPrevNewline
void AdjustForPrevNewline()
Definition: DSReader.cpp:269
YSLib::DS::UI::DualScreenReader::AdjustMargins
void AdjustMargins()
调整边距：使用公用边距更新各文本显示区域的边距。
Definition: DSReader.cpp:275
YSLib::DS::UI::DualScreenReader::AdjustScrollOffset
Drawing::FontSize AdjustScrollOffset()
调整滚屏像素偏移量：立即继续滚动至下一整文本行。
Definition: DSReader.cpp:292
YSLib::Drawing::FontCache
字体缓存。
Definition: Font.h:467
YSLib::Drawing::TextState::ResetPen
PDefHOp(TextState &,=, const PenStyle &ps) ImplRet(PenStyle void ResetPen()
赋值：笔样式。
Definition: TextBase.h:145
YSLib::UI::Widget::Background
HBrush Background
背景。
Definition: YWidget.h:395
YSLib::Drawing::g
The boundary is out of the const Graphics & g
Definition: YDraw.h:161
YSLib::UI::Window
窗口。
Definition: YWindow.h:45
ystdex::next_if_eq
_tIn next_if_eq(_tIn i, const _type &val, typename std::iterator_traits< _tIn >::difference_type n=1)
Definition: iterator_op.hpp:63
YSLib::DS::UI::DualScreenReader::Locate
void Locate(size_t)
文本定位。
Definition: DSReader.cpp:394
YSLib::DS::UI::DualScreenReader::Invalidate
void Invalidate()
无效化文本区域，并调用 ViewChanged （仅当非空）。
Definition: DSReader.cpp:383
YSLib::UI::Invalidate
YF_API void Invalidate(IWidget &, const Rect &)
无效化：使相对部件的指定区域在直接和间接的窗口缓冲区中无效。
Definition: YWidget.cpp:108
YSLib::DS::UI::DualScreenReader::SetFontSize
void SetFontSize(Drawing::FontSize=Drawing::Font::DefaultSize)
设置文本区域的字体大小。
Definition: DSReader.cpp:255
YSLib::DS::UI::DualScreenReader::ViewChanged
std::function< void()> ViewChanged
视图变更回调函数。
Definition: DSReader.h:136
YSLib::Text::TextFileBuffer::iterator
目标编码迭代器类型。
Definition: TextManager.h:71
YSLib::DS::UI::DualScreenReader::i_btm
Text::TextFileBuffer::iterator i_btm
Definition: DSReader.h:97
YSLib::Drawing::Padding::Top
SPos Top
Definition: YGDI.h:52
YSLib::DS::UI::DualScreenReader::SetVisible
void SetVisible(bool=true)
设置文本区域可见性。
Definition: DSReader.cpp:240
YSLib::Drawing::TextState::LineGap
std::uint8_t LineGap
行距。
Definition: TextBase.h:99
YSLib::DS::UI::DualScreenReader::scroll_offset
Drawing::FontSize scroll_offset
滚屏像素偏移量。
Definition: DSReader.h:110
YSLib::YAssert
YAssert(!(v< Deref(a)), "Value less than lower bound found.")
YSLib::Drawing::TextState::Font
Drawing::Font Font
Definition: TextBase.h:57
YSLib::Drawing::SetCurrentTextLineNOf
void SetCurrentTextLineNOf(TextState &ts, std::uint16_t n)
Definition: TextBase.cpp:75
YSLib::DS::UI::DualScreenReader::p_text
unique_ptr< Text::TextFileBuffer > p_text
文本资源。
Definition: DSReader.h:86
ystdex::cpp2017::end
auto end(_tRange &c) -> decltype(c.end())
Definition: range.hpp:345
YSLib::Drawing::PutLine
_tIter PutLine(_tRenderer &rd, _tIter s)
打印迭代器指定的起始字符的字符串，直至行尾或字符迭代终止。
Definition: TextRenderer.h:170
YSLib::DS::UI::DualScreenReader::area_dn
YSLib::UI::BufferedTextArea area_dn
Definition: DSReader.h:128
YSLib::DS::UI::DualScreenReader::Up
@ Up
Definition: DSReader.h:67
YSLib::i
return i
Definition: YCoreUtilities.h:177
yunseq
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:1535
YSLib::Drawing::PutString
_tIter PutString(_tRenderer &rd, _tIter s)
打印迭代器指定的起始字符的字符串，直至区域末尾或字符迭代终止。
Definition: TextRenderer.h:242
YSLib::DS::UI::DualScreenReader::MoveUpForLastLine
void MoveUpForLastLine(ptrdiff_t, size_t)
Definition: DSReader.cpp:437
platform::SDst
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:44
YSLib::Text::TextFileBuffer
文本文件块缓冲区。
Definition: TextManager.h:48
YSLib::Drawing::TextState::Margin
Padding Margin
边距：文本区域到显示区域的距离。
Definition: TextBase.h:93
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: YGDIBase.h:788
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:46
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:143
YSLib::DS::UI::DualScreenReader::Stretch
void Stretch(SDst)
伸缩：从最大值起向上调整（减少）下文字区域的高后更新视图。
Definition: DSReader.cpp:500
YB_LIKELY
#define YB_LIKELY(_expr)
Definition: ydef.h:827
YSLib::str
const char * str
Definition: YException.cpp:60
YSLib::DS::UI::DualScreenReader::LoadText
void LoadText(ifstream &, Text::Encoding)
载入指定编码的文本。
Definition: DSReader.cpp:418
YSLib::DS::UI::DualScreenReader::Attach
void Attach(YSLib::UI::Window &, YSLib::UI::Window &)
附加到窗口。
Definition: DSReader.cpp:299
YSLib::DS::UI::DualScreenReader::i_top
Text::TextFileBuffer::iterator i_top
文本区域输入迭代器。
Definition: DSReader.h:96
platform::Deref
YB_PURE yconstfn auto Deref(_type &&p) -> decltype(*p)
断言并解引用非空指针。
Definition: Debug.h:547
YSLib::Drawing::Padding::Bottom
SPos Bottom
Definition: YGDI.h:52
YSLib::DS::UI::DualScreenReader::UnloadText
void UnloadText()
卸载文本。
Definition: DSReader.cpp:513
YSLib::DS::UI::DualScreenReader::Reset
void Reset()
复位输出显示状态。
Definition: DSReader.cpp:454
v
byte v
Definition: CharRenderer.cpp:76
CHRLib::char16_t
YB_ATTR_nodiscard YB_PURE char16_t((*c_ptr<< CHAR_BIT)|c_ptr[1])) YB_ATTR_nodiscard YB_PURE inline PDefH(char16_t
取 c_ptr 指向的小端序双字节字符。
YSLib::Drawing::CompactPixmapEx::ClearImage
void ClearImage() const override
清除缓冲区。
Definition: YGDI.cpp:194
YSLib::DS::UI::DualScreenReader::SetLineGap
void SetLineGap(std::uint8_t=0)
设置行距。
Definition: DSReader.cpp:230
YSLib::Drawing::w
The boundary is out of the const Rect SDst w
Definition: YDraw.h:127
YSLib::DS::UI::DualScreenReader::Margin
Drawing::Padding Margin
公用边距。
Definition: DSReader.h:119
YSLib::Drawing::AdjustBottomMarginOf
YB_ATTR_nodiscard YB_PURE tr AdjustBottomMarginOf
Definition: TextLayout.h:82
YSLib::DS::UI::DualScreenReader::UpdateView
void UpdateView()
更新视图。
Definition: DSReader.cpp:521
YSLib::UI::SetSizeOf
YF_API void SetSizeOf(IWidget &, const Size &)
设置部件大小。
Definition: YWidget.cpp:83
YSLib::Drawing::FontSize
std::uint8_t FontSize
字体大小。
Definition: Font.h:73
YSLib::Drawing::GBinaryGroup::Y
_type Y
Definition: YGDIBase.h:305
YSLib::Drawing::Font
字体：字模，包含字型、样式和大小。
Definition: Font.h:589
YSLib::Drawing::GetHorizontalOf
YB_ATTR_nodiscard YB_PURE GetHorizontalOf
Definition: YGDI.h:146
CHRLib::enc
enc
Definition: CharacterProcessing.h:84
YB_UNLIKELY
#define YB_UNLIKELY(_expr)
分支预测提示。
Definition: ydef.h:828
YSLib::Drawing::Font::GetHeight
YB_ATTR_nodiscard YB_PURE FontSize GetHeight() const ynothrow
取字体对应的字符高度。
Definition: Font.cpp:541
platform::SPos
std::int16_t SPos
屏幕坐标度量。
Definition: Video.h:43
platform::bool
YB_ATTR_nodiscard std::FILE *fp bool
Definition: FileIO.h:1271
YSLib::Drawing::char32_t
YB_ATTR_nodiscard YB_PURE tr TextRegion &tr char32_t
Definition: TextLayout.h:93
YSLib::DS::UI::DualScreenReader::Line
@ Line
Definition: DSReader.h:69
ystdex::details::off
size_t off
Definition: operators.hpp:198
YSLib::DS::UI::DualScreenReader::Detach
void Detach()
从窗口分离。
Definition: DSReader.cpp:307
NPL::get
PDefH(void, LiftTermRef, TermNode &term, const TermNode &tm) ImplExpr(NPL ref get()
Definition: NPLA.h:1737
YSLib::DS::UI::DualScreenReader::Scroll
@ Scroll
Definition: DSReader.h:66
DSReader.h
适用于 DS 的双屏阅读器。
ystdex::cpp2017::begin
auto begin(_tRange &c) -> decltype(c.begin())
Definition: range.hpp:323
YSLib::Drawing::CompactPixmapEx::SetSize
const CompactPixmapEx &buf AlphaType pBufferAlpha sizeof(AlphaType) *size_t(GetAreaOf(GetSize()))) using CompactPixmap void SetSize(const Size &) override
重新设置缓冲区大小。
Definition: YGDI.cpp:171
YSLib::DS::UI::DualScreenReader::Execute
bool Execute(Command)
执行阅读器命令。
Definition: DSReader.cpp:320
YSLib::DS::UI::DualScreenReader::overread_line_n
std::uint16_t overread_line_n
读入文件结束后的空行数。
Definition: DSReader.h:105