Re: Undo stack for GTK+ (was: Re: undo in textview)

On Wed, Dec 30, 2009 at 10:55 PM, Holger Berndt <berndth gmx de> wrote:
> On Mi, 30.12.2009 21:32, Tristan Van Berkom wrote:
>>Particularly point 5, nested transactions; I banged my head around that one
>>for a while and finally did not implement this; my interpretation of
>>nested transactions
>>was something like this:
>>  o User initiates action
>>  o action goes and modifies data on the model
>>  o model data change callback initiates "nested action"
>>  a.) it was complex as hell to implement without re-creating commands
>>       when the data model changes due to undo/redo or something other
>>than an action
>>      (and however nice the api, the complexity spills into the
>>individual action initiating code).
> I don't really see the problem in nesting groups of undo stack elements.
> Quite on the contrary, I find it very useful, if not essential, to be
> able to use the stack from applications that don't follow the command
> pattern already anyways.

Right, I'm not sure what you have intrerpreted by nesting commands,
seems to me you mean, "including a group of commands as a command
in a new group of commands", thats *not* what I had interpreted as
"nested commands", I think that vision of "nesting" goes hand in hand
with command grouping in the first place, It just has to be there, if you
can group commands, the command group must be like a command, and
can be specified in another group.

What I mean by nested commands is different than grouped commands,
it was something like this:

   o Generic code initiates command to set a generic modal property
   o Backend code noticies that "GtkNotebook:n-pages" property has
   o Backend decides to "extend" the current command if the property
      changed due to an initial command creation
   o Backend goes ahead and undoably removes pages from the notebook
      that no longer fit that span of "GtkNotebook:n-pages"

Anyway, because we dont have "nested commands" (as I imagined them) in Glade,
we just dont let you decrease the pages if it would result in
orphaning project widgets.
(As I described in my previous mail, more recent code in Glade allows
me to piggy
back onto the "Property Editor", which lets me prepend/append actions to the
action of a "set property command"... and I was explaining that this was safe
because the signals are comming from the *controller*, not the model).

> True, I would have put it below GTK+ too, but given that such a stack
> requires GObject, I didn't really find a better-fitting place. Also,
> being able to rely on GTK+ has advantages, too, like being able to offer
> convenience GtkAction's for undo and redo with up-to-date labels.

Seems it would make sence  to GtkAction --> GAction as well.

The GtkActivatable's are really the UI specific code here.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]