Author Topic: New properties and methods of the View and ImageWindow JavaScript objects  (Read 6368 times)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Latest build 337 of the core PixInsight application comes with a few additions that are worth to comment them here. They are new properties and methods of the View and ImageWindow objects that allow us to navigate and explore processing histories.

======================

ProcessContainer View.processing
ProcessContainer View.initialProcessing

These read-only properties return the processing histories associated with a view. The returned ProcessContainer instances are independent instances that contain clones of the original objects and are not linked to them.

uint View.historyIndex

Represents the current index in a view's processing history (read/write). This property can be changed arbitrarily to navigate throughout the entire processing history of an image. It requires image modification privileges as per global security settings.

Boolean View.canGoBackward
Boolean View.canGoForward

These read-only utility properties are true when the current processing history index can be moved in the corresponding directions.

void ImageWindow.go( uint index )

This method can be used to navigate throughout the processing history of the main view of an image window. The same can be done by assigning new values to ImageWindow.mainView.historyIndex. Requires image modification privileges.

void ImageWindow.purge()

This method has been refactored. It deletes all swap files associated with an image window. This operation cannot of course be undone, and requires image modification privileges.

Note that calling purge() does not clear the modification counter of an image. In order to suppress all user confirmation messages when closing a modified image, the entire processing history must be undone before purge():

Code: [Select]
var w = new ImageWindow;
// ...
w.undoAll();
w.purge(); // no message boxes on modified pixel data, etc


void ImageWindow.undo( [uint n=1] )
void ImageWindow.undoAll()

These methods can be used to navigate backward through a main view's processing history. The same can be done by decreasing ImageWindow.mainView.historyIndex. Requires image modification privileges.

void ImageWindow.redo( [uint n=1] )
void ImageWindow.redoAll()

These methods can be used to navigate forward through a main view's processing history. The same can be done by increasing ImageWindow.mainView.historyIndex. Requires image modification privileges.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/