Fix bug causing spurious increase in size of the script area.

This does come at the cost of some additional computation -- now any time text
is added to the script, the entirety of the script contents are examined to
count the number of newlines. But I don't notice any slowdown on my computer,
even for gratuitously large (>1MB) scripts, so I doubt this is a big deal.

git-svn-id: https://valelab.ucsf.edu/svn/micromanager2/trunk@14517 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd
Remove superfluous import


git-svn-id: https://valelab.ucsf.edu/svn/micromanager2/trunk@14518 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd
Fix hang on error during Live, esp. with Multi Camera

Multiple race conditions fixed. The code is not ideally structured, but
good enough for now.

This prevents some freezes when Multi Camera is used with a circular
buffer that is too small (an error is reported instead of hanging).

git-svn-id: https://valelab.ucsf.edu/svn/micromanager2/trunk@14519 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd
Refactor timer management in LiveModeTimer

git-svn-id: https://valelab.ucsf.edu/svn/micromanager2/trunk@14520 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd
Partially revert r14432.

It turns out that we have nasty code that has been written with
practically no regard to what thread it is running on, and explicitly
running message boxes (JOptionPane) on the EDT can cause deadlock (the
problem was seen in PixelCalibrator's Stop button, but there could be
other instances).

Existing code thus depends on ReportingUtils.showMessage() and similar
methods to block the calling thread, but not to block the EDT. This
seems to be the empirical behavior of JOptionPane (on OS X and probably
on Windows), but the documentation does not specify this (Swing is just
not supposed to be thread safe), and relying on it is dangerous. So the
ultimate fix will require that all uses of ReportingUtils be reviewed
and those calling message-box-showing methods from non-EDT threads be
fixed. Talk about technical debt.

For now, I'm reverting to relying on JOptionPane's undocumented
behavior, since it is known to "work" in the short term.

This commit also contains an update for out-of-memory error messages, so
that they continue to work after reverting the changes to the
ReportingUtils methods.

git-svn-id: https://valelab.ucsf.edu/svn/micromanager2/trunk@14521 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd
PixelCalibrator: Fix error handling

Don't mix up cancellation and failure. Don't use InterruptedException
for what it's not meant for. Always handle device errors and algorithm
failures in the same way.

UI was totally broken on error; now it is okay.

git-svn-id: https://valelab.ucsf.edu/svn/micromanager2/trunk@14522 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd