Undo and redo checks work on gui undo and redo buttons, not just shortcuts
This commit is contained in:
parent
9aa41ddb7f
commit
b745cae794
3 changed files with 19 additions and 8 deletions
|
|
@ -410,9 +410,9 @@ void Toolbar::top_toolbar() {
|
|||
if(main.world->network_being_used() && gui.svg_icon_button("Player List Toggle Button", "data/icons/list.svg", playerMenuOpen))
|
||||
playerMenuOpen = !playerMenuOpen;
|
||||
if(gui.svg_icon_button("Menu Undo Button", "data/icons/undo.svg"))
|
||||
main.world->undo.undo();
|
||||
main.world->undo_with_checks();
|
||||
if(gui.svg_icon_button("Menu Redo Button", "data/icons/redo.svg"))
|
||||
main.world->undo.redo();
|
||||
main.world->redo_with_checks();
|
||||
if(gui.svg_icon_button("Bookmark Menu Button", "data/icons/bookmark.svg", bookMenu.popupOpen)) {
|
||||
if(bookMenu.popupOpen)
|
||||
bookMenu.popupOpen = false;
|
||||
|
|
|
|||
|
|
@ -144,12 +144,20 @@ void World::focus_update() {
|
|||
mousePreviousWorldVec = drawData.cam.c.from_space(main.input.mouse.pos);
|
||||
mouseWorldMove = drawData.cam.c.from_space(main.input.mouse.move);
|
||||
|
||||
if(!clientStillConnecting && !drawProg.prevent_undo_or_redo()) {
|
||||
if(main.input.key(InputManager::KEY_UNDO).repeat)
|
||||
undo.undo();
|
||||
else if(main.input.key(InputManager::KEY_REDO).repeat)
|
||||
undo.redo();
|
||||
}
|
||||
if(main.input.key(InputManager::KEY_UNDO).repeat)
|
||||
undo_with_checks();
|
||||
else if(main.input.key(InputManager::KEY_REDO).repeat)
|
||||
redo_with_checks();
|
||||
}
|
||||
|
||||
void World::undo_with_checks() {
|
||||
if(!clientStillConnecting && !drawProg.prevent_undo_or_redo())
|
||||
undo.undo();
|
||||
}
|
||||
|
||||
void World::redo_with_checks() {
|
||||
if(!clientStillConnecting && !drawProg.prevent_undo_or_redo())
|
||||
undo.redo();
|
||||
}
|
||||
|
||||
void World::unfocus_update() {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ class World {
|
|||
void save_to_file(const std::filesystem::path& fileName);
|
||||
void load_from_file(const std::filesystem::path& fileName, std::string_view buffer);
|
||||
|
||||
void undo_with_checks();
|
||||
void redo_with_checks();
|
||||
|
||||
ServerPortionID ownID;
|
||||
|
||||
std::filesystem::path filePath;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue