Git Product home page Git Product logo

Comments (4)

david-c14 avatar david-c14 commented on June 3, 2024 1

https://github.com/david-c14/SubmarineFree/blob/1f8d55eccb8997ef42551afc9519e7cabb4cbcae/src/LT1.cpp#L427

Adding an Action to the APP-history. However, this example uses anonymous functions, because I prefer them. The EventWidgetAction is defined here and here

If you don't want to be doing anonymous functions, you need a subclass of ModuleAction for each kind of undo that you need, create an instance of your subclass, give it whatever information it needs to undo / redo the action, and then add it to the APP->history.

Don't put a pointer to your module into the action, set the moduleId in the action instead, and then the undo/redo methods should find that module by it's id. That's because your undo might get called after someone has deleted your module and then undone the delete, so your pointer would be invalid, but the id should be good.

from ariamodules.

AriaSalvatrice avatar AriaSalvatrice commented on June 3, 2024

https://community.vcvrack.com/t/custom-history-actions-for-modules/2575

from ariamodules.

AriaSalvatrice avatar AriaSalvatrice commented on June 3, 2024

Pushing back that one for later. Anyone knows of open-source modules that implemented this so I can see what they did?

from ariamodules.

AriaSalvatrice avatar AriaSalvatrice commented on June 3, 2024

Undo support was added to the development branch.
Thank you for the example implementation @david-c14 !

from ariamodules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.