diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb42bc23..24276954 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,9 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
The **"Breaking Changes"** listed below are changes that have been made in the decompilation projects (e.g. pokeemerald), which porymap requires in order to work properly. It also includes changes to the scripting API that may change the behavior of existing porymap scripts. If porymap is used with a project or API script that is not up-to-date with the breaking changes, then porymap will likely break or behave improperly.
## [Unreleased]
+### Changed
+- The Palette Editor now remembers the Bit Depth setting.
+
### Fixed
- Fix text boxes in the Palette Editor calculating color incorrectly.
diff --git a/forms/paletteeditor.ui b/forms/paletteeditor.ui
index 35864675..1cd7c959 100644
--- a/forms/paletteeditor.ui
+++ b/forms/paletteeditor.ui
@@ -5051,7 +5051,7 @@
-
-
+
Palette
@@ -5096,9 +5096,6 @@
24
-
- true
-
diff --git a/include/config.h b/include/config.h
index af649e8f..e99b535c 100644
--- a/include/config.h
+++ b/include/config.h
@@ -81,6 +81,7 @@ public:
void setTheme(QString theme);
void setTextEditorOpenFolder(const QString &command);
void setTextEditorGotoLine(const QString &command);
+ void setPaletteEditorBitDepth(int bitDepth);
QString getRecentProject();
bool getReopenOnLaunch();
MapSortOrder getMapSortOrder();
@@ -100,6 +101,7 @@ public:
QString getTheme();
QString getTextEditorOpenFolder();
QString getTextEditorGotoLine();
+ int getPaletteEditorBitDepth();
protected:
virtual QString getConfigFilepath() override;
virtual void parseConfigKeyValue(QString key, QString value) override;
@@ -135,6 +137,7 @@ private:
QString theme;
QString textEditorOpenFolder;
QString textEditorGotoLine;
+ int paletteEditorBitDepth;
};
extern PorymapConfig porymapConfig;
diff --git a/src/config.cpp b/src/config.cpp
index b1f2f03f..7ece2555 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -246,6 +246,11 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
this->textEditorOpenFolder = value;
} else if (key == "text_editor_goto_line") {
this->textEditorGotoLine = value;
+ } else if (key == "palette_editor_bit_depth") {
+ this->paletteEditorBitDepth = getConfigInteger(key, value, 15, 24, 24);
+ if (this->paletteEditorBitDepth != 15 && this->paletteEditorBitDepth != 24){
+ this->paletteEditorBitDepth = 24;
+ }
} else {
logWarn(QString("Invalid config key found in config file %1: '%2'").arg(this->getConfigFilepath()).arg(key));
}
@@ -278,6 +283,7 @@ QMap PorymapConfig::getKeyValueMap() {
map.insert("theme", this->theme);
map.insert("text_editor_open_directory", this->textEditorOpenFolder);
map.insert("text_editor_goto_line", this->textEditorGotoLine);
+ map.insert("palette_editor_bit_depth", QString("%1").arg(this->paletteEditorBitDepth));
return map;
}
@@ -400,6 +406,11 @@ void PorymapConfig::setTextEditorGotoLine(const QString &command) {
this->save();
}
+void PorymapConfig::setPaletteEditorBitDepth(int bitDepth) {
+ this->paletteEditorBitDepth = bitDepth;
+ this->save();
+}
+
QString PorymapConfig::getRecentProject() {
return this->recentProject;
}
@@ -498,6 +509,10 @@ QString PorymapConfig::getTextEditorGotoLine() {
return this->textEditorGotoLine;
}
+int PorymapConfig::getPaletteEditorBitDepth() {
+ return this->paletteEditorBitDepth;
+}
+
const QMap baseGameVersionMap = {
{BaseGameVersion::pokeruby, "pokeruby"},
{BaseGameVersion::pokefirered, "pokefirered"},
diff --git a/src/ui/paletteeditor.cpp b/src/ui/paletteeditor.cpp
index f56902a1..7422d7db 100644
--- a/src/ui/paletteeditor.cpp
+++ b/src/ui/paletteeditor.cpp
@@ -87,7 +87,13 @@ PaletteEditor::PaletteEditor(Project *project, Tileset *primaryTileset, Tileset
connect(this->pickButtons[i], &QToolButton::clicked, [this, i](){ this->pickColor(i); });
}
- setBitDepth(24);
+ int bitDepth = porymapConfig.getPaletteEditorBitDepth();
+ if (bitDepth == 15) {
+ this->ui->bit_depth_15->setChecked(true);
+ } else {
+ this->ui->bit_depth_24->setChecked(true);
+ }
+ setBitDepth(bitDepth);
// Connect bit depth buttons
connect(this->ui->bit_depth_15, &QRadioButton::toggled, [this](bool checked){ if (checked) this->setBitDepth(15); });
@@ -227,6 +233,7 @@ void PaletteEditor::setBitDepth(int bits) {
break;
}
this->bitDepth = bits;
+ porymapConfig.setPaletteEditorBitDepth(bits);
refreshColorUis();
setSignalsEnabled(true);
}