Fix some issue with saved defaults (selection mode and snap to grid)

These two preferences are confusing when saved with non-default
values. For example, snap to grid should be almost always turned off
and turned on only when the user do it explicitly.

The other one is the subtraction selection mode, if we save that as a
default mode, users will find that the selection tool stop working
when the program is re-started.

Both of these issues generated user support over all these years.
This commit is contained in:
David Capello 2020-03-30 10:39:07 -03:00
parent d358e6055f
commit 9609e541e5
2 changed files with 14 additions and 3 deletions

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2018-2020 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -64,6 +64,13 @@ Preferences::Preferences()
});
doc::Sprite::SetDefaultGridBounds(defPref.grid.bounds());
// Reset confusing defaults for a new instance of the program.
defPref.grid.snap(false);
if (selection.mode() != gen::SelectionMode::DEFAULT &&
selection.mode() != gen::SelectionMode::ADD) {
selection.mode(gen::SelectionMode::DEFAULT);
}
// Hide the menu bar depending on:
// 1. this is the first run of the program
// 2. the native menu bar is available
@ -166,6 +173,10 @@ DocumentPreferences& Preferences::document(const Doc* doc)
// Load specific settings of this document
serializeDocPref(doc, docPref, false);
// Turn off snap to grid setting (it's confusing for most of the
// users to load this setting).
docPref->grid.snap.setValueAndDefault(false);
return *docPref;
}
}

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2018-2020 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -55,7 +55,6 @@ namespace app {
Preferences();
~Preferences();
void load();
void save();
// Returns true if the given option was set by the user or false
@ -80,6 +79,7 @@ namespace app {
void onRemoveDocument(Doc* doc) override;
private:
void load();
std::string docConfigFileName(const Doc* doc);
void serializeDocPref(const Doc* doc, app::DocumentPreferences* docPref, bool save);