Contents
Overview
The GTKWD addon is a wd (window driver) emulator using gtk api. It allows running legacy J6 gui code within JGTK. Its main purpose is to ease porting of wd to native gtk api. Translation of wd to jgtk can be done piece by piece and less daunting. It does not encourage writing new production applications using this emulator.
Usages
Just add a require before running wd command.
require 'gtkwd'
DO NOT use load
load 'gtkwd' NB. never use 'load' unless you are debugging gtkwd itself.
J602's base library since 6.02.061 will ignore gtkwd for load or require, so it is harmless to include a require 'gtkwd' if you want the script to run under both J602 and J701.
Migration from J602 to J701
Many packages inside J602 base library have been moved to addons. To make it run on both,
require 'font print'
will become
if. IFJ6 do. require 'font print' else. require 'general/misc/font print' end.
Project manager is completely different, but usually it just needs a new simple project file in the new .jproj format and a new init.ijs. for initislization.
NB. init 3 : 0'' if. IFJ6 do. script_z_ jpath '~system/classes/plot/afm.ijs' script_z_ jpath '~system/packages/graphics/bmp.ijs' script_z_ jpath '~system/packages/color/colortab.ijs' script_z_ jpath '~system/main/dll.ijs' script_z_ jpath '~system/main/files.ijs' script_z_ jpath '~system/packages/misc/font.ijs' script_z_ jpath '~system/main/gl2.ijs' script_z_ jpath '~system/classes/plot/jzplot.ijs' script_z_ jpath '~system/main/numeric.ijs' script_z_ jpath '~system/classes/plot/plot.ijs' script_z_ jpath '~system/main/regex.ijs' script_z_ jpath '~system/main/strings.ijs' script_z_ jpath '~system/main/trig.ijs' else. require 'afm bmp colortab dll files general/misc/font gl2 jzplot numeric plot regex strings trig' end. '' ) coclass 'ppublish'
GTKWD under jconsole
Running gtkwd applications under jconsole requires a gtk message loop. A utility verb evtloop is provided. Run it after the main program, eg,
... wd 'pshow' evtloop^:(-.IFJ6)'' ...
The program flow will stop at evtloop and the jconsole will freeze as well until the last window created by GTKWD is closed. Note that if there are other sentences to be run after pshow, the poistion of evtloop should be moved accordingly.
evtloop has no effect under GTKIDE or if a gtk message loop is already running.
Incompatible Changes
- positions and sizes of widgets will be overrided by GTK's layout manager.
position and size from wd'qformx' does not include window border and title bar. Similaryly for pmove and pmovex.
move wd'pshow' before any gl2 commands. Note taht graphics addons such as plot and grid will call gl2 commands therefore it needs a wd'pshow' like this,
gl2 commands need ot be executed after wd'pshow'. Note taht graphics addons such as plot and grid will call gl2 commands indirectly, a workaround could be something like this,
... wd^:(-.IFJ6) 'pshow;pshow sw_hide' NB. add this line g=. '' conew 'jzgrid' ... wd 'pshow' NB. original pshow
gl2 commands for printing do not require any wd'pshow'. However all gl2 commands should only be run inside a print event, this is the same as that under J602.
- glpaintx from J504 is re-introduced, but do not run glpaintx inside a paint event, otherwise there will be an infinite loop.
- Values of special keys in isigraph keyboard event have been changed. Their symbolic names are now defined in jgl2 locale.
Symbol J602 value ------------------------ kbBS 08 backspace kbENTER 13 CR kbPUP 16 pageup kbPDOWN 17 pagedn kbEND 18 end kbHOME 19 home kbLEFT 20 left arrow kbUP 21 up arrow kbRIGHT 22 right arrow kbDOWN 23 down arrow kbESC 27 escape kbINS 28 insert kbDEL 29 delete
- container for subforms must be a tab control.
Limitation
- Microsoft windows features such as oleautomation, ocx, emf, richedit will not be implemented.
Un-implemented wd Comamnds
The following commands are not or will not be implemented.
- session manager not supported
smcolor smkeywords smsetlog sminputlog sminputlog
- ole commands not supported
oleget olegetlic oleinfo oledlg oleenable oleid oleload olemethod olemethodx oleocx olerelease olesave oleset olesetlic
- other ignored commands
qhinst qhwndx qkeystate qrtf clipcopyx clippastex pcolor security setbkgnd setcolor setcolwidth setpclip setupdate settabstops tnomsgs wait
Un-implemented gl2 Comamnds
The following commands are not implemented.
glcapture glemfclose glemfopen glemfplay glfile glroundr
Demos
Demos are available in addons
- demos/isigraph
- demos/wd
- demos/wdplot
- games/minesweeper
- games/pousse
- games/solitaire
- general/scriptdoc
- graphics/grid
- graphics/plot
- graphics/treemap
- gui/util (cobrowse)
- math/deoptim
- math/eigenpic
- math/tabula
All of the above demos can be run from demos/wd.
load 'demos/wd/demos'
Or add the following line to launchpad and then run from launchpad.
wd;~Demos/wd/demos.ijs
Some demos may require other addons packages.
Dependency
Obviously, GTKWD requires gui/gtk for working. It also depends on the addon graphics/gl2 for isigraph and gl2 functions.
TODO
Bugs
Please report bugs with information such as GTKVER and testing platform. Provide a simple script to reproduce the bug if applicable.
Contributed by BillLam
