52 GetEntryType(
const string& path)
54 using namespace EnrtySpace;
66 "txt",
"c",
"cpp",
"h",
"hpp",
"ini",
"xml"};
74 if(std::any_of(exts, exts +
arrlen(exts), [&](
const char* str){
75 return std::strcmp(ext.c_str(), str) == 0;
87 CheckReaderEnability(FileBox& fb, CheckBox& hex)
91 using namespace EnrtySpace;
93 switch(GetEntryType(fb.GetList()[fb.GetSelectedIndex()]))
98 return hex.IsTicked();
108 CheckBackgroundPreview(CheckButton&
cbPreview,
size_t up_i,
size_t dn_i)
110 if(cbPreview.IsTicked())
112 auto& app(FetchGlobalInstance<DSApplication>());
114 app.GetScreenUp().Update(
FetchImage(up_i)->GetBufferPtr());
115 app.GetScreenDown().Update(
FetchImage(dn_i)->GetBufferPtr());
124 const shared_ptr<Desktop>& h_dsk_up,
const shared_ptr<Desktop>& h_dsk_dn)
125 :
ShlDS(h_dsk_up, h_dsk_dn),
130 cbHex({142, 142, 103, 18}),
cbFPS({10, 90, 73, 18}),
136 fpsCounter(500000000ULL)
139 auto& dsk_up(GetDesktopUp());
140 auto& dsk_dn(GetDesktopDown());
148 fbMain.SetRenderer(make_unique<BufferedRenderer>(
true)),
149 pnlSetting.SetRenderer(make_unique<BufferedRenderer>()),
153 dsk_up.Background = ImageBrush(
FetchImage(1)),
154 dsk_dn.Background = ImageBrush(
FetchImage(2)),
160 btnOK.Text = u
"确定(A)",
166 cbHex.Text = u
"显示十六进制",
167 cbFPS.Text = u
"显示 FPS",
168 cbPreview.Text = u
"切换背景时预览",
181 cbHex.Background = SolidBrush(
Color(0xFF, 0xFF, 0xE0)),
186 this, std::placeholders::_1),
190 fbMain.GetViewChanged() += [
this](UIEventArgs&&){
197 FetchEvent<Click>(
btnTest) += [
this](TouchEventArgs&&){
200 FetchEvent<Click>(
btnOK) += [
this](TouchEventArgs&&){
203 const auto& path(
fbMain.GetPath());
208 const auto h_up(GetDesktopUpHandle());
210 const bool b(GetEntryType(s) == EnrtySpace::Text
211 && !
cbHex.IsTicked());
213 PostMessage<SM_TASK>(0xF8, [=]{
216 NowShellTo(ystdex::make_shared<ShlTextReader>(path,
219 NowShellTo(ystdex::make_shared<ShlHexBrowser>(path,
228 FetchEvent<Click>(
cbFPS) += [
this](TouchEventArgs&&){
231 FetchEvent<Click>(
cbHex) += [
this](TouchEventArgs&&){
235 FetchEvent<Move>(
pnlSetting) += [
this](UIEventArgs&&){
241 FetchEvent<TouchDown>(
pnlSetting) += [
this](TouchEventArgs&&){
242 struct ::mallinfo t(::mallinfo());
245 t.arena, t.ordblks, t.uordblks, t.fordblks, t.keepcost);
249 FetchEvent<Click>(
pnlSetting) += [
this](TouchEventArgs&&){
256 FetchEvent<Click>(
btnTestEx) += [
this](TouchEventArgs&& e){
257 const auto& k(e.GetKeys());
258 auto& btn(polymorphic_downcast<Button&>(e.GetSender()));
269 FetchEvent<Enter>(
btnEnterTest) += [](TouchEventArgs&& e){
270 auto& btn(ystdex::polymorphic_downcast<Button&>(e.GetSender()));
272 btn.Text = u
"Enter: " + String(
to_string(e));
275 FetchEvent<Leave>(
btnEnterTest) += [](TouchEventArgs&& e){
276 auto& btn(ystdex::polymorphic_downcast<Button&>(e.GetSender()));
278 btn.Text = u
"Leave: " + String(
to_string(e));
282 FetchEvent<Click>(
btnMenu) += [
this](TouchEventArgs&&){
295 auto& dsk_up(GetDesktopUp());
296 auto& dsk_dn(GetDesktopDown());
306 dsk_dn.Background = ImageBrush(
FetchImage(up_i + 1)));
307 CheckBackgroundPreview(cbPreview, up_i, up_i + 1);
312 auto& dsk_up(GetDesktopUp());
313 auto& dsk_dn(GetDesktopDown());
323 dsk_dn.Background = ImageBrush(
FetchImage(up_i + 1)));
324 CheckBackgroundPreview(cbPreview, up_i, up_i + 1);
333 auto& m1(*(
ynew Menu({},
334 share_raw(
new TextList::ListType{u
"测试", u
"关于", u
"退出"}), 1u)));
335 auto& m2(*(
ynew Menu({},
336 share_raw(
new TextList::ListType{u
"项目1", u
"项目2"}), 2u)));
352 MinGW32::TestFramework(e.Value);
356 m1 += make_pair(0u, &m2);
369 using namespace ColorSpace;
375 auto& g(ystdex::polymorphic_downcast<BufferedRenderer&>(
376 GetDesktopUp().GetRenderer()).GetContext());
380 std::sprintf(strt,
"FPS: %u.%03u", t / 1000, t % 1000);