ClockWork 0.5
by Vendicator (http://pimpin.info/vendicator | vendicator@mail.com)

Analog clock module which should work on desktop/lsbox or in wharf.
Made since I couldn't find a working desktop analog clock module.

Used window&bitmap handling from systray2, clock drawing from aLsClock.
Code is split into several files due to the OOP layout and me wanting
to have modular code snippets.
Note that windows.cpp/.h are the lswinbase from ls (just wanted to have
them included if I wanted to base something else on this)

Note:
You need to use ClockWorkHandType "box" or other transparent compatible
hand type inorder for ClockWork to be visible with completely transparent
backgrounds.

Note2:
Inorder to use antialiased lines you need to have the gdiplus.dll library
installed (only non XP users, XP ships with gdi+ installed),
a distributable package is available from Microsoft at:
http://www.microsoft.com/downloads/release.asp?releaseid=32738
Will not work with win95.


Step.rc Settings:

Size & Placement:
	ClockWorkX
	Int, default: 0
	X placement of the clock window

	ClockWorkY
	Int, default: 0
	Y placement of the clock window

	ClockWorkWidth
	Int, default: 64 (alt. bitmap size)
	Sets width of the clock window

	ClockWorkHeight
	Int, default: 64 (alt. bitmap size)
	Sets height of the clock window


Window & bitmaps:
	ClockWorkHidden
	Bool, default: false
	Set whether to start ClockWork in hidden state

	ClockWorkAlwaysOnTop
	Bool, default: false
	Set whether ClockWork should be placed above all other windows

	ClockWorkBitmap
	String, default: none
	Location of the image to use as bg for ClockWork
	(use a transparent compatible hand when using a completely transparent bg)

	ClockWorkBitmapTiled
	Bool, default: false
	Set whether to tile if on otherwise stretch the image if window size is different from bitmap size

	ClockWorkBorderSize
	Int, default: 0
	Set width of border which isn't stretched/tiled

	ClockWorkBorderTop
	Int, defaults to whatever ClockWorkBorderSize is set to
	Individual setting of top border

	ClockWorkBorderLeft
	Int, defaults to whatever ClockWorkBorderSize is set to
	Individual setting of left border

	ClockWorkBorderRight
	Int, defaults to whatever ClockWorkBorderSize is set to
	Individual setting of right border

	ClockWorkBorderBottom
	Int, defaults to whatever ClockWorkBorderSize is set to
	Individual setting of bottom border

	ClockWorkBorderDrag
	Bool, default: false (not activated)
	If specified the user is able to reposition the clock using the mouse

	ClockWorkBGColor
	Color, default: FFFFFF
	Background color to use instead of bitmap
	(use a transparent compatible hand when using a completely transparent bg)

	ClockWorkBorderColor
	Color, default: 000000
	Color of border

	ClockWorkDoNotAlignUsingBorders
	Bool, default: false
	When this is set to false (default) clockwork will use the borders to find
	the size & center of the clock (not specifying clock hand length will also
	cause the hands to be shorter).
	When this is set to true, the center will be calculated using the specified
	size of the clockwork window.


Clock hands:
	ClockWorkHandType "box" / "line" / "triangle" / (gdi+) "aabox" / "aaline" / "aatriangle"
	string, default: "line"
	Determines the clock hand type that should be used.
	"line" is the standard version, using LineTo()
	(*) "box" similar to line, but drawn using polygons
	(*) "triangle" also drawn using polygons, wide base to pointy end
	(+) "aaline" line with antialiasing
	(+) "aabox" same as "box" but with antialiasing
	(+) "aatriangle" same as "triangle" but with antialiasing
	* = polygon based and therefore transparent compatible,
	use this if combined with a completely transparent region
	to allow the window region to be adapted to include the hands.
	Rounding errors might make the width of these modes look inaccurate at times.
	+ = modes that uses gdi+ to draw, accepts alpha transparency & antialiasing
	see top of readme if you get an error loading this module,
	then you will need to download the .dll from MS (http://www.microsoft.com/downloads/release.asp?releaseid=32738).

	ClockWorkHandAlpha
	Int between 0-255, default: 255
	Sets the alpha transparency of all the hands, only works with gdi+ handtypes (aa[..])

	ClockWorkHandBorder
	Int, default: 1
	Sets the border width that is painted with the normal color

	ClockWorkNoSeconds
	BOOL, default: false
	Disable display of the seconds hand

	ClockWorkResolution
	Int, default: 60
	Defines into how many steps the clock is divided (for smoother clocksteps increase this).
	Note that this increases mem usage (8b * Resolution) as well as cpu
	(since you need to update the window more often to see the effect)

	ClockWorkRefresh
	Int, default: 60000 / ClockWorkResolution
	Sets how often the clock should be refreshed, time given in milliseconds.
	With the default ClockWorkResolution=60, the refresh would be once every second.
	Just specifying a different resolution will adapt the refresh to optimum, but
	you have the ability to override the refresh setting if you feel like it.

	ClockWorkDrawOrder ? ? ?
	3 chars, default: h m s
	Determines in what order the hands should be drawn, h=hour, m=minute, s=second
	The hands are drawn above eachother so the last will be on top of the other two.

	ClockWorkHourHandType (same modes as ClockWorkHandType)
	string, default: whatever ClockWorkHandType is set to
	Individual hand type

	ClockWorkMinuteHandType (same modes as ClockWorkHandType)
	string, default: whatever ClockWorkHandType is set to
	Individual hand type

	ClockWorkSecondHandType (same modes as ClockWorkHandType)
	string, default: whatever ClockWorkHandType is set to
	Individual hand type

	ClockWorkHourAlpha
	Int between 0-255, default: whatever ClockWorkHandAlpha is set to
	Individual alpha transparency of hand

	ClockWorkMinuteAlpha
	Int between 0-255, default: whatever ClockWorkHandAlpha is set to
	Individual alpha transparency of hand

	ClockWorkSecondAlpha
	Int between 0-255, default: whatever ClockWorkHandAlpha is set to
	Individual alpha transparency of hand

	ClockWorkHourColor
	Color, default: 0000FF
	Sets color of the hours hand

	ClockWorkMinuteColor
	Color, default: 00FF00
	Sets color of the minutes hand

	ClockWorkSecondColor
	Color, default: FF0000
	Sets color of the seconds hand

	ClockWorkHourInnerColor
	Color, default: what ClockWorkHourColor is set to
	Sets the internal color of the hours hand in polygon hand types (ie. box),
	the normal color is then used as a wide border around the hand shape
	Note: AABox & AATriangle hand types accepts FF00FF for transparency

	ClockWorkMinuteInnerColor
	Color, default: what ClockWorkMinuteColor is set to
	Sets the internal color of the minutes hand in polygon hand types (ie. box),
	the normal color is then used as a border around the hand shape
	Note: AABox & AATriangle hand types accepts FF00FF for transparency

	ClockWorkSecondInnerColor
	Color, default: what ClockWorkSecondColor is set to
	Sets the internal color of the seconds hand in polygon hand types (ie. box),
	the normal color is then used as a border around the hand shape
	Note: AABox & AATriangle hand types accepts FF00FF for transparency

	ClockWorkHourBorder
	Int, default: whatever ClockWorkHandBorder is set to
	Sets the border width that is painted with the normal color

	ClockWorkMinuteBorder
	Int, default: whatever ClockWorkHandBorder is set to
	Sets the border width that is painted with the normal color

	ClockWorkSecondBorder
	Int, default: whatever ClockWorkHandBorder is set to
	Sets the border width that is painted with the normal color

	ClockWorkHourWeight
	Int, default: 3
	Sets the width of the hours hand
	  
	ClockWorkMinuteWeight
	Int, default: 2
	Sets the width of the mintes hand

	ClockWorkSecondWeight
	Int, default: 1
	Sets the width of the seconds hand

	ClockWorkHourLength
	Int, default: 70% of the smallest of the window width/height
	Length of the hours hand

	ClockWorkMinuteLength
	Int, default: 90% of the smallest of the window width/height
	Length of the minutes hand

	ClockWorkSecondLength
	Int, default: 90% of the smallest of the window width/height
	Length of the seconds hand


Mouse commands:
	ClockWorkOnLeftDBL
	String, default: !none
	Command to be executed when the user left double clicks the clock

	ClockWorkOnLeftDown
	String, default: !none
	Command to be executed when the user presses the left button on clock

	ClockWorkOnLeftUp
	String, default: !none
	Command to be executed when the user releases the left button on clock

	ClockWorkOnRightDBL
	String, default: !none
	Command to be executed when the user right double clicks the clock

	ClockWorkOnRightDown
	String, default: !none
	Command to be executed when the user presses the right button on clock

	ClockWorkOnRightUp
	String, default: !none
	Command to be executed when the user releases the right button on clock

	ClockWorkOnMiddleDBL
	String, default: !none
	Command to be executed when the user middle double clicks the clock

	ClockWorkOnMiddleDown
	String, default: !none
	Command to be executed when the user presses the middle button on clock

	ClockWorkOnMiddleUp
	String, default: !none
	Command to be executed when the user releases the middle button on clock


Bangs:
	!ClockWorkSetTime
	Brings up the date/time settings from the control panel

	!ClockWorkHook
	Hooks ClockWork to lsbox

	!ClockWorkSetOnTop on/off
	Sets ClockWorks window to be ontop or not, if no argument specified it's turned on.

	!ClockWorkToggleOnTop
	Toggles the on top status

	!ClockWorkShow
	Shows ClockWorks window if hidden

	!ClockWorkHide
	Hides ClockWorks window

	!ClockWorkToggle
	Toggles visible/hidden status of ClockWork

	!ClockWorkMove x y
	Move ClockWork to the given position

	!ClockWorkSize
	Change the size of ClockWork


Changelog:
	Added [Vendicator, 2002-11-30, release: 0.5]
	  - Added AABox & AATriangle & AALine hand types
	  - Internally calculating points with decimals
	  - AABox & AATriangle accepts FF00FF inner colors for transparency
	  - Even though it had been in code, now the readme states that you can
		set individual hand types with ClockWorkHourHandType, ClockWorkMinuteHandType
		& ClockWorkSecondHandType
	  - Added ClockWorkHandBorder, ClockWorkHourBorder, ClockWorkMinuteBorder, ClockWorkSecondBorder
	    to be able to specify borders when painting inner/outer color
	  - Less logging when not running the debug build

	Fixed [Vendicator, 2002-11-29]
	  - Buffered all trig indexes to reduce cpu, increases mem usage by ~250kb
	  - Filled bg first with FF00FF when using bitmaps to ensure that 
	    transparency actually work from bitmap
	  - Added ClockWorkNoAdaptRegion, which should speed up tri & box draw modes
	    (works by disabling the transparancy check, so if the area is transparent
		underneath the hands, they will not show anymore)
	  - Saved 3 divisions on every paint, reducing cpu usage somewhat
	  - Added a max resolution at 60000
	    (limit for milliseconds when calculating seconds hand position)

	Fixed [Vendicator, 2002-11-13]
	  - Plugged two gdi leaks, one from each recycle and another from each update
	    when using one of the polygon clock hands
		(thanks to NeXTer for pointing me in the right direction)
	  - Fixed ClockWorkDrawOrder from using string reading (which would only get
	    the first char) now using line reading which gets them all
	  - Also fixed a possible uninitialized variable problem regarding to colors

	Fixed [Vendicator, 2002-11-13]
	  - Switched color variables so that InnerColor actually sets the right one =)
	  - Renamed readme file to ClockWork.txt (yay!)

	Added [Vendicator, 2002-11-13]
	  - Changed default behaviour to use borders when calculating center
	  - ClockWorkDoNotAlignUsingBorders to specify center alignment
	    without taking borders into consideration
	  - Added ClockWorkSecondInnerColor, ClockWorkMinuteInnerColor, ClockWorkHourInnerColor
	    to be able to specify an inner color for polygon based clock hand types
	  - Added new clock hand type: triangle

	Added [Vendicator, 2002-11-12]
	  - Start of support for different inner & outer colors for polygon hands

	Added [Vendicator, 2002-11-12]
	  - Fixed color being painted even tho a bitmap was used
	  - Changed default bgcolor to FFFFFF
	  - Changed the clockface structure to use hand object so different hands
	    can be made and selected.
	  - Added ClockWorkHandType to select which hand type to use
	  - Added clock hand type "box", which is completely transparent compatible

	Added [Vendicator, 2002-11-10]
	  - Ability to specify paint order with ClockWorkDrawOrder x x x

	Added [Vendicator, 2002-11-09]
	  - Initial Release


Todo:
	- Fix disappearing after window display change (ie. game)
	- overlay for hour markers..
	- percent hand length for stretched clock look, adapting to angle in clock
	- More different types of hands?
	- Text support? for am,pm/date/time?