home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.programming      Programming issues that transcend langua      57,431 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 55,665 of 57,431   
   Malcolm McLean to ju...@diegidio.name   
   Re: Undo / Redo design pattern.   
   04 Apr 22 06:38:22   
   
   From: malcolm.arthur.mclean@gmail.com   
      
   On Monday, 4 April 2022 at 14:14:38 UTC+1, ju...@diegidio.name wrote:   
   >   
   > In fact, "again use the key to, viceversa, know which -- property value to   
   change/restore", no need to now about actions at all, this is all about   
   property values.   
   > The only reason I can think of to, a this point, also record the name of the   
   action with every entry in the stack, is to be able to show it it to the user   
   or similar...   
   >   
   That's a good point. Some programs show "undo paste", "undo clear" and so on,   
   rather than just "undo".   
   >   
   > Anyway, details apart, I'd think that's pretty much it: the only open   
   question on my side is what you mean by "program state" and why...   
   >   
   In Crossword Designer, which is my currently active hobby project, the program   
   state is the crossword. So a W x H grid of characters   
   representing the current gird, and a list of clues. As the user uses the   
   program, he can add or delete letters, or turn black grid squares   
   into letter ones or vice versa. The can also edit the clues. And if he changes   
   the grid so as to change the relationship of the clues   
   to the numbers, the program will update the clues for him.   
   So just a small amount of data. I have an undo/redo system, so he can undo or   
   redo an action. But currently it just saves the entire   
   crossword. Most edits change only one letter, so this seems a bit wasteful, I   
   wondered if I could do better.   
      
   Strictly speaking, the position of the cursor on the grid is also part of the   
   program state. But users don't expect moving the cursor   
   to create an undoable action, and I doubt they care whether the cursor is   
   restored after an undo.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca