 _   _  ___ _____ ____  ____   ___ _____ ____   ____  _     _
| | | |/ _ \_   _/ ___||  _ \ / _ \_   _/ ___| |  _ \| |   | |
| |_| | | | || | \___ \| |_) | | | || | \___ \ | | | | |   | |
|  _  | |_| || |  ___) |  __/| |_| || |  ___) || |_| | |___| |___
|_| |_|\___/ |_| |____/|_|    \___/ |_| |____(_)____/|_____|_____|


----------------------------------------------------------------
hotspots.dll   v0.62                          September 27, 2001
----------------------------------------------------------------
Pavel Vitis
pavel.vitis@seznam.cz


================================================================
1. Description

With Hotspots you can define transparent rectangular areas on
the screen called "hotspots". You will get ability to trigger
events (execute programs or !bangs) on mouse over, or on mouse
click. You can attach different cursor shape to each hotspot,
assign tooltips, transparently snap hotspot to any window, etc.



================================================================
2. History

v0.62 / September 27, 2001
	* Win2K: Finally I'm able to test / debug HOTSPOTS on Win2K
	* Win2K: Fixed so already open application is correctly sent
	  into foreground, when in Win2K
	* Win2K: Fixed functions operating with processes/modules so
	  it works now on Win9x/Win2K/WinNT
	* Win2K: Improved KMHOOK.DLL for Win2K
	* Win2K: Fixed handling of mouse move messages
	+ Win2K: Since it seems that something like "exact timing"
	  is history in Win2K, I had to add parameter:
	  HotspotsTimerResolution ms
	  (Use 10 for Win9x, 50 works for me on Win2K)
	- Win2K: Changing of cursor shape is not working properly
	  in Win2K. I'm not able to fix it ...at least for now
	+ New window animated rectangle effect, when switching
	  to hidden/minimized window (HotspotsWindowAnimation).
	  There are four more hidden (undocumented) parameters
	  that control this feature for you to find... :)
	* Tested successfuly on Windows 2000 SP2, Windows 98 SE

