MCell-like selections for Golly
Posted: February 15th, 2019, 8:43 am
The script attached below implements an MCell-like editing mode for Golly. In particular, selections float above the current pattern and can be dragged around. You can also run the current pattern without changing the selection.
Some notes on usage:
* When the script starts up it will convert an existing Golly selection into a floating selection. When the script ends, a floating selection will be converted back to a Golly selection.
* The script switches to select mode when it starts up. If you don't want it to do that then remove the g.setcursor("Select") call in ConvertGollySelection(). Note that you can switch cursor mode at any time by clicking in the usual buttons in the edit bar. For example, you might want to switch to the pencil cursor and draw/erase cells. Unlike Golly, the script lets you draw at any scales up to 2^5:1.
* The script supports undo/redo via Golly's usual keyboard commands.
* Hit the H key at any time to get a dialog with help info.
* If a selection exists you can ctrl-click or right-click anywhere in the viewport to get a pop-up menu with various selection actions (cut, copy, clear, flip, rotate, etc).
* While the script is running you can use most of your usual mouse actions and keyboard shortcuts to pan, zoom in/out, switch cursors, etc.
* Live cells in the selection are always displayed in non-icon mode.
(A future version of Golly might provide an overlay command to get icon images.)
The script illustrates how the overlay can be used to enhance or completely replace Golly's usual behavior, so feel free to modify it to suit your own needs. It would also be a useful starting point for a script that allowed more sophisticated selection modes (eg. a lasso mode, or disjoint selections, or circular/diamond shaped selections).
Some notes on usage:
* When the script starts up it will convert an existing Golly selection into a floating selection. When the script ends, a floating selection will be converted back to a Golly selection.
* The script switches to select mode when it starts up. If you don't want it to do that then remove the g.setcursor("Select") call in ConvertGollySelection(). Note that you can switch cursor mode at any time by clicking in the usual buttons in the edit bar. For example, you might want to switch to the pencil cursor and draw/erase cells. Unlike Golly, the script lets you draw at any scales up to 2^5:1.
* The script supports undo/redo via Golly's usual keyboard commands.
* Hit the H key at any time to get a dialog with help info.
* If a selection exists you can ctrl-click or right-click anywhere in the viewport to get a pop-up menu with various selection actions (cut, copy, clear, flip, rotate, etc).
* While the script is running you can use most of your usual mouse actions and keyboard shortcuts to pan, zoom in/out, switch cursors, etc.
* Live cells in the selection are always displayed in non-icon mode.
(A future version of Golly might provide an overlay command to get icon images.)
The script illustrates how the overlay can be used to enhance or completely replace Golly's usual behavior, so feel free to modify it to suit your own needs. It would also be a useful starting point for a script that allowed more sophisticated selection modes (eg. a lasso mode, or disjoint selections, or circular/diamond shaped selections).