YSTest  PreAlpha_b500_20140530
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
ShlReader.h
浏览该文件的文档.
1 /*
2  © 2011-2013 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 #ifndef INC_YReader_ShlReader_h_
29 #define INC_YReader_ShlReader_h_ 1
30 
31 #include "Shells.h"
32 #include "DSReader.h"
33 #include "HexBrowser.h"
34 #include "ReaderSettingUI.h"
35 #include "BookmarkUI.h"
36 
37 namespace YReader
38 {
39 
40 class ReaderBox : public Control
41 {
42 public:
45 
83 
84  ReaderBox(const Rect&);
85 
89 
90 private:
92  void
93  InitializeProgress();
94 
95 public:
100  void
101  UpdateData(DualScreenReader&);
102 };
103 
104 
105 class TextInfoBox : public DialogBox
106 {
107 public:
118 
119  TextInfoBox();
120 
125  virtual void
127 
128  void
129  UpdateData(DualScreenReader&);
130 };
131 
132 
133 class FileInfoPanel : public Panel
134 {
135 public:
136  Label lblPath, lblSize, lblAccessTime, lblModifiedTime, lblOperations;
137 
138  FileInfoPanel();
139 };
140 
141 
142 class ShlReader : public ShlDS
143 {
144 protected:
154  std::function<void()> fBackgroundTask;
161  bool bExit;
162 
163 public:
169  ShlReader(const IO::Path&,
170  const shared_ptr<Desktop>& = {}, const shared_ptr<Desktop>& = {});
171 
176  void
177  Exit();
178 
180  static BookmarkList
181  LoadBookmarks(const string&);
182 
188  static ReaderSetting
189  LoadGlobalConfiguration();
190 
195  void
196  OnInput() override;
197 
199  static void
200  SaveBookmarks(const string&, const BookmarkList&);
201 
206  static void
207  SaveGlobalConfiguration(const ReaderSetting&);
208 };
209 
210 
215 class ShlTextReader : public ShlReader
216 {
217 private:
219 
220  class BaseSession : public GShellSession<ShlTextReader>
221  {
222  private:
225 
226  public:
228  ~BaseSession() override;
229  };
231  {
232  public:
234  ~SettingSession() override;
235  };
237  {
238  public:
240  };
242 
243 public:
254 
255 protected:
276  size_t nClick;
278 
279  DualScreenReader reader;
284  unique_ptr<TextFile> pTextFile;
287 
292 
293 private:
295  unique_ptr<BaseSession> session_ptr;
296 
297 public:
303  ShlTextReader(const IO::Path&,
304  const shared_ptr<Desktop>& = {}, const shared_ptr<Desktop>& = {});
309  ~ShlTextReader() override;
310 
312  DefGetter(const ynothrow, Bookmark::PositionType, ReaderPosition,
313  reader.GetTopPosition())
314 
316  string
317  GetSlice(Bookmark::PositionType, string::size_type);
318 
319 private:
324  void
326 
327 public:
333  void
334  LoadFile(const IO::Path&);
335 
341  bool
342  Locate(Bookmark::PositionType);
343 
348  void
349  Scroll();
350 
351 private:
352  void
353  ShowMenu(Menu::ID, const Point&);
354 
359  void
360  StartAutoScroll();
361 
366  void
367  StopAutoScroll();
368 
374  void
375  Switch(Text::Encoding);
376 
382  void
383  UpdateReadingList(bool);
384 
385 public:
391  void
392  UpdateButtons();
393 
394 private:
396  void
397  OnClick(CursorEventArgs&&);
398 
399  void
400  OnKeyDown(KeyEventArgs&&);
401 };
402 
403 
408 class ShlHexBrowser : public ShlReader
409 {
410 public:
413 
419  ShlHexBrowser(const IO::Path&,
420  const shared_ptr<Desktop>& = {}, const shared_ptr<Desktop>& = {});
421 };
422 
423 } // namespace YReader;
424 
425 #endif
426 
ReadingList & LastRead
近期浏览记录。
Definition: ShlReader.h:248
Shell 连接会话。
Definition: ShellHelper.h:67
#define DefWidgetMemberIteration(...)
定义部件成员下标及部件成员迭代器起始、终止和范围操作。
bool tmrScrollActive
滚屏计时器激活状态。
Definition: ShlReader.h:265
Button btnSetting
设置按钮。
Definition: ShlReader.h:55
书签管理面板。
Definition: BookmarkUI.h:44
Button btnBookmark
书签管理按钮。
Definition: ShlReader.h:65
Button btnInfo
显示信息框按钮。
Definition: ShlReader.h:60
Timers::Timer tmrScroll
滚屏计时器。
Definition: ShlReader.h:260
十六进制视图区域。
Definition: HexBrowser.h:144
部件绘制参数。
Definition: ywgtevt.h:276
std::function< void()> fBackgroundTask
背景任务:用于滚屏。
Definition: ShlReader.h:154
成员下标迭代器。
Definition: iterator.hpp:1380
bool bExit
退出标识。
Definition: ShlReader.h:161
文本阅读器 Shell 。
Definition: ShlReader.h:215
size_t PositionType
文件位置类型。
Definition: ReadingList.h:49
面板。
Definition: ypanel.h:45
阅读器设置。
Definition: ReaderSetting.h:41
按钮。
Definition: button.h:116
Button btnNext
前进按钮。
Definition: ShlReader.h:80
阅读器设置界面。
书签界面。
对话框。
Definition: uicontx.h:46
菜单宿主。
Definition: menu.h:184
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:180
FileInfoPanel pnlFileInfo
Definition: ShlReader.h:412
控件。
Definition: ycontrol.h:275
输入计时器。
Definition: ygui.h:48
适用于 DS 的双屏阅读器。
YF_API void Execute(GUIApplication &, shared_ptr< Shell >=make_shared< Shells::GUIShell >())
执行程序主消息循环。
size_t ID
菜单标识类型。
Definition: menu.h:55
Label lblTop
指示迭代器位置。
Definition: ShlReader.h:115
unique_ptr< TextFile > pTextFile
Definition: ShlReader.h:284
BookmarkPanel pnlBookmark
书签管理面板。
Definition: ShlReader.h:291
GBinaryGroup< SPos > Point
屏幕二维点(直角坐标表示)。
Definition: ygdibase.h:235
void UpdateData(DualScreenReader &)
更新进度数据。
Definition: ShlReader.cpp:95
IO::Path CurrentPath
当前路径。
Definition: ShlReader.h:149
ProgressBar pbReader
Definition: ShlReader.h:81
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
标签。
Definition: label.h:104
vector< Bookmark::PositionType > BookmarkList
书签列表类型。
Definition: ReadingList.h:82
TextInfoBox boxTextInfo
Definition: ShlReader.h:281
Button btnMenu
弹出菜单按钮。
Definition: ShlReader.h:50
设置面板。
十六进制浏览器。
SettingPanel pnlSetting
设置面板。
Definition: ShlReader.h:283
Button btnPrev
后退按钮。
Definition: ShlReader.h:75
Shell 框架逻辑。
unique_ptr< BaseSession > session_ptr
Definition: ShlReader.h:295
Button btnReturn
返回按钮。
Definition: ShlReader.h:70
HexViewArea HexArea
Definition: ShlReader.h:411
ReaderSetting CurrentSetting
当前阅读器设置。
Definition: ShlReader.h:253
virtual void Refresh(PaintEventArgs &&)
刷新:按指定参数绘制界面并更新状态。
Definition: ywidget.cpp:264
DualScreenReader reader
Definition: ShlReader.h:279
阅读记录。
Definition: ReadingList.h:90
InputTimer tmrInput
按键计时器。
Definition: ShlReader.h:271
ReaderBox(const Rect &)
Definition: ShlReader.cpp:62
_type ValueType
值类型。
Definition: ywgtevt.h:255
计时器。
Definition: ytimer.h:100
十六进制浏览器 Shell 。
Definition: ShlReader.h:408
size_t nClick
记录点击次数。
Definition: ShlReader.h:276
进度条。
Definition: progress.h:46