DXTaskbar7: a DesktopX plugin to access Windows 7 taskbar extensions

Posted by Julien on June 12th, 2009

DXTaskbar7 - Preview

With Windows 7 a few months away, it was time to bring some of the new features to DesktopX. One of the things gadgets could really benefit from is the new extended taskbar. It has a few new options such as jump lists, tasks, thumbnails toolbars, icon overlays, progress bars and thumbnails.

DXTaskbar7 is a new plugin for DesktopX that allows you to access all those new features from your DesktopX scripts.

How to help

Download the DXTaskbar7 package and start creating gadgets &widgets!

What to look for

  • Tab handling problems: tabs not appearing, tab name and icon not properly updated
  • Toolbar: icon corruption
  • crashes or memory leaks

DeliveryTracker-Win7What is broken/not working properly

  • ActiveX controls are not drawn on the tab preview (this is a problem with DesktopX)
  • This is a DEBUG build, so it’s going to be slower than normal

Links

Documentation

Tabs management

TabHwnd

Get the handle for that tab (to be used in ConfigureTab).

SetTabsIcon(image)

Set a global icon for all the tabs.

  • image: path to a 16×16 image file

ConfigureTab(name, insertAfter)

Setup the tab name and position.

  • name: title of the tab
  • insertAfter: handle of the tab after which the configured tab should be inserted. Use 0 to insert after the last tab

SetTabActive()

Set the tab as active and show it in the tab list.

RemoveTab()

Remove the tab from the list.

Taskbar_OnCloseTab()

This function will be called when the user closes a tab in the list.

 

ThumbBar

SetupButton(id, image, tooltip, flags)

Setup a new tab button.

  • id: internal id (to be passed in the Taskbar_OnButtonClicked callback when the button is clicked)
  • image: path to a 16×16 image file
  • tooltip: the tooltip to shown on mouse-over
  • flags: a list of flags (see DXTaskbarDefines.vbs)

UpdateButton(id, image, tooltip, flags)

Update an existing tab button (only after buttons have been added).

  • id: internal id (to be passed in the Taskbar_OnButtonClicked callback when the button is clicked)
  • image: path to a 16×16 image file
  • tooltip: the tooltip to shown on mouse-over
  • flags: a list of flags (see DXTaskbarDefines.vbs)

AddButtons()

Add the list of buttons to the tab. 
A maximum of 7 buttons can be added at one time. After the buttons have been added, you cannot setup new ones. Use the UpdateButton function to modify existing buttons.

Taskbar_OnButtonClicked(id)

Called when the user clicks on a thumbbar button.

  • id: the button id used in SetupButton and UpdateButton

 

Overlay

SetOverlayIcon(image, description)

Applies an overlay to a taskbar button to indicate application status or a notification to the user.

  • image: path to a 16×16 image file
  • description: an alternative text version, for accessibility purposes

 

Progress

SetProgressState(flag)

Sets the type and state of the progress indicator displayed on a taskbar button.

  • flag: a progress flag (see DXTaskbarDefines.vbs)

SetProgressValue(completed, total)

Displays or updates a progress bar hosted in a taskbar button to show the specific percentage completed of the full operation.

  • completed: number of steps completed
  • total: total number of steps

 

Tasks and destinations

AddUserTask(name, path, arguments, icon, iconIndex, workingFolder)

Add a new user tasks (typically static links)

  • name: name of the task
  • path: path to the program to execute
  • arguments: arguments to the program
  • icon: path to .ico file to use as an icon
  • iconIndex: index of the icon to use in the .ico file (typically 0 if you only have 1 icon type)
  • workingFolder: working folder when executing the program

AddSeparator(category)

Add a separator

  • category: the category to add a separator to. To add a separator to the tasks, use “Tasks” as the category.

CommitList()

Declares that the Jump List is complete and ready for display

AbortList()

Discontinues a Jump List building session without committing any changes

 

Changelog

1.0 Build 231

  • Implemented Tasks

1.0 Build 205:

  • Added parameter checking in most functions
  • Fix for Vista and XP: all functions calls are ignored on those systems but are still available to scripts, so you should not get any script error

1.0 Build 198:

  • First test version

Download

You can download it on Wincustomize or from here.

Animator Script Component 1.1

Posted by Julien on May 12th, 2009

imageA small update for the Animator Component is now available. Changes from the internal version have been merged and a new method to remove all animations related to a specific object has been added.

