I have made some very large updates to AWS2.

For technical reasons, I felt that the way I was doing things was wrong.
It was supposed to be an improvement over the old AWS method, but it
encountered many of the same problems.  I felt that the scripted method
was the way to go, but I just didn't take it far enough.

As of today, AWS2 now embeds SpiderMonkey, the Mozilla Javascript 1.5
engine.  All the old scripting is gone.  Most of the groundwork is
finished, and the plugin exports Widget, Color, Pen, and Autom objects
into the scripting interface.

This method, which many will be familiar with from DHTML, lets any
applications create widgets just like they were in the AWS2 plugin.  In
fact, ALL widgets will be Javascript (or ECMAScript-262) based objects.
Drawing occurs via the Pen object.  Widgets provide a container, and
draw to a Pen.

I realize that some might fear that drawing using a scripting language
is slow.  There may be some truth to that, so AWS2 provides a caching
layer.  All scripted Pen objects draw to a memory object, which is just
an encapsulation of the drawing commands.  That is, it's an instruction
stream not a bitmap.  When the plugin goes to draw a Widget, it checks
to see if the Widget is dirty.  If so, it fires the onDraw method for
the widget and captures the output.  Then it just replays the
instruction stream into the output pen (generally the pen that's
connected to the graphics context.)

The idea is that you can "skin" the widgets by changing the drawing
function (but not the event handling functions).  Most of this will be
controllable from the preferences file, but some developers may want to
totally customize the way their Widgets look.  This ability is now
totally opened up, and doesn't require mucking about in the AWS2 dll or
learning some "custom widget" interface.  In addition, AWS2 remains a
plugin, and doesn't require any source injection into your app.  There
is even a notification system between the plugin and your app that is
totally script-based, and allows your native code to be notified of
certain things, or to provide integration via script-visible embedded
function calls.  Note that there is no JS engine embedding in your app.
That all stays private to AWS2's dll. 

One other large benefitof using Javascript is that you automatically get
to use all of the core Javascript objects.  Math, String, Number,
RegExp, Date... Are all available.  AWS2 does *not* implement the DOM,
nor does it try to.

The AWS2 plugin also implements a full console, with command-line
history.  The console connects directly to the JS engine, so you can
test your widgets or whatever in real-time, without compiling.
SpiderMonkey has a debugging API that I would eventually like to make
available via this console, but that's for the future.

As of now, everything that I mentioned in this e-mail works.  To test
it, just uncomment the define in awstest_config.h, and recompile
awstest.  

Try typing things like:

w.Move(100,100); 
w.Resize(100,100);
w.Invalidate();

into the console.  You will notice that Resize() doesn't change the
graphical contents of the Widget.  That's due to the caching layer.  It
requires an Invalidate() to fire the redraw code.

The Pen for the 'w' testing Widget is named 'p'.  You can call any
"iPen" function from the script (except Write and WriteBoxed because
there is not yet a font object.)  Notice that it appears immediately,
because the Pen writes to the caching layer.

p.SetColor(1,0.5,0.25,1);
p.DrawRect(0,0,50,50,true);

Still to come:

 * Event system (keyboard events, mouse events)
 * Transitions (widget easing)
 * XML-based window-definition
 * default widget set
 

-={C}=-

 


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]

Reply via email to