|
@@ -467,7 +467,7 @@ struct ViewButton : MenuButton { |
|
|
|
|
|
|
|
|
// Add color items |
|
|
// Add color items |
|
|
for (size_t i = 0; i < settings::cableColors.size(); i++) { |
|
|
for (size_t i = 0; i < settings::cableColors.size(); i++) { |
|
|
NVGcolor& color = settings::cableColors[i]; |
|
|
|
|
|
|
|
|
NVGcolor color = settings::cableColors[i]; |
|
|
ui::ColorDotMenuItem* item = createSubmenuItem<ui::ColorDotMenuItem>(string::uppercase(color::toHexString(color)), string::f("%d", int(i + 1)), [=](ui::Menu* menu) { |
|
|
ui::ColorDotMenuItem* item = createSubmenuItem<ui::ColorDotMenuItem>(string::uppercase(color::toHexString(color)), string::f("%d", int(i + 1)), [=](ui::Menu* menu) { |
|
|
// Helper for launching color dialog |
|
|
// Helper for launching color dialog |
|
|
auto selectColor = [](NVGcolor color) { |
|
|
auto selectColor = [](NVGcolor color) { |
|
@@ -482,16 +482,18 @@ struct ViewButton : MenuButton { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
menu->addChild(createMenuItem("Set color", "", [=]() { |
|
|
menu->addChild(createMenuItem("Set color", "", [=]() { |
|
|
|
|
|
if (i >= settings::cableColors.size()) |
|
|
|
|
|
return; |
|
|
NVGcolor newColor = selectColor(color); |
|
|
NVGcolor newColor = selectColor(color); |
|
|
std::memcpy(&settings::cableColors[i], &newColor, sizeof(newColor)); |
|
|
std::memcpy(&settings::cableColors[i], &newColor, sizeof(newColor)); |
|
|
}, false, true)); |
|
|
}, false, true)); |
|
|
menu->addChild(createMenuItem("New color above", "", [=]() { |
|
|
menu->addChild(createMenuItem("New color above", "", [=]() { |
|
|
if (i > settings::cableColors.size()) |
|
|
|
|
|
|
|
|
if (i >= settings::cableColors.size()) |
|
|
return; |
|
|
return; |
|
|
settings::cableColors.insert(settings::cableColors.begin() + i, selectColor(color)); |
|
|
settings::cableColors.insert(settings::cableColors.begin() + i, selectColor(color)); |
|
|
}, false, true)); |
|
|
}, false, true)); |
|
|
menu->addChild(createMenuItem("New color below", "", [=]() { |
|
|
menu->addChild(createMenuItem("New color below", "", [=]() { |
|
|
if (i + 1 > settings::cableColors.size()) |
|
|
|
|
|
|
|
|
if (i >= settings::cableColors.size()) |
|
|
return; |
|
|
return; |
|
|
settings::cableColors.insert(settings::cableColors.begin() + i + 1, selectColor(color)); |
|
|
settings::cableColors.insert(settings::cableColors.begin() + i + 1, selectColor(color)); |
|
|
}, false, true)); |
|
|
}, false, true)); |
|
|