| 
									
										
										
										
											2015-02-12 23:16:25 +08:00
										 |  |  | // Aseprite
 | 
					
						
							|  |  |  | // Copyright (C) 2001-2015  David Capello
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License version 2 as
 | 
					
						
							|  |  |  | // published by the Free Software Foundation.
 | 
					
						
							| 
									
										
										
										
											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/skin/skin_theme.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>
 | 
					
						
							| 
									
										
										
										
											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: | 
					
						
							|  |  |  |   void onExecute(Context* context); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | RefreshCommand::RefreshCommand() | 
					
						
							|  |  |  |   : Command("Refresh", | 
					
						
							|  |  |  |             "Refresh", | 
					
						
							|  |  |  |             CmdUIOnlyFlag) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void RefreshCommand::onExecute(Context* context) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   // Reload skin
 | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2013-08-06 08:20:19 +08:00
										 |  |  |     skin::SkinTheme* theme = (skin::SkinTheme*)ui::CurrentTheme::get(); | 
					
						
							| 
									
										
										
										
											2012-01-06 06:45:03 +08:00
										 |  |  |     theme->reload_skin(); | 
					
						
							|  |  |  |     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
 |