The Animator Sample now has checkboxes to enable/disable a specific animation and the requested script “export” has been added. You can now tweak your object animation and have a ready to use script copied to the clipboard.

Download it from Wincustomize.

DXCanvas 2.0

Posted by Julien on May 12th, 2009

image I released an update for DXCanvas yesterday. This new version is in sync with the latest Canvas specifications. Error handling has been overhauled and is now closer to the spec (some things still aren’t the same as we are not running inside a browser and thus do not have access to a real DOM tree).

The Canvas Controller widget has received a lot of updates and can now run the Canvas test suite and generate a test report. We now pass 92.1% of the tests.

The source code has also been moved to a public repository on Google Code.

Download

You can get DXCanvas from here or from Wincustomize.

Changelog

2.0 Build 174:

  • Sync with the latest version of the Canvas specifications
  • Added new createImageDataFrom function to create an new ImageData instance using an existing one dimensions
  • Exceptions now return the correct DOMException error code
  • Completed documentation of IDL interface
  • Updated Canvas Controller with a pin to desktop icon
  • Integrated test suite into Canvas Controller (allows to run all tests at once and generate a report)
  • Updated test suite generator to parse the XML generated by Canvas Controller
  • Fixed Canvas Controller dialog drag during long operations
  • Fixed crash on exit when BETA was expired   
  • Fixed handling of negative width&height values by drawImage
  • Fixed handling of nonfinite arguments by drawImage
  • Fixed pattern leak in drawImage
  • canvas.rect() now handles NaN and Infinity correctly
  • pattern.addColorStop() now handles NaN and Infinity correctly   
  • Tweaked text drawing on paths   
  • Updated box blur algorithm to use precomputed values (slightly faster)
  • Moved support libs to a subfolder of project   
  • Moved source code from private repository to Google Code
  • Update Cairo (HEAD), Pixman (0.15.2), Pango (1.24.2), Glib (2.20.1)

DockletX

Posted by Julien on February 23rd, 2009

DockletX-Preview DockletX is a plugin for DesktopX that allows you to run ObjectDock docklets on your Desktop.

It implements the ObjectDock Docklet host interface and can load pretty much any docklets built for ObjectDock.

A few things are not implemented at this time:

  • Attention animations (such as glow or bounce)
  • Export (running as a gadget is not tested and might not be working properly)

 

Right now, only ObjectDock docklets are supported, but support for Y’z Dock and maybe AveDesk desklets is planned.

 

Download here.

.Net 2.0 support for ObjectDock

Posted by Julien on February 23rd, 2009

Runtime SDK-PreviewIt’s been available for some time from Wincustomize but I never did any big announcement. The old .Net  docklet for ObjectDock was compiled with .Net 1.0 and thus wasn’t working on newer version of the Framework. It also had problems on Vista with plugin registration which didn’t work with UAC on.

The new version is compiled with .Net 2.0 and should run correctly on Vista. I recently published a small update with support for ContextMenuStrip for docklet context menus, a check for older versions of the SDK so that docklets can specify a minimum supported SDK version and a workaround for the broken OnDropFiles in ObjectDock. There is also two new Host methods exposed (DoClickAnimation and RemoveSelf).

Download

The .Net 2.0 runtime docklet is available from Wincustomize and you can download it here.

Animator Script Component for DesktopX

Posted by Julien on February 1st, 2009

Preview I have this animation script I wrote 2 years ago for a widget (that I never finished), and I recently got back to work on a package tracking widget that is going to use some part of it. Still 70% of the script is never going to be used and I don’t want to throw it away, especially if it can help other people.

I’ve noticed a lot of questions on how to animate groups of objects, and everybody seems to write semi-custom code over and over. My script takes the form of a Script Component (an external script file you reference in your DesktopX script), which means it can be reused without cut&pasting dozens of lines of code every time.

Let me give you an example. In the script below Animator is the main object (already initialized, 3 lines of code, not of interest here). The last argument of each XXXAnim.Init methods is a callback that you can use to call a function when the animation is done. It’s especially interesting if you need to coordinate several complex animations. I’ve added variables so you can understand what each Init call does, but in practice the script would be a little bit simpler.

[sourcecode language='vb']

opacity = 75
length_fade = 1500
delay_fade = 500
toX = 300
toY = 300
length_move = 5000
delay_move  = 0
 
Set fadeAnim = CreateObject(“DXScriptLibrary.FadeAnimation”)
Set moveAnim = CreateObject(“DXScriptLibrary.MoveAnimation”)
 
fadeAnim.Init DesktopX.Object(“My_Object_Layer”), opacity, length_fade, delay_fade, Animator.EaseNone, “”
moveAnim.Init DesktopX.Object(“My_Object_Layer”), toX, toY, length_move, delay_move, Animator.EaseIn, “”
 
Animator.Add Array(fadeAnim, moveAnim)
Animator.Start

[/sourcecode]

So, what this code does is prepare 2 animations with different length and start time, give them to the animator component and then start the animations. The Animator object will automatically manage the animations, starting each one after the delay (and of course fade will apply to all child objects). You can also add a new animation while the previous ones are playing, it will be handled transparently, adjusting delays and total animation length.

As a bonus, you can specify the easing type. In the example, the object will start to move slowly and speed up as it moves through the animation.

There are 4 different animation objects (Fade, Move, Rotate, Resize) and 5 types of easing (EaseIn, EaseOut, EaseInOut, EaseOutElasticBig, BackOut). Everything is in separate components with minimal dependencies, so adding new stuff is relatively easy should you wish to so (new easing types for example)

Download from here.

DXCanvas 1.1

Posted by Julien on December 10th, 2008

DXCanvas-Preview The final 1.1 version of DXCanvas is now available directly from here or on Wincustomize. There is now two new functions available from script allowing you to suspend the canvas drawing updates. This allows you to do all the drawing necessary for a frame of animation and refresh the canvas at the end, instead of having it refresh at 30fps while your script is doing all the drawing operations.

With this new API, it was possible to fix all the flickering in the included examples! I’ve also added a few new example scripts. Check out the Polygon example, as well as all the text-related ones.

Changelog

1.1 Build 287:

  • Added manual drawing mode with suspendDrawing/resumeDrawing methods
    (this should allow users to work around the flickering)
  • Fixed text position being off baseline when drawing on a path
  • Fixed a rare crash when drawing text on a path
  • Activated Pixman MMX&SSE2 fast paths
  • Updated Pango to fix font leak (rev 2746)
  • Updated Pixman (0.13.2)

DXCanvas 1.1 Beta

Posted by Julien on November 27th, 2008

DXCanvasShadowsThis small update brings a proper shadow implementation with blurring, two new functions (textPath and textAlongPath) and a few bug fixes. textAlongPath is still somewhat buggy with multi-segment paths but otherwise works great (see the TextWave demo). I fixed a few problems with arcTo that wasn’t working as specified and made a few changes here and there. More importantly, I fixed a nasty crash bug that was sometimes happening on exit.

The main thing not fixed in this version is the flickering when drawing, but I think I know what the root of the problem is and I might be able to fix it for the final 1.1 build.

You can find a beta build here.

Changelog

1.1 Build 269:

  • Added textPath, textAlongPath (with stroke or fill option)
  • Added support for shadows
  • arcTo is incorrect when the three points are collinear
  • arcTo should draw a straight line from P0 to P1
  • restore() with an empty stack has no effect
  • Corrected order of data returned by getImageData (BRGA -> RGBA)
  • ImageData is now converted to non-premultiplied color
  • Preserve the current path when clipping
  • rgba colors were not converted to string properly (green had the wrong value)
  • Some composite operations are now handled correctly
  • Fixed Debug build crashing when expired
  • Fixed stack overflow crash on exit
  • Added check for font validity on assignment and fallback to default font (will raise an error in debug mode if font is incorrect)
  • Moved state management to its own class
  • Updated Cairo(1.8.4), Pixman(0.12.0), Pango(1.22.3), Glib(2.18.3) and libpng(1.2.33)

Nightmares – a dynamic dream testing utility

Posted by Julien on August 31st, 2008

Nightmares (Build 1.0.173) - Dynamic dream testing utilityNightmares is a small application created to test dynamic dreams. It runs them in a window,
allowing you to debug them easily or to record a preview video.

You can set the window size (default is 800×600), chose an output file and FourCC code for the output video.

It currently only runs unprotected dreams: the dreams that come with DeskScapes will work, but any dynamic dream that you bought won’t.

See the readme file for command line switches.

Download test build here.

Update: Added preliminary support for protected Dreams (you will have to activate them first through DeskScapes).

