2015-02-12 23:16:25 +08:00
|
|
|
// Aseprite
|
2016-12-12 20:48:58 +08:00
|
|
|
// Copyright (C) 2001-2016 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.
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2012-01-06 06:45:03 +08:00
|
|
|
#include "config.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#endif
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
#include "app/app.h"
|
|
|
|
|
#include "app/commands/command.h"
|
|
|
|
|
#include "app/ui/status_bar.h"
|
2012-06-18 09:49:58 +08:00
|
|
|
#include "ui/system.h"
|
|
|
|
|
#include "ui/theme.h"
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2015-02-12 21:55:58 +08:00
|
|
|
#if defined _WIN32 && defined _DEBUG
|
2014-09-03 11:01:30 +08:00
|
|
|
#include <windows.h>
|
2015-04-17 23:24:33 +08:00
|
|
|
|
2012-02-13 10:21:06 +08:00
|
|
|
#include <psapi.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
namespace app {
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
class RefreshCommand : public Command {
|
2012-01-06 06:45:03 +08:00
|
|
|
public:
|
|
|
|
|
RefreshCommand();
|
2014-08-15 10:07:47 +08:00
|
|
|
Command* clone() const override { return new RefreshCommand(*this); }
|
2012-01-06 06:45:03 +08:00
|
|
|
|
|
|
|
|
protected:
|
2015-10-01 03:34:43 +08:00
|
|
|
void onExecute(Context* context) override;
|
2012-01-06 06:45:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
RefreshCommand::RefreshCommand()
|
|
|
|
|
: Command("Refresh",
|
|
|
|
|
"Refresh",
|
|
|
|
|
CmdUIOnlyFlag)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RefreshCommand::onExecute(Context* context)
|
|
|
|
|
{
|
2016-12-12 20:48:58 +08:00
|
|
|
ui::get_theme()->regenerate();
|
2013-03-12 07:29:45 +08:00
|
|
|
app_refresh_screen();
|
2012-01-06 06:45:03 +08:00
|
|
|
|
|
|
|
|
// Print memory information
|
2015-02-12 23:46:56 +08:00
|
|
|
#if defined _WIN32 && defined _DEBUG
|
2012-01-06 06:45:03 +08:00
|
|
|
{
|
|
|
|
|
PROCESS_MEMORY_COUNTERS pmc;
|
2013-10-15 06:58:11 +08:00
|
|
|
if (::GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
|
2012-07-10 00:20:58 +08:00
|
|
|
StatusBar::instance()
|
2012-01-06 06:45:03 +08:00
|
|
|
->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;
|
|
|
|
|
}
|
2013-08-06 08:20:19 +08:00
|
|
|
|
|
|
|
|
} // namespace app
|