VOXEDIT: disable undo/redo if the mementohandler doesn't have states

master
Martin Gerhardy 2021-02-02 21:02:27 +01:00
parent 28bd75cd9f
commit a16d6abaff
2 changed files with 5 additions and 5 deletions

View File

@ -69,9 +69,9 @@ bool VoxEditWindow::modifierRadioButton(const char *title, ModifierType type) {
return false;
}
bool VoxEditWindow::actionMenuItem(const char *title, const char *command) {
bool VoxEditWindow::actionMenuItem(const char *title, const char *command, bool enabled) {
const core::String& keybinding = _app->getKeyBindingsString(command);
if (ImGui::MenuItem(title, keybinding.c_str())) {
if (ImGui::MenuItem(title, keybinding.c_str(), false, enabled)) {
executeCommand(command);
return true;
}
@ -245,8 +245,8 @@ void VoxEditWindow::menuBar() {
}
ImGui::EndMenu();
}
actionMenuItem(ICON_FA_UNDO" Undo", "undo");
actionMenuItem(ICON_FA_REDO" Redo", "redo");
actionMenuItem(ICON_FA_UNDO" Undo", "undo", sceneMgr().mementoHandler().canUndo());
actionMenuItem(ICON_FA_REDO" Redo", "redo", sceneMgr().mementoHandler().canRedo());
if (ImGui::BeginMenu("Options")) {
ImGui::CheckboxVar("Show axis", _showAxisVar);
ImGui::CheckboxVar("Model space", _modelSpaceVar);

View File

@ -53,7 +53,7 @@ private:
void addLayerItem(int layerId, const voxedit::Layer &layer);
bool actionButton(const char *title, const char *command);
bool actionMenuItem(const char *title, const char *command);
bool actionMenuItem(const char *title, const char *command, bool enabled = true);
bool modifierRadioButton(const char *title, ModifierType type);
bool mirrorAxisRadioButton(const char *title, math::Axis type);