Canvas widgets: Difference between revisions

Jump to navigation Jump to search
(→‎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|30}}
{{Progressbar|60}}
...probably needs to be individually implemented for each supported window manager environment (Windows, OSX, X11):
Needs to be individually implemented for each supported window manager environment (Windows, OSX, X11):
* X11: http://michael.toren.net/mirrors/doc/X-copy+paste.txt
* X11: https://gitorious.org/~tomprogs/fg/toms-flightgear/blobs/0a9d3e8cf0792164055ebedcf34acb37fbc635d4/src/Scripting/ClipboardX11.cxx
* Windows: http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/2010-January/005636.html
* Windows: https://gitorious.org/~tomprogs/fg/toms-flightgear/blobs/0a9d3e8cf0792164055ebedcf34acb37fbc635d4/src/Scripting/ClipboardWindows.cxx
* OSX:
* 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 ) {{Pending}}
* f_setClipboardText( text ) {{Done}}
* f_getClipboardText() {{Pending}}
* 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");


In Nasal space, these should probably be wrapped using a "clipboard" hash, so that it can be extended as required.
print("Clipboard contains " ~ clipboard.getText());
print("Selection contains " ~ clipboard.getText("SELECTION"));


Here's a first stab at adding two new Nasal functions for clipboard handling: http://codepad.org/IuRs2Wkp
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}} ===
166

edits

Navigation menu