Layercut 1.4
The Layered Shortcut Module
Layercut is a module for LiteStep based on the shortcut2 module. It's allow you to
make real transparency shortcut with 32-bits png.
This module only works on Windows 2000/XP.
-=
Syl
=-
Table of contents
History
05/04/2002 - ver 1.4
- Added flag K to the shortcut line (for non-clickable shortcut)
- Well... there was still a z-order problem (thanks again to blkhawk for the explanation)
29/03/2002 - ver 1.3c
- Fixed the Ultimate z-order bug ^_^
19/03/2002 - ver 1.3b
- Fixed some problems with z-order (thanks to blkhawk for the tips).
04/03/2002 - ver 1.3
- Added
execution .
- Reset the animation when the shortcut is shown/hidden.
- Shortcuts that don't have caption won't be displayed in the task manager.
28/02/2002 - ver 1.2b
- Fixed the way to manage the second action.
27/02/2002 - ver 1.2a
- Added
flags E and S (ActionIn and ActionOut).
24/02/2002 - ver 1.2
- Changed the way to handle images, now it takes less memory if you load same images with different shortcuts.
- Removed an optimisation (!!!), shorcuts were loaded when they were visible on startup, now everything is loaded on startup, it's easier to use with LSDynamic.
- Added
animation support.
- Added documentation in french.
- Fixed the slowdown when shortcut was moving (with LSDynamic) and the mouse was moving over.
- Fixed
ShortcutAlphaThreshold .
- Fixed the way to create shortcuts (shortcuts which should be on bottom were a little bit on top...).
04/02/2002 - ver 1.0
started the 03/02/2002.
Installation
Copy Layercut.dll in your module directory and load the module:
LoadModule "c:\LiteStep\Modules\Layercut.dll"
if c:\LiteStep\Modules\ is your module directory of course...
Don't forget to not load the shorcut2.dll module, because it's useless...
Usage
Advantages:
- Shortcut with real transparency
- Shortcut alpha channel is enable and make the shortcut transparent
- Faster with LSDynamic
- Animated shortcuts
- Take less memory
Disadvantages:
- a little bit slower than shortcut2
- zorder is different than shortcut2
Syntax color:
The syntax is compatible with shortcut2. You can also specify the alpha value
for the shortcut:
*shortcut
<caption>
<x-pos>
<y-pos>
<image-normal>
<image-hover>
<image-click>
#<group><flags>
a:<alpha-value>
<hover-sound>
<sound-click>
<action>
<alpha-value> is between 0 (transparent) to 255 (opaque). for example,
a:128 is 50% transparent.
For more information about how shortcut works, view the help file about shortcut2
in the LiteStep documenttion folder.
With a little trick, you can add another action to your shortcut when you right click on it.
To enable this feature, you have to use 2 !execute bang command, like this:
*Shortcut "" 0 0 normal.bmp hover.bmp click.bmp !execute [cmd1][cmd2] !execute [cmd3][cmd4]
cmd1 and cmd2 will be executed when you left click on the shortcut, and cmd3 and cmd4 when you right click.
If the flag K is specify, you can't click on the shortcut, finally, it just become a bitmap on your desktop...
If the flag D is specify, the second action will be executed when the mouse will be over the shortcut (ActionIn).
If the flag S is specify, the second action will be executed when the mouse will move out the shortcut (ActionOut).
WARNING: this syntax is obsolete but still working. You should use the execution syntax.
Settings
ShortcutDefaultAlpha <value>
Set the default alpha for the shortcuts.
ShortcutAlphaThreshold <value>
Set the threshold when the clipping region will be computed from the alpha channel. Each value in the alpha channel under the
threshold is considered to be transparent. The default value is 0 (black is transparent).
ShortcutNoLoadingOnStartup
Load the shortcut when it becomes visible (so it isn't loading all shortcuts on startup, back to shortcut2 style).
Bangs
!ShortcutGroupSetAlpha value groups
Change the alpha of a shortcut group.
Animation
The image for animation is based on the image in CursorXP schemes format. You can
store each animation in one file, then specify the width and the height of one frame (image).
Layercut will compute the number of frame with the width and the height that you specified.
You have to add some definition line to your step.rc to enable animation, then you just have
to replace the name of the image by the <animation-name>
in the shortcut definition.
<animation-name> :
... is the name of the animation. Replace an image state in the shortcut definition with
the animation name. You can put an animation for normal state, hover state and click state.
image :
Which image will be used for the animation. <image-name>
can be a bmp or a png image.
size :
Specify the width and the height for a single image.
speed :
Specify the speed in milliseconds when Layercut will play the next frame.
the default value is 100 ms.
flags :
Here is the different flags:
O : force the Opacity of the animation (same as shortcut2).
L : animation Loop.
F : the animation will Finish the play before starting the next animation.
P : the animation will start (Priority) even if the current animation has the F flag (the current animation will be stopped). Useful for the click state...
between :
When the animation is looping, the default range for the loop is from the frame 0 to the last frame.
When you specify between , you can chose where Layercut will
loop by specifying the <first-frame> and
the <last-frame> . For example if the range is
between 10 and 30, Layercut will play the frame 0, 1, 2, 3, ..., 29 then will loop to the frame 9.
Execution
To make the syntax more readable, you can use this configuration for your command line.
You have to add some definition line to your step.rc to enable execution syntax, then you just have
to replace the name of the command by the <execution-name>
in the shortcut.
<execution-name> :
... is the name of the command macro. Replace the command in the shortcut definition with
the execution name.
left, right, in, out :
You can specify a command for left click, right click, or when the mouse enter or leave the shortcut.
You don't have to specify a command fo each state (if you just want to use right click, forget left, in and out).
Examples
copy the png files in your images directory, copy the layercut.rc file in your
LiteStep directory (or theme directory), then include it in your step.rc file.
Tips
You don't have to replace your image from bmp to png, Layercut also work with bmp (but you won't have
the alpha transparency per pixel, only the fast global alpha).
To create a png with an alpha channel, there is two way (with Photoshop):
You can create a new image with a transparent background, and draw a new image on it, then
save this image into a png file.
Or you can add a new channel to the image in the layer tab, then draw a black and white image,
where black is transparent and white is opaque. The advantage of the alpha channel is that you
can make alpha-per-pixel and use the 256 colors grayscale to make smooth transparency.
You can also convert 32-bits tga to 32-bits png.
To make mouse-out state, use the flag L (loop) with between and the flag F (finish), like this,
the animation will loop in the range specify with between, and when the mouse will move out,
the animation will continue to play until the end.
To make animated shortcut, you should use AniUtil 1.3
from the CursorXP homepage.
Known bugs
This module only works on Windows 2000/XP.
This module is slower than the standard shortcut2 if you use it like shortcut2,
I mean that if you don't want transparency, don't use it.
This module was made because it was too slow with LSDynamic to make shortcuts transparent,
and this module is faster for transparency than other applications could make (like LSDynamic
with shortcut2). Use the setting DynLayeredShortcut because you can't change the alpha
of this shortcut in the old way. If you don't, this won't work.
Due to the huge modification to make shortcuts transparent, some flags for windows creation
has changed, and some modification may appear with ontop shortcut, or when you change the
ontop state of a shortcut. I tried to keep the shortcut2 feelings, but sometimes it was impossible.
If you use an animated shortcut for the normal state, and if this one is looping and has a very
short delay ( < 100 ), this will take a lot of cpu time, you should increase your delay.
From the MSDN's FAQ:
"First of all, the Task Manager's Applications tab does not
actually show applications.it shows the captions of visible, top-level windows
(since this is how users typically decide which application they want to switch
to). The Task Manager builds this list by walking through all of the top-level
windows in the system (using something like EnumWindows), and adds to the list
the windows that have the WS_VISIBLE style bit turned on."
In LSDynamic, to get the window handler, I'm using EnumWindows, and the shortcuts
are visible, that's why you see them in the task manager.
And I can't do anything about that.
Greetings
Thanks to the LSdev Team to let me use the shortcut2 sources to make this module.
Thanks to xnowfall (official beta-tester ;-) )
Thanks to NeoRamasay for letting me use some images from 3D Crystal Ex to illustrate Layercut.
Thanks again to xnowfall for the LiteStep logo example.
Contact
If you have a problem, want a new feature, want to report a bug, or want the source code, email me.
-=
Syl
=-
|