mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 03:39:51 +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();
|
||||
|
||||
// Default palette.
|
||||
if (!options.paletteFileName().empty()) {
|
||||
const char* palFile = options.paletteFileName().c_str();
|
||||
PRINTF("Loading custom palette file: %s\n", palFile);
|
||||
base::string palFile(!options.paletteFileName().empty() ?
|
||||
options.paletteFileName():
|
||||
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)
|
||||
throw base::Exception("Error loading default palette from: %s", palFile);
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/file_selector.h"
|
||||
#include "app/ini_file.h"
|
||||
#include "app/modules/palettes.h"
|
||||
#include "app/undo_transaction.h"
|
||||
#include "base/compiler_specific.h"
|
||||
@ -70,6 +71,7 @@ void LoadPaletteCommand::onExecute(Context* context)
|
||||
}
|
||||
else {
|
||||
set_default_palette(palette);
|
||||
set_config_string("GfxMode", "Palette", filename.c_str());
|
||||
}
|
||||
|
||||
// Set the palette calling the hooks
|
||||
|
Loading…
x
Reference in New Issue
Block a user