166
edits
(→Missing / Todo (08/2012): Copy&Paste links) |
|||
| Line 175: | Line 175: | ||
=== Multiplatform Clipboard Support (native Copy/Paste) {{Pending}} === | === Multiplatform Clipboard Support (native Copy/Paste) {{Pending}} === | ||
{{Progressbar| | {{Progressbar|60}} | ||
Needs to be individually implemented for each supported window manager environment (Windows, OSX, X11): | |||
* X11: | * X11: https://gitorious.org/~tomprogs/fg/toms-flightgear/blobs/0a9d3e8cf0792164055ebedcf34acb37fbc635d4/src/Scripting/ClipboardX11.cxx | ||
* Windows: | * Windows: https://gitorious.org/~tomprogs/fg/toms-flightgear/blobs/0a9d3e8cf0792164055ebedcf34acb37fbc635d4/src/Scripting/ClipboardWindows.cxx | ||
* OSX: Base on following file: https://gitorious.org/~tomprogs/fg/toms-flightgear/blobs/0a9d3e8cf0792164055ebedcf34acb37fbc635d4/src/Scripting/ClipboardFallback.cxx | |||
A basic implementation is available which is not complete and needs some testing: https://gitorious.org/~tomprogs/fg/toms-flightgear/commit/0a9d3e8cf0792164055ebedcf34acb37fbc635d4 | |||
* '''Hooray''': "Also, copy/paste usually involves getting a bounding box for the area and retrieving the text in that area (drawing a rectangle and inverting the font color)" | * '''Hooray''': "Also, copy/paste usually involves getting a bounding box for the area and retrieving the text in that area (drawing a rectangle and inverting the font color)" | ||
| Line 185: | Line 187: | ||
Should probably be done at the Nasal level, using two new custom extension function: | Should probably be done at the Nasal level, using two new custom extension function: | ||
* f_setClipboardText( text ) {{ | * f_setClipboardText( text ) {{Done}} | ||
* f_getClipboardText() {{ | * f_getClipboardText() {{Done}} | ||
In Nasal space, there exists a "clipboard" hash which can be used to access the clipboard. There are two types of clipboards supported: | |||
* CLIPBOARD: Standard clipboard like on almost everything operating system | |||
* SELECTION/PRIMARY: Primary X Selection like found on X11 based systems. On non-X11 platform this clipboard is only accessible from inside FlightGear. | |||
<syntaxhighlight lang="php"> | |||
clipboard.setText(text, type = "CLIPBOARD"); | |||
clipboard.getText(type = "CLIPBOARD"); | |||
print("Clipboard contains " ~ clipboard.getText()); | |||
print("Selection contains " ~ clipboard.getText("SELECTION")); | |||
if( !clipboard.setText("test") ) | |||
print("Failed to write to clipboard"); | |||
if( !clipboard.setText("test-selection", "SELECTION") ) | |||
print("Failed to write to selection"); | |||
</syntaxhighlight> | |||
=== Reimplementing CanvasWindow without PUI dependency using osgGA (in progress) {{Pending}} === | === Reimplementing CanvasWindow without PUI dependency using osgGA (in progress) {{Pending}} === | ||
edits