This commit is contained in:
parent
945a55f94a
commit
84cb03d807
@ -98,6 +98,12 @@ void PaletteEditorImGui::drawColumn(ox::CStringView txt) noexcept {
|
|||||||
ImGui::Text("%s", txt.c_str());
|
ImGui::Text("%s", txt.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaletteEditorImGui::colorInput(ox::CStringView label, int &v, bool &inputFocused) noexcept {
|
||||||
|
ImGui::InputInt(label.c_str(), &v, 1, 5);
|
||||||
|
inputFocused = inputFocused || ImGui::IsItemFocused();
|
||||||
|
v = ox::max(v, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void PaletteEditorImGui::drawColorsEditor() noexcept {
|
void PaletteEditorImGui::drawColorsEditor() noexcept {
|
||||||
constexpr auto tableFlags = ImGuiTableFlags_RowBg;
|
constexpr auto tableFlags = ImGuiTableFlags_RowBg;
|
||||||
auto const colorsSz = ImGui::GetContentRegionAvail();
|
auto const colorsSz = ImGui::GetContentRegionAvail();
|
||||||
@ -240,19 +246,13 @@ void PaletteEditorImGui::drawColorEditor() noexcept {
|
|||||||
ImGui::InputText("Name", name.data(), name.cap() + 1);
|
ImGui::InputText("Name", name.data(), name.cap() + 1);
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
bool inputFocused = false;
|
bool inputFocused = false;
|
||||||
ImGui::InputInt("Red", &r, 1, 5);
|
colorInput("Red", r, inputFocused);
|
||||||
inputFocused |= ImGui::IsItemFocused();
|
colorInput("Green", g, inputFocused);
|
||||||
ImGui::InputInt("Green", &g, 1, 5);
|
colorInput("Blue", b, inputFocused);
|
||||||
inputFocused |= ImGui::IsItemFocused();
|
|
||||||
ImGui::InputInt("Blue", &b, 1, 5);
|
|
||||||
inputFocused |= ImGui::IsItemFocused();
|
|
||||||
if (ig::PushButton("Apply to all pages", {-1, ig::BtnSz.y})) {
|
if (ig::PushButton("Apply to all pages", {-1, ig::BtnSz.y})) {
|
||||||
std::ignore = pushCommand<ApplyColorAllPagesCommand>(
|
std::ignore = pushCommand<ApplyColorAllPagesCommand>(
|
||||||
m_pal, m_page, m_selectedColorRow);
|
m_pal, m_page, m_selectedColorRow);
|
||||||
}
|
}
|
||||||
r = ox::max(r, 0);
|
|
||||||
g = ox::max(g, 0);
|
|
||||||
b = ox::max(b, 0);
|
|
||||||
if (!inputFocused) {
|
if (!inputFocused) {
|
||||||
for (auto i = 0u; i < ox::min<size_t>(10, largestPage(m_pal)); ++i) {
|
for (auto i = 0u; i < ox::min<size_t>(10, largestPage(m_pal)); ++i) {
|
||||||
auto const key = static_cast<ImGuiKey>(ImGuiKey_1 + i);
|
auto const key = static_cast<ImGuiKey>(ImGuiKey_1 + i);
|
||||||
|
@ -56,6 +56,8 @@ class PaletteEditorImGui: public studio::Editor {
|
|||||||
drawColumn(ox::itoa(i));
|
drawColumn(ox::itoa(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void colorInput(ox::CStringView label, int &v, bool &inputFocused) noexcept;
|
||||||
|
|
||||||
void drawColorsEditor() noexcept;
|
void drawColorsEditor() noexcept;
|
||||||
|
|
||||||
void drawPagesEditor() noexcept;
|
void drawPagesEditor() noexcept;
|
||||||
|
Loading…
Reference in New Issue
Block a user