DXCanvas – a canvas implementation for DesktopX

Posted by Julien on August 26th, 2008

Every major browser has support for it, Yahoo! Widgets has support for it, how come there isn’t something for DesktopX?

Enter DXCanvas, a DesktopX drawing plugin that implements the Canvas spec (plus some DesktopX-specific additions).

How does it work

Configure Canvas Plugin

DXCanvas is a DesktopX drawing plugin, which means it takes over drawing for the object it is associated to.

In the configuration, you can set the initial size for the canvas. By default, the drawing surface size will be 300×150. You can also specify whether you want the surface to be transparent and show the other objects or windows under it, or opaque.

A canvas object is made available to scripting. To be able to draw on the canvas, you need to request a context. This is done by calling getContext(type) on the canvas object. The only supported type right now is "2d".

See the list of functions in the implementation section. Note that some are slightly different from the Canvas specification, or are completely new. This is to adjust to differences in what is possible in a browser and in DesktopX.

Canvas Controller Widget

Preview I’ve made a little widget to make testing easier. It loads a list of scripts from a user-defined folder and allows you to switch between them. It support scripts written in both JScript and VBScript.

It basically associate the script to an object having the DXCanvas plugin as a capability.

Two functions are required for the scripts to work: Object_OnScriptEnter() and Object_OnScriptExit().

The canvas size is reset its default size of 300×150 when switching between scripts, so make sure to set it to the required size if needed by your script.

To add a new script to the list, create a new .js or .vbs file in a folder and select this folder in the widget preferences. A few test scripts are included in the Script folder.

It also support subfolders (only 1 folder deep), so you can organize your scripts in subfolders.

How to help

Download the Canvas Controller widget and start creating scripts!

What to look for

  • strange behavior: colors are not right, context is not saved or restored correctly, etc.
  • the output from a script is different in Firefox or Safari
  • crashes or memory leaks (there are a least a few :P )

What is broken/not working properly

  • Drawing still flicker (not as badly as before)
  • This is a DEBUG build, so it’s going to be slower than normal

Links

Changelog

1.0 Build 225:

  • Fixed large canvas objects taking a lot of CPU
  • Log is always enabled

1.0 Build 217

  • Fixed drawing being incomplete in some cases
  • Added workaround for pink color drawing transparent. DesktopX always use pink to draw transparent surfaces, even in per-pixel mode. rgb(255, 0, 255) will be changed to rgb(255, 1, 255)

1.0 Build 214

  • Added per-object log files
  • Added more log info when creating a new context object

1.0 Build 211

  • Added support for % in rgb/rgba colors
  • Added "transparent" color (equivalent to "rgba(0,0,0,0)")
  • Added SVG colors "darkgrey", "darkslategrey", "dimgrey", "grey", "lightgray", "lightslategrey" and "slategrey"
  • Zero size canvas is allowed
  • Properly share canvas state (context style stack was not properly shared before)
  • DrawImage and DrawImageRegion check for negative width and height and adjust the coordinates
  • Only match full color strings
  • Accept rgb values outside [0;255] and clamp the value properly
  • Clamp alpha and use premultiplied color values when painting with alpha (still somewhat wrong)
  • Fixed leak and crash with CanvasImageData & CanvasPixelArray
  • Fixed crash with invalid parameters in createImageData and getImageData
  • Zero-length line gradients should paint nothing
  • Radial gradients with the same start and end circle should paint nothing
  • Image data now accepts negative width and height (you get the untransformed data for the resulting rectangle)
  • arc() with zero radius draws a line to the start point.
  • arcTo() has no effect if the context has no subpaths or if P0 = P1
  • arcTo() draws a straight line to P1 if P1 = P2 or if radius = 0
  • bezierCurveTo() has no effect if the context has no subpaths
  • lineTo() has no effect if the context has no subpaths
  • quadraticCurveTo() has no effect if the context has no subpaths
  • Updated cairo, pixman and pango libraries

1.0 Build 201

  • Added hsl/hsla color parsing
  • Added some logging (DXCanvas.log in object directory)
  • Fixed text stroking always drawing at position (0,0)
  • Fixed text baseline being off by the text height

1.0 Build 191

  • Added redraw calls buffering (less flickering)
  • Added debugMode attribute to canvas. In debug mode, passing invalid parameters will result in an error being raised instead of the invalid value being silently ignored.
  • No longer returns errors when passing invalid parameters to a lot of functions (as specified in Canvas specification)
  • CanvasPixelArray.XXX6(index, value) now takes an int instead of a char and will clamp that value to [0;255]