v0.61 / August 15, 2001
	* Fix: RevisionID strings wasn't returned correctly
	* Due to LSDev-builds bug in LCReadNextLine, I was forced
	  to change config format again (hope it's last). So, use
	  "*hs ~" instead of "*hs~" to end hotspot definition, or
	  simply "*hs"
	* Changed timer to WM_TIMER based. Again, latest LSDev build
	  block SetTimer() to TimerProc() directly
	* Correction in this doc, all double-click actions are
	  "xxx_xdb" and not "xxx_xbd"
	  (i.e.: action_ldb = action left-double-button)
	* Some more little fixes

v0.60 / August 08, 2001
	* Completely rewritten into C
	* Changed STEP.RC configuration format - much more
	  flexible and lucid now
	- Old configuration format is not supported anymore,
	  conversion to new format should be very easy for you
	* !HotspotUpdate format changed too, you may update
	  any number of parameter(s), in any order
	+ Added optional tooltips to hotspots
	+ Added more actions (Left+Right / Left+Middle /
	  Middle + Right mouse buttons simultaneously pressed)
	+ Added sound_enter, sound_leave, sound_action parameters
	+ Added flags: B, I, U, 1, 2, 3
	- Removed C flag, replaced by 1, 2, 3 flags (consume click
	  of 1=left, 2=right or 3=middle buttons)
	* Hotspot rectangle may be defined as relative to its snap
	  window
	* Fixed handling of double-clicks
	* KMHHOOK.DLL also rewritten into C, now should be more
	  stable and faster
	* Source code is now available under GPL license
	* ...and *a lot* of another bugfixes!

v0.56 / February 12, 2001
	* bugfix: occassional crash on mouse click
	* bugfix: compatibility with older version of KMHOOK.DLL
	* bugfix: changed timer initialization - now works with
	  newest LS builds
	* bugfix: cursors from custom cursor schemes are now
	  correctly refresed
	* bugfix: hotspots reacts on screen-resolution changes
	+ Size can have negative value (it is then offset of
	  right hotspot edge from right screen edge)
	* tweaked this documentation
	* updated to-to list (below) - some suggestions?
	! WARNING: read updated installation instructions (below)

v0.55 / January 31, 2001
	+ Hotspot can be attached to specified window(s)
	  idea by: xnowfall <xnowfall@xnowerks.org>
	+ Add '@' before program name to run it hidden
	+ Added HotspotsWindowAnimation parameter
	+ Hotspots are disabled during mouse-dragging
	* "Name" parameter in commands/bangs may include
	  wildcards (see Note below)
	* Restoring of application window improved - when
	  application is already running and "O" (one instance)
	  flag was used
	* Optimizations of window handling code
	* Delay time now in 1/100 second ticks
	* Uses new kmhook.dll v1.1
	* Adjusted to work on PureLS 28.01.01

v0.54 / January 21, 2001
	* bugfix: hotspot not transparent: definitely fixed
	* bugfix: resource leak in cursor-handling
	* Improved fullscreen detection
	* "Delay" maximum value increased (actualy 864000 = 24h)
	  (requested)
	* Improved cursor setting code
	+ Added HotspotsDisabledInFullScreen
	+ Added 'F' flag (enabled in Fullscreen)
	+ Added bangs !HotspotEnable / !HotspotDisable to control
	  single hotspot (Same as !HotspotUpdate "Name" "D")
	+ Added few new cursors
	+ Now uses KMHOOK.DLL (keyboard & mouse systemwide hook)
	  Copy it along with HOTSPOTS.DLL
	* DLL overhead reduced

v0.53 / June 29, 2000
	* bugfix: action_out was not properly disabled when "D"
	  flag used
	+ Added 'O' (OneInstance) flag
	+ Added experimental feature - Hotspots are disabled
	  when any application is running fullscreen. It should
	  prevent conflicts with some games

_____ / June 28, 2000
	* Updated readme
	+ Added sample .rc file HOTSPOTS.RC

v0.52 / June 24, 2000
	+ Added 'P' flag
	+ Added ability to load custom mouse-over cursors from
	  file (.CUR, .ANI), added HotSpotCursorDir variable
	+ Added 18 new click+shiftkey actions
	+ Some sample cursors

v0.51 / June 23, 2000
	* Hotspots click-through bug now *should* be fixed.
	  Hotspots weren't transparent for mouse-clicks in
	  previous beta version.
	  Try it and let me know.

v0.51 beta / March 1, 2000
	+ Added !HotspotsToggle bang (To toggle single hotspot,
	  use !HotspotUpdate "Name" "D")
	+ Added six mouse-click actions: action_lb, action_rb,
	  action_mb, action_lbd, action_rbd, action_mbd
	+ Custom cursor change on hotspot mouse-over
	! Hotspots do not pass mouseclick to underlaying windows.
	  It might be a big problem for some sort of use. Please
	  take this into account and do not use this version if it
	  is problem for you.
	+ New LitestepGoodies mirror at http://lsg.come.to/

v0.5 / February 5, 2000
	* Hotspots under WinNT with no limitations. Key modifiers
	  now works here.
	* Fixed bug: Unable to disable hotspots
	* Flags are now "toggle" based
	+ New flag "0" - clear all previously set flags

v0.4a / January 24, 2000
	* Hotspots tested under WinNT, removed key-modifiers
	  actions in WinNT/2K.

v0.4 / November 10, 1999
	* Fixed bug that caused crashes on WinNT (timerproc)
	+ Hotspots are automatically disabled when screensaver is
	  running
	+ Hotspots.dll now returns RevisionID string
	+ Added some items into to-do list

v0.3 / September 26, 1999
	* Optimizations
	* Format of hotspot definition slightly changed
	+ Added separate actions for Ctrl/Shift/Alt key modifiers
	+ Added mouse-out action

v0.2 / September 07, 1999
	* Fixed some ugly bugs
	* Fixed some minor bugs
	* Some internal optimizations
	+ Coordinates can be negative values
	+ Sizes can be zero - they are recalculated to maximum
	+ Option to start hotspots disabled
	+ Added params to hotspots
	+ Added !HotspotsEnable
	+ Added !HotspotsDisable
	+ Added !HotspotUpdate

v0.1 / September 06, 1999
	+ First release, very raw



================================================================
3. Installation

3.1. Files installation:

First, copy HOTSPOTS.DLL and KMHOOK.DLL directly into your
Litestep directory. If you are upgrading from previous version,
first ensure that both modules HOTSPOTS.DLL and KMHOOK.DLL are
unloaded, otherwise you will encounter file-sharing errors
when trying to overwrite these files.

KMHOOK.DLL may be shared by another modules too, so unload all
modules that use it (currently HOTSPOTS.DLL, ONIDLE.DLL,
MOUSEHIDE.DLL, GESTURES.DLL, WINRECT.DLL). Issue !UnloadModule
bang on all these modules, or simply quit Litestep/PureLS.
Then overwrite files with their new versions.

It is highly recommended to use newest version of KMHOOK.DLL.
You can always download the latest version at:
http://lsg.come.to/other/kmhook.zip


Setup some hotspots in STEP.RC (below) and load module in
STEP.RC file:

  LoadModule "c:\litestep\hotspots.dll"

or via bang command:

  !ReloadModule "c:\litestep\hotspots.dll"


================================================================
4. Settings

 4.1. STEP.RC syntax is as follows:

	*hs "hotspot name"
	*hs flags	flags_list
	*hs cursor	cursor_name_or_path
	*hs rect	x-pos y-pos width height
	*hs delay	time_in_ms
	*hs snap_win	class_name
	*hs snap_mod	module_name
	*hs action_xx	action_string
	*hs ~

 4.2. "name"

is the unique identifier of the hotspot. Use some
descriptive string here. Multiple hotspots can share same name.
This name is used to reference the hotspot in other operations/bangs.


 4.3. "flags"

is string of at least one of flags:

  S - *S*ilent mode - hotspot doesn't beep
  D - *D*isabled mode - hotspot is initially disabled
  X - Start application ma*X*imized
  M - Start application *M*inimized
  O - *O*ne Instance - Run only one application instance. If already
      running - just activate its window
  F - Enable this hotspot when application is in *F*ullscreen mode
  I - *I*gnore shift keys (Ctrl, Alt, Shift)
  B - Do not require *B*utton-down event for mouse click actions
      (normally, button-actions are triggered after button-down-then-up
      sequence)
  U - Always run o*U*t action, even if in-action has not been triggered yet
  1 - Consume left mouse button clicks (*1*-st button)
  2 - Consume right mouse button clicks (*2*-nd button)
  3 - Consume middle mouse button (if present) clicks (*3*-rd button)
  0 - (zero) clear all previously set flags

Any specified flag toggles its previous state.
Place '+' before flag to set it, '-' to clear it

*example*:
  *hs flags OX1


 4.4. "cursor"

 defines custom mouse-over cursor

  1) It is full path to .ANI or .CUR cursor file

  2) Or any of predefined names:

    0             (zero) clear previously defined cursor
    APPSTARTING   Standard arrow and small hourglass
    ARROW         Standard arrow
    CROSS         Crosshair
    IBEAM         Text I-beam
    NO            Slashed circle
    SIZE          Windows NT only: Four-pointed arrow
    SIZEALL       Same as IDC_SIZE
    SIZENESW      Double-pointed arrow pointing northeast and southwest
    SIZENS        Double-pointed arrow pointing north and south
    SIZENWSE      Double-pointed arrow pointing northwest and southeast
    SIZEWE        Double-pointed arrow pointing west and east
    UPARROW       Vertical arrow
    WAIT          Hourglass
    HAND          Hand (hyperlink pointer)

