File: atomic.html

package info (click to toggle)
pcb-rnd 3.1.7b-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,108 kB
  • sloc: ansic: 213,400; yacc: 6,241; sh: 4,698; awk: 3,016; makefile: 2,254; lex: 1,166; python: 519; xml: 261; lisp: 154; tcl: 67; perl: 34; javascript: 6; ruby: 5
file content (38 lines) | stat: -rw-r--r-- 1,462 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
This action allows making multiple-action bindings into an atomic
operation that will be undone by a single Undo command.  For example,
to optimize rat lines, you'd delete the rats and re-add them.  To
group these into a single undo, you'd want the deletions and the
additions to have the same undo serial number.  So, you <arg>Save</arg>,
delete the rats, <arg>Restore</arg>, add the rats - using the same serial
number as the deletes, then <arg>Block</arg>, which checks to see if the
deletions or additions actually did anything.  If not, the serial
number is set to the saved number, as there's nothing to undo.  If
something did happen, the serial number is incremented so that these
actions are counted as a single undo step.
<p>
An alternative mechanism is freeze/unfreeze for the case restoring between
every two actions is not possible or not practical. The sequence is
<arg>Save</arg>, <arg>Freeze</arg>, call actions, <arg>UnFreeze</arg>,
<arg>Block</arg>.
<p>
Arguments:
<p>
<table border=1 cellspacing=0>
	<tr><th> Save
	<td> Saves the undo serial number.

	<tr><th> Restore
	<td> Returns it to the last saved number.

	<tr><th> Close
	<td> Sets it to 1 greater than the last save.

	<tr><th> Block
	<td> Does a Restore if there was nothing to undo, else does a Close.

	<tr><th> Freeze
	<td> Make sure no subsequent actions will bump the undo serial

	<tr><th> UnFreeze or Thaw
	<td> Allow subsequent actions to bump the undo serial again
</table>