Layercut 1.72
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
04/03/2003 - ver 1.72
- Fixed positioning relative to centered shortcuts.
- Fixed inconsistency between centered and normal co-ordinates.
- Added
ShortcutPrimaryMonitor ,
with co-ordinate flag P to toggle for individual co-ordinates.
- Co-ordinate
'-0' (negative zero) is now different from '0' .
- Added
ShortcutUpdatePos .
- Added
middle and drop to execution .
- Fixed resource leak (thanks to ilmcuts).
- Added optional separation of
tool-tip and title .
- No longer appears in Task Manager.
- Z-order fixes..
- Fixed destruction with LsBox.
13/11/2002 - ver 1.7
08/07/2002 - ver 1.6
26/06/2002 - ver 1.5
- improve the z-order management for the non ontop shortcuts. (thanks to Mugendai)
- Other fixes.
14/04/2002 - ver 1.4a
- Hiding or showing a shortcut doesn't change its z-order anymore.
- When a shortcut has a in-action, it doesn't activate this action when you click on the shortcut.
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).
07/03/2002 - ver 1.3a
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...).
11/02/2002 - ver 1.1
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>:<id>
<x-pos>
<y-pos>
<image-normal>
<image-hover>
<image-click>
#<group><flags>
a:<alpha-value>
<hover-sound>
<sound-click>
<action>
It is possible to have a window title
(used by lsdynamic) separate from the tool-tip. To do so
<caption> MUST be quoted
(regardless of spacing) and immediately followed by a colon and the desired identifier.
To force a negative co-ordinate, you can use '~' instead of '-' ,
the co-ordinate won't be relative to the opposite screen border. Co-ordinate
'-0' (negative zero) will place the shortcut just off the right/bottom
of the screen.
Each co-ordinate can be directly followed by one or more of:
R - relative to previous shortcut;
C - relative to screen-center;
P - uses the opposite of the co-ordinate system specified by
ShortcutPrimaryMonitor .
<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).
ShortcutSoundSync
The hover sound will be played till the end. Should freeze LiteStep during the playing.
ShortcutBoundToMonitor
Only for debug or theming purpose. This was enable by default but isn't very useful with real negative co-ordinates.
ShortcutNoDisplayChange
Don't update the shortcut position if the resolution change.
ShortcutUpdatePos
On display-change, base repositioning on current rather than created position.
Has no effect if ShortcutNoDisplayChange is true.
ShortcutPrimaryMonitor
Make co-ordinates relative to primary monitor rather than the virtual screen.
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, middle, drop, in, out :
You can specify a command for left click, right click, middle click, drop, or when the mouse enter or leave the shortcut. You don't have to specify a command for each state (if you just want to use right click, forget the others).
LsBox
To use Layercut with LsBox, do this:
- Define your animation and execution script in your step.rc like always
- Add this line in your box file: ModuleHook !LayercutModuleHook
- Define your Layercut's shortcut in the box file like always and replace the first keyword *Shortcut by *ShortcutBox
- That's all ! =)
Shortcut in box doesn't support alpha transparency, but you can use the box alpha transparency.
Shortcut in box support sound, animation, execution, region clipping (for mouse hover test) computed with alpha channel.
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.
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
=-
|