There are some sample cursors available for download on my site.
I suggest to copy them to Litestep\Cursors directory and
set path variable (do not forget to put "\" at the end):

  HotspotCursorDir "c:\litestep\cursors\"

*examples*:
  *hs cursor anim_arrow.ani
  ; this is the same as above:
  *hs cursor c:\litestep\cursors\anim_arrow.ani
  *hs cursor special\wheel_cur.ani
  ; this is the same as above:
  *hs cursor ..\cursors\special\wheel_cur.ani


 4.5 "rect"

define hotspot rectangle as position and size.

You can use negative values.
Width, Height are in pixels. Zero value "0" means maximum
size (hotspot width/height reaches opposite screen border).
Negative values in position means that position will be substracted
from right/bottom screen border.

In case you are defining snap-on-window hotspot, the size may
be ommited, hotspot will cover entire snap window area.

Position and size is taken relative to global screen coordinates,
or relative to snap window, if you specified any with snap_class,
snap_module or snap_title.

*examples*:
  *hs rect 0,0,120,20
  *hs rect 0 0 0 10
  *hs rect -2:0:0:0

As you can see, to separate coordinates, ' ', ',' or ':' characters
may be used.


 4.6. "delay"

is the time interval (in 1/10 sec) that defines how
long should mouse pointer stay in the hotspot area before
triggering associated action. It is here to avoid accidental
actions when working with mouse.

*example*:
  *hs delay 0


 4.7. "action_xx"

may be any executable, file, or !bang command.
If non-executable file is specified, it will be open with associated
application.
You can prefix filename with '@' to force hidden start of application.

actions can be:

 action_in, action_enter	Mouse in
 action_out, action_leave	Mouse out
 action_shift				Mouse in + Shift key
 action_alt					Mouse in + Alt key
 action_ctrl				Mouse in + Ctrl key
 action_lb					Left button click
 action_rb					Right button click
 action_mb					Middle button click
 action_lbd					Left button double-click
 action_rbd					Right button double-click
 action_mbd					Middle button double-click
 action_lrb					Left + right button simultaneously
 action_lmb					Left + middle button simultaneously
 action_mrb					Middle + Right button simultaneously

 action_shift_lb			Left button click + ShiftKey
 action_shift_rb
 action_shift_mb

 action_alt_lb
 action_alt_rb
 action_alt_mb

 action_ctrl_lb
 action_ctrl_rb
 action_ctrl_mb

 action_shift_ldb			Left button double-click + ShiftKey
 action_shift_rdb
 action_shift_mdb

 action_alt_ldb
 action_alt_rdb
 action_alt_mdb

 action_ctrl_ldb
 action_ctrl_rdb
 action_ctrl_mdb


*examples*:
  *hs action_in		!screensaver
  *hs action_out	!screensaverstop
  *hs action_shift	"control.exe desk.cpl ,1"


 4.8. "snap_module", "snap_class", "snap_title"

if defined at least one of these parameters, hotspot will snap on
any window matching that criteria. It will cover entire window area,
or if rect is defined, it will maintain its position and size relative
to window's position and size.

*examples*:
  *hs snap_module	explorer.exe
  *hs snap_class	CABINETCLASS
  *hs snap_title	"control panel"


 4.9. "sound_enter", "sound_leave", "sound_action"

allows you to specify different sounds to be played when triggering
actions



 4.10. You can define sound that will play when action is triggered:

  HotspotBeep "path_to\beep.wav"

To play any system event sound, use one of following predefined names:

  SYSTEMSTART
  SYSTEMEXIT
  SYSTEMHAND
  SYSTEMASTERISK
  SYSTEMQUESTION
  SYSTEMEXCLAMATION
  SYSTEMWELCOME
  SYSTEMDEFAULT

You can disable hotspots functionality at startup by specifying:

  HotspotsDisabled


 4.11. And there are some !Bangs:

  !HotspotsEnable
  !HotspotsDisable
  !HotspotsToggle
  !HotspotEnable "Name"
  !HotspotDisable "Name"

  It is possible to use wildcards in Name parameter

Update hotstpot values:

  !HotsopotUpdate "name" parameter-1=option-1,option-2,...option-n ... parameter-n=option-1,option-2,...option-n

*example*:
  !HotspotUpdate "topbar" rect=0,0,0,20 tooltip="Click for popup" action_lb=!Popup


================================================================
5. Notes:

Wildcards may be used in some parameters:

"Name" in *HotspotUpdate, !HotspotUpdate
"Name" in !HotspotEnable, !HotspotDisable
"ModuleName", "ClassName" in *Hotspot

Hotspots.dll uses LSAPI function match() to evaluate wildcards.

Taken from LSAPI.C source documentation:
---------
 '*' matches any sequence of characters (zero or more)
 '?' matches any character
 [SET] matches any character in the specified set,
 [!SET] or [^SET] matches any character not in the specified set.

 A set is composed of characters or ranges; a range looks like
 character hyphen character (as in 0-9 or A-Z).  [0-9a-zA-Z_] is
 the minimal set of characters allowed in the [..] pattern
 construct.
 Other characters are allowed (ie. 8 bit characters) if your
 system will support them.

 To suppress the special syntactic significance of any
 of `[]*?!^-\', and match the character exactly, precede it
 with a `\'.
---------


================================================================
6. Example step.rc entries:

See enclosed hotspots.rc file to get some examples.



================================================================
7. Features, limitations

If any of your hotspots will overlap, the control over overlapped
region takes hotspot defined later.

You can define up to maximum of 50 hotspots.
"This should be enough for everyone..." ;)



