[PD] dirty flag could be cleaner?

Krzysztof Czaja czaja at chopin.edu.pl
Thu Sep 13 11:14:53 CEST 2001


hi,

let me add this one to all those boring self-followups...

I wrote:
...
> [...] but then you cannot save instantiated abstractions [...]
> [...] it is very easy to make such a mistake accidentally
...

One could expect at first that accidental saving would not occur,
because if there were no editing changes made to a document, plain
saving (as opposed to `Save as') should be disabled -- as is the
usual practise.  But blocking the `Save' command requires proper
handling of dirty flag.  I assume the expected behaviour is raising
dirty flag after making any change and only such a change that
would be saved in a document file.

First -- currently several editing actions, most often performed
with gui objects, do not make my documents dirty:

1. Object creation while two conditions are met: a) canvas is in
   edit mode; b) object is created by sending a message to a canvas
   (through menu item/shortcut or directly) instead of typing its
   name in a box.  These are the normal conditions for gui objects.
   Creating text objects will normally raise the flag because this
   usually involves typing text (unless someone is sending direct
   messages like 'pd-<canvasname> obj <x> <y> <objectname>...').

2. Properties change (atom, array or gui object).

3. Moving gui object with arrow keys (which means through a list
   message such as '1 Shift_L, 1 Down').  This one is a gui-only
   thing.

Btw. these are current dirty actions:

- keypress in an object box (or some emulation of it, such as sending
  TEXT-dialog contents into a box being edited);
- moving objects with a mouse;
- deleting, cutting, pasting or duplicating selection;
- tidying up;
- passing `editmode' message to a canvas, but only if a) canvas is not
  in edit mode, and b) the message has nonzero argument => it
  originated from object creation routines (or directly from a message
  box or dialog).

Second -- there are also some dirty actions that I suspect should not
be treated as dirty.  Perhaps the following two need to be corrected
by passing zero to canvas_editmode() instead of one:

- selecting all while not in edit mode
- selecting through finding while not in edit mode

Krzysztof

(maybe canvas_editmode() itself should be corrected, and also -- since
calling it seems to be confusing --  better documented?)



More information about the Pd-list mailing list