mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-11 09:40:42 +00:00
Fix issue #277, LoadPalette command can change the default palette
This commit is contained in:
parent
ddf4a13490
commit
49cf2bdcf0
@ -134,11 +134,14 @@ App::App(int argc, const char* argv[])
|
|||||||
RenderEngine::loadConfig();
|
RenderEngine::loadConfig();
|
||||||
|
|
||||||
// Default palette.
|
// Default palette.
|
||||||
if (!options.paletteFileName().empty()) {
|
base::string palFile(!options.paletteFileName().empty() ?
|
||||||
const char* palFile = options.paletteFileName().c_str();
|
options.paletteFileName():
|
||||||
PRINTF("Loading custom palette file: %s\n", palFile);
|
base::string(get_config_string("GfxMode", "Palette", "")));
|
||||||
|
|
||||||
base::UniquePtr<Palette> pal(Palette::load(palFile));
|
if (!palFile.empty()) {
|
||||||
|
PRINTF("Loading custom palette file: %s\n", palFile.c_str());
|
||||||
|
|
||||||
|
base::UniquePtr<Palette> pal(Palette::load(palFile.c_str()));
|
||||||
if (pal.get() == NULL)
|
if (pal.get() == NULL)
|
||||||
throw base::Exception("Error loading default palette from: %s", palFile);
|
throw base::Exception("Error loading default palette from: %s", palFile);
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "app/context_access.h"
|
#include "app/context_access.h"
|
||||||
#include "app/document_api.h"
|
#include "app/document_api.h"
|
||||||
#include "app/file_selector.h"
|
#include "app/file_selector.h"
|
||||||
|
#include "app/ini_file.h"
|
||||||
#include "app/modules/palettes.h"
|
#include "app/modules/palettes.h"
|
||||||
#include "app/undo_transaction.h"
|
#include "app/undo_transaction.h"
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
@ -70,6 +71,7 @@ void LoadPaletteCommand::onExecute(Context* context)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
set_default_palette(palette);
|
set_default_palette(palette);
|
||||||
|
set_config_string("GfxMode", "Palette", filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the palette calling the hooks
|
// Set the palette calling the hooks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user