================================================================
8. TO-DO list - Plans for future versions

1) Optional list of excluded apps (especially games running in
   fullscreen)
2) Allow hotspots to be overlapped
3) Different flags for each action type

7) Rewrite this blahblah to html format to make it more readable.



================================================================
9. Known bugs

1) When mouse cursor leaves the hotspot too fast after triggering
in_action, the out_action does not execute. I have no idea... :-\
2) Crashes in Windows 2000: if you experience this problem, please
read BUGREPORT.TXT file.

Any suggestions will be welcome too, don't hesitate and email me.



================================================================
9. Troubleshooting

Q: After installing new version of KMHOOK.DLL, some of other
modules wont work - MOUSEHIDE.DLL, ONIDLE.DLL
A: KMHOOK.DLL interface has changed, ONIDLE.DLL and MOUSEHIDE.DLL
should be also updated with their newest versions

Q: I'm running Windows 2000. HOTSPOTS.DLL doesn't run or it crash
Litestep, or defined hotspots do nothing
A: There are some bugs related to Win2000, please read BUGREPORT
file for more info



================================================================
11. Contact & additional info, resources:

author: Pavel Vitis
mailto: pavel.vitis@seznam.cz
www   : http://floach.pimpin.net/pavel/
mirror: http://lsg.come.to/

Programmed in LCC-Win32 free C compiler/tools by Jacob Navia:
http://www.cs.virginia.edu/~lcc-win32/
