housekeeping

This commit is contained in:
scawful
2024-05-24 19:53:06 -04:00
parent 58a5febf8e
commit 4b4fe33dc6
4 changed files with 9 additions and 6 deletions

View File

@@ -5,8 +5,6 @@
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#define IMGUI_DEFINE_MATH_OPERATORS
#define BASIC_BUTTON(w) if (ImGui::Button(w)) #define BASIC_BUTTON(w) if (ImGui::Button(w))
#define TAB_BAR(w) if (ImGui::BeginTabBar(w)) { #define TAB_BAR(w) if (ImGui::BeginTabBar(w)) {

View File

@@ -156,8 +156,8 @@ absl::Status PaletteEditor::DrawPaletteGroup(int category) {
return absl::NotFoundError("ROM not open, no palettes to display"); return absl::NotFoundError("ROM not open, no palettes to display");
} }
std::string group_name = kPaletteGroupNames[category].data(); gfx::PaletteGroup palette_group =
auto palette_group = *rom()->palette_group().get_group(group_name); *rom()->palette_group().get_group(kPaletteGroupNames[category].data());
const auto size = palette_group.size(); const auto size = palette_group.size();
static bool edit_color = false; static bool edit_color = false;
@@ -166,7 +166,7 @@ absl::Status PaletteEditor::DrawPaletteGroup(int category) {
// rom()->resource_label()->SelectableLabelWithNameEdit( // rom()->resource_label()->SelectableLabelWithNameEdit(
// false, "Palette Group Name", std::to_string(j), // false, "Palette Group Name", std::to_string(j),
// std::string(kPaletteGroupNames[category])); // std::string(kPaletteGroupNames[category]));
auto palette = palette_group.mutable_palette(j); gfx::SnesPalette* palette = palette_group.mutable_palette(j);
auto pal_size = palette->size(); auto pal_size = palette->size();
for (int n = 0; n < pal_size; n++) { for (int n = 0; n < pal_size; n++) {

View File

@@ -148,6 +148,11 @@ class Canvas {
} }
auto mutable_labels(int i) { auto mutable_labels(int i) {
if (i >= labels_.size()) { if (i >= labels_.size()) {
int x = i;
while (x >= labels_.size()) {
labels_.push_back(ImVector<std::string>());
x--;
}
labels_.push_back(ImVector<std::string>()); labels_.push_back(ImVector<std::string>());
} }
return &labels_[i]; return &labels_[i];

View File

@@ -12,7 +12,7 @@ void BeginWindowWithDisplaySettings(const char* id, bool* active,
ImGuiWindowFlags flags) { ImGuiWindowFlags flags) {
ImGuiStyle* ref = &ImGui::GetStyle(); ImGuiStyle* ref = &ImGui::GetStyle();
static float childBgOpacity = 0.75f; static float childBgOpacity = 0.75f;
auto color = ImVec4(0.f, 0.f, 0.f, childBgOpacity); auto color = ref->Colors[ImGuiCol_WindowBg];
ImGui::PushStyleColor(ImGuiCol_WindowBg, color); ImGui::PushStyleColor(ImGuiCol_WindowBg, color);
ImGui::PushStyleColor(ImGuiCol_ChildBg, color); ImGui::PushStyleColor(ImGuiCol_ChildBg, color);