Add ENABLE_DEVMODE flag

This commit is contained in:
David Capello 2017-08-15 15:47:06 -03:00
parent 2bee243c39
commit 4ed302e4b5
6 changed files with 51 additions and 10 deletions

View File

@ -77,6 +77,7 @@ option(ENABLE_TESTS "Compile unit tests" off)
option(ENABLE_BENCHMARKS "Compile benchmarks" off)
option(ENABLE_TRIAL_MODE "Compile the trial version" off)
option(ENABLE_STEAM "Compile with Steam library" off)
option(ENABLE_DEVMODE "Compile vesion for developers" off)
option(FULLSCREEN_PLATFORM "Enable fullscreen by default" off)
set(CUSTOM_WEBSITE_URL "" CACHE STRING "Enable custom local webserver to check updates")

View File

@ -58,9 +58,12 @@ because they don't depend on any other component.
# Debugging Tricks
* On Windows, you can use F5 to show the amount of used memory.
* On debug mode (when `_DEBUG` is defined), `Ctrl+Alt+Shift+Q` crashes
the application in case that you want to test the anticrash feature
or your need a memory dump file.
* On debug mode, you can use `Ctrl+Alt+Shift+R` to recover the active
document from the data recovery store.
When Aseprite is compiled with `ENABLE_DEVMODE`, you have the
following extra commands available:
* `F5`: On Windows shows the amount of used memory.
* `F1`: Switch/test Screen/UI Scaling values.
* `Ctrl+Alt+Shift+Q`: crashes the application in case that you want to
test the anticrash feature or your need a memory dump file.
* `Ctrl+Alt+Shift+R`: recover the active document from the data
recovery store.

View File

@ -569,3 +569,7 @@ if(ENABLE_STEAM)
add_definitions(-DENABLE_STEAM)
target_link_libraries(app-lib steam-lib)
endif()
if(ENABLE_DEVMODE)
add_definitions(-DENABLE_DEVMODE)
endif()

View File

@ -237,8 +237,8 @@ void App::run()
she::instance()->activateApp();
#endif
#if _DEBUG
// On OS X, when we compile Aseprite on Debug mode, we're using it
#if ENABLE_DEVMODE
// On OS X, when we compile Aseprite on devmode, we're using it
// outside an app bundle, so we must active the app explicitly.
she::instance()->activateApp();
#endif

View File

@ -46,7 +46,7 @@ void RefreshCommand::onExecute(Context* context)
app_refresh_screen();
// Print memory information
#if defined _WIN32 && defined _DEBUG
#if defined _WIN32 && defined ENABLE_DEVMODE
{
PROCESS_MEMORY_COUNTERS pmc;
if (::GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {

View File

@ -15,8 +15,10 @@
#include "app/commands/commands.h"
#include "app/commands/params.h"
#include "app/console.h"
#include "app/crash/data_recovery.h"
#include "app/document.h"
#include "app/ini_file.h"
#include "app/modules/editors.h"
#include "app/modules/gfx.h"
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
@ -362,7 +364,7 @@ bool CustomizedGuiManager::onProcessMessage(Message* msg)
break;
case kKeyDownMessage: {
#ifdef _DEBUG
#if ENABLE_DEVMODE
auto keymsg = static_cast<KeyMessage*>(msg);
// Ctrl+Shift+Q generates a crash (useful to test the anticrash feature)
@ -373,6 +375,37 @@ bool CustomizedGuiManager::onProcessMessage(Message* msg)
*p = 0;
}
// F1 switches screen/UI scaling
if (keymsg->scancode() == kKeyF1) {
she::Display* display = getDisplay();
int screenScale = display->scale();
int uiScale = ui::guiscale();
if (screenScale == 2 &&
uiScale == 1) {
screenScale = 1;
uiScale = 2;
}
else if (screenScale == 1 &&
uiScale == 2) {
screenScale = 1;
uiScale = 1;
}
else if (screenScale == 1 &&
uiScale == 1) {
screenScale = 2;
uiScale = 1;
}
if (uiScale != ui::guiscale()) {
ui::set_theme(ui::get_theme(), uiScale);
}
if (screenScale != display->scale()) {
display->setScale(screenScale);
setDisplay(display);
}
}
#ifdef ENABLE_DATA_RECOVERY
// Ctrl+Shift+R recover active sprite from the backup store
if (msg->ctrlPressed() &&