BUG: "reference" attributes on transform were not editting scene

In Slicer3, then an output transform of a CLI had a "reference",
the MRML scene would be editted automatically to place the "reference"
image under the transform.

The implementation in Slicer3 performed the hierarchy editing by passing
a string of Tcl commands from the processing thread to the gui thread. This
approach was never ported to Slicer4.

This patch uses the Command/Observer to request that an event be
issued in the main thread. In this case, the event is one to edit
the transform hierarchy.  The details of how the transform hierarchy
is be editted are encoded in a callback function. Two layers of callback
functions are used.  One layer is a generic callback function which
accepts another callback in its calldata. It then delegates to that
second callback.  In this manner, the same structure can be used
for other hierarchy edits by switching the callback passed as calldata.
The second callback is a one shot callback. The first callback will
delete the second callback upon completion.

This patch should resolve bug #3091. Unfortunately, I cannot test it on
my system as BrainsFit crashes for a different reason.  But this patch
does restore the transform hierarchy behavior for the RigidRegistration
module accessible under "Legacy" modules.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22254 3bd1e089-480b-0410-8dfb-8563597acbee
BUG: #3204. Crosshair selection overridden by cross hair toggle.

This addresses a bug involving toggling and switching crosshairs:

1. If crosshair display is in mode "A"
2. Crosshair it toggled off in the GUI
3. Crosshair is set to mode "B" in the GUI

then the cross would display as "A" and not as "B".

The issue is in the order in which the "selection" signals are raised
relative to the "toggle" signals. When switching from off to any mode
the selection signals are raised first and then the toggled signals.

This ordering was aligned with the order in which the crosshair
node was modified relative to how the mode was cached (to set up for
toggling).

Caching the mode before setting mode addressed the issue.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22255 3bd1e089-480b-0410-8dfb-8563597acbee