aseprite/src/app/commands/cmd_refresh.cpp

68 lines
1.5 KiB
C++
Raw Normal View History

2015-02-12 23:16:25 +08:00
// Aseprite
// Copyright (C) 2001-2017 David Capello
2015-02-12 23:16:25 +08:00
//
2016-08-27 04:02:58 +08:00
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "app/app.h"
#include "app/commands/command.h"
#include "app/ui/status_bar.h"
#include "ui/scale.h"
2012-06-18 09:49:58 +08:00
#include "ui/system.h"
#include "ui/theme.h"
#if defined _WIN32 && defined _DEBUG
#include <windows.h>
#include <psapi.h>
#endif
namespace app {
class RefreshCommand : public Command {
public:
RefreshCommand();
Command* clone() const override { return new RefreshCommand(*this); }
protected:
void onExecute(Context* context) override;
};
RefreshCommand::RefreshCommand()
: Command("Refresh", CmdUIOnlyFlag)
{
}
void RefreshCommand::onExecute(Context* context)
{
ui::set_theme(ui::get_theme(),
ui::guiscale());
app_refresh_screen();
// Print memory information
2017-08-16 02:47:06 +08:00
#if defined _WIN32 && defined ENABLE_DEVMODE
{
PROCESS_MEMORY_COUNTERS pmc;
if (::GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
StatusBar::instance()
->showTip(1000,
"Current memory: %.16g KB (%lu)\n"
"Peak of memory: %.16g KB (%lu)",
pmc.WorkingSetSize / 1024.0, pmc.WorkingSetSize,
pmc.PeakWorkingSetSize / 1024.0, pmc.PeakWorkingSetSize);
}
}
#endif
}
Command* CommandFactory::createRefreshCommand()
{
return new RefreshCommand;
}
} // namespace app