mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-28 16:20:50 +00:00
Fix resetting default grid preferences (fix #1380)
This commit is contained in:
parent
dd381131c7
commit
fbb0cdcbe2
@ -159,27 +159,36 @@ std::string Preferences::docConfigFileName(const app::Document* doc)
|
|||||||
|
|
||||||
void Preferences::serializeDocPref(const app::Document* doc, app::DocumentPreferences* docPref, bool save)
|
void Preferences::serializeDocPref(const app::Document* doc, app::DocumentPreferences* docPref, bool save)
|
||||||
{
|
{
|
||||||
bool specific_file = false;
|
bool flush_config = false;
|
||||||
|
|
||||||
if (doc) {
|
if (doc) {
|
||||||
if (doc->isAssociatedToFile()) {
|
// We do nothing if the document isn't associated to a file and we
|
||||||
push_config_state();
|
// want to save its specific preferences.
|
||||||
set_config_file(docConfigFileName(doc).c_str());
|
if (save && !doc->isAssociatedToFile())
|
||||||
specific_file = true;
|
|
||||||
}
|
|
||||||
else if (save)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// We always push a new configuration file in the stack to avoid
|
||||||
|
// modifying the default preferences when a document in "doc" is
|
||||||
|
// specified.
|
||||||
|
push_config_state();
|
||||||
|
if (doc->isAssociatedToFile()) {
|
||||||
|
set_config_file(docConfigFileName(doc).c_str());
|
||||||
|
flush_config = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save)
|
if (save) {
|
||||||
docPref->save();
|
docPref->save();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// Load default preferences, or preferences from .ini file.
|
// Load default preferences, or preferences from .ini file.
|
||||||
docPref->load();
|
docPref->load();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (specific_file) {
|
if (doc) {
|
||||||
flush_config_file();
|
if (flush_config)
|
||||||
|
flush_config_file();
|
||||||
|
|
||||||
pop_config_state();
|
pop_config_state();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user