1.0 Build 180

  • Implemented toImage
  • Implemented createImageData, getImageData and putImageData
  • Added canvas support to createPattern, drawImage and drawImageRegion
  • Fixed createPattern, drawImage and drawImageRegion not working in VBScript
  • Fixed createPattern, drawImage and drawImageRegion not making a copy of the source image or canvas
  • Fixed drawImageRegion using wrong default values for dw and dh
  • Fixed drawImageRegion not creating a new path, resulting in image "corruption"

1.0 Build 168

  • Implemented font attribute setter/getter
  • Implemented fillText, strokeText and measureText (using Pango)
  • Implemented arcTo (using patch from Behdad Esfahbod)
  • Fixed image loading (SD_LOAD_IMAGE seems to be corrupting some images…)

1.0 Build 159

  • Implemented textAlign and textBaseline attributes setters/getters  (not used yet)
  • Implemented createPattern, loadImage, drawImage and drawImageRegion
  • Update to cairo 1.7.4 (better support for text)
  • Statically linked to cairo lib (no need for cairo.dll anymore)

1.0 Build 149

  • First test version

Download

You can download a test version here. It only includes the Canvas Controller widget for now. Please do not use the DXCanvas plugin in your own objects and widgets yet. This version of the plugin will expire on the 10/01/2008.

Implementation

Under the hood, it’s using Cairo, a 2D vector graphics library that also powers the Mozilla and Yahoo Widgets implementations. Right now, the Cairo library is dynamically loaded at runtime, but I hope to have it statically linked into the plugin for the final version.

Here is a list classes with their attributes and functions and the state of their implementation

Canvas

Name Implemented Comment
width YES  
height YES  
debugMode YES Invalid input will raise an error instead of being ignored.
getContext(type) YES  
toImage(path) YES Saves to a PNG file (replaces toDataURL)

 

CanvasRenderingContext2D

Name Implemented Comment
globalAlpha YES  
globalCompositeOperation YES  
strokeStyle YES  
fillStyle YES  
lineWidth YES  
lineCap YES  
lineJoin YES  
miterLimit YES  
shadowOffsetX YES Shadows are not implemented yet.
shadowOffsetY YES Shadows are not implemented yet.
shadowBlur YES Shadows are not implemented yet.
shadowColor YES Shadows are not implemented yet.
font YES  
textAlign YES  
textBaseLine YES Hanging and ideographic baselines are treated as alphabetic.
canvas YES  
save YES  
restore YES  
scale(x, y) YES  
rotate(angle) YES  
translate(x, y) YES  
transform(m11, m12, m21, m22, dx, dy) YES  
setTransform(m11, m12, m21, m22, dx, dy) YES  
createLinearGradient(x0, y0, x1, y1) YES  
createRadialGradient(x0, y0, r0, x1, y1, r1) YES  
createPattern(input, repeat) YES  
clearRect(x, y, w, h) YES  
fillRect(x, y, w, h) YES  
strokeRect(x, y, w, h) YES  
beginPath YES  
closePath YES  
moveTo(x, y) YES  
lineTo(x, y) YES  
quadraticCurveTo(cpx, cpy, x, y) YES  
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) YES  
arcTo(x1, y1, x2, y2, radius) YES  
rect(x, y, width, height) YES  
arc(x, y, radius, startAngle, endAngle, anticlockwise) YES  
fill() YES  
stroke() YES  
clip() YES  
isPointInPath(x, y) YES  
fillText(text, x, y) YES  
strokeText(text, x, y) YES  
measureText(text) YES  
loadImage(path) YES  
drawImage(input, dx, dy, dw, dh) YES  
drawImageRegion(input, sx, sy, sw, sh, dx, dy, dz, dh) YES  
createImageData(sw, sh) YES  
getImageData(sx, sy, sw, sh) YES image data uses the BGRA format
putImageData(imageData, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight) YES  

 

Gradient

Name Implemented Comment
addColorStop(offset, color) YES  

 

ImageData

Name Implemented Comment
width YES  
height YES  
data YES  

 

PixelArray

Name Implemented Comment
length YES  
XXX5(index) YES  
XXX6(index, value) YES  

 

TextMetrics

Name Implemented Comment
width YES