diff --git a/ChangeLog.md b/ChangeLog.md index 122c0b3..e69f3cb 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,7 +3,12 @@ (on Branch: **master**, since **2014-10-26**) ----------------------------------------------------------------- - * **Windy 0.15.2** (via Commit [674cf2d](https://github.com/hoppfrosch/AHK_Windy/commit/674cf2da99cc84cb88ee6f5c4c2b3d7e68075be6)) + * **Windy 0.15.3** (via Commit [0bee43c](https://github.com/hoppfrosch/AHK_Windy/commit/0bee43c85e119d5fe0b89a3d8418dd899e387b85)) + * [#37](https://github.com/hoppfrosch/AHK_EDE/issues/37) - Windy: Correct name of property resizeable[] to resizable[] + * *[#41](https://github.com/hoppfrosch/AHK_EDE/issues/41) - INTERNAL: Readme.md: Update with several Badges* + * *[#42](https://github.com/hoppfrosch/AHK_EDE/issues/42) - INTERNAL: Refactor for NaturalDocs 2.0* + * *[#43](https://github.com/hoppfrosch/AHK_EDE/issues/43) - INTERNAL: Recty: Use property feature from AutoHotkey 1.1.16* + * **Windy 0.15.2** (via Commit [5806935](https://github.com/hoppfrosch/AHK_Windy/commit/58069359d270c844e83744eab3d84756aff0c7b9)) * [#26](https://github.com/hoppfrosch/AHK_EDE/issues/26): WindLy: Methods for Operations (Set-operations, Insert, Remove ...) * [#33](https://github.com/hoppfrosch/AHK_EDE/issues/33): WindLy: Remove non existing windows from list * **Windy 0.15.1** (via Commit [a257c27](https://github.com/hoppfrosch/AHK_Windy/commit/a257c2700c4b0eb0b3521f0232bb8324fbb3e988)) diff --git a/Examples/WindLy/Windly_Demo01_Basic.ahk b/Examples/WindLy/Windly_Demo01_Basic.ahk index f80be83..e3003f3 100644 --- a/Examples/WindLy/Windly_Demo01_Basic.ahk +++ b/Examples/WindLy/Windly_Demo01_Basic.ahk @@ -1,5 +1,8 @@ #include %A_ScriptDir%\..\..\lib\Windy\WindLy.ahk #include %A_ScriptDir%\..\..\lib\Windy\Const_WinUser.ahk +#include %A_ScriptDir%\..\..\lib\DbgOut.ahk + +OutputDebug DBGVIEWCLEAR OutputDebug % "******** All Windows **************************************************************************" x := new WindLy() diff --git a/Examples/WindLy/Windly_Demo02_Intersection.ahk b/Examples/WindLy/Windly_Demo02_Intersection.ahk index 7aa1326..8f53c8f 100644 --- a/Examples/WindLy/Windly_Demo02_Intersection.ahk +++ b/Examples/WindLy/Windly_Demo02_Intersection.ahk @@ -1,9 +1,12 @@ #include %A_ScriptDir%\..\..\lib\Windy #include WindLy.ahk #include Windy.ahk +#include ..\DbgOut.ahk + +OutputDebug DBGVIEWCLEAR OutputDebug % "******** Start Situation: All windows of monitor 1 *******************" -x := new WindLy() +x := new WindLy(0) x.byMonitorId(1) for key, data in x.list { OutputDebug % " " key ": " data.hwnd ": " data.title " (" key ")" diff --git a/Examples/Windy/clickthrough.ahk b/Examples/Windy/clickthrough.ahk new file mode 100644 index 0000000..49f683e --- /dev/null +++ b/Examples/Windy/clickthrough.ahk @@ -0,0 +1,17 @@ +#include %A_ScriptDir%\..\..\lib\Windy +#include Windy.ahk + +obj := new Windy(0,0) + +ToolTip, ClickThrough:= 1`nAlwaysOnTop:=1, 100, 150 +obj.alwaysontop := 1 +obj.clickthrough := 1 +sleep 10000 +ToolTip, ClickThrough:= 0`nAlwaysOnTop:=0, 100, 150 +obj.clickthrough := 0 +obj.alwaysontop := 0 +sleep 10000 +ToolTip +obj.kill() + +ExitApp \ No newline at end of file diff --git a/YUnit_MultiMony.ahk b/YUnit_MultiMony.ahk index fa31304..1fa597d 100644 --- a/YUnit_MultiMony.ahk +++ b/YUnit_MultiMony.ahk @@ -12,12 +12,12 @@ ;#Warn LocalSameAsGlobal, Off #SingleInstance force -ReferenceVersion := "1.0.1" +ReferenceVersion := "1.0.2" debug := 1 ;Yunit.use(YunitStdOut, YunitWindow).Test(ExpMultiMonyTestSuite) Yunit.Use(YunitStdOut, YunitWindow).Test(_BaseTestSuite, MultiMonyTestSuite) -ExitApp +Return class ExpMultiMonyTestSuite { Begin() { @@ -26,7 +26,7 @@ class ExpMultiMonyTestSuite { this.monCount := 2 this.mon1Width := 1920 this.mon1Height := 1080 - this.mon2Width := 1600 + this.mon2Width := 1920 this.mon2Height := 1200 this.monvirtWidth := this.mon1Width + this.mon2Width @@ -56,15 +56,26 @@ class MultiMonyTestSuite Global debug this.obj := new MultiMony(debug) this.monCount := 2 - this.mon1Width := 1920 - this.mon1Height := 1080 - this.mon2Width := 1600 - this.mon2Height := 1200 + this.mon2Width := 1920 + this.mon2Height := 1080 + this.mon1Width := 1900 + this.mon1Height := 1200 this.monvirtWidth := this.mon1Width + this.mon2Width this.monvirtHeight := this.mon2Height } + idPrimary() { + Global debug + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + prim := this.obj.idPrimary + Yunit.assert(prim == 2) + tb := this.obj.idTaskbar + Yunit.assert(tb == prim) + Yunit.assert(tb == 2) + OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" + } + coordDisplayToVirtualScreen() { Global debug OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" diff --git a/YUnit_Windy.ahk b/YUnit_Windy.ahk index 0fa4f3c..429df66 100644 --- a/YUnit_Windy.ahk +++ b/YUnit_Windy.ahk @@ -5,16 +5,19 @@ #Include %A_ScriptDir%\Yunit\Window.ahk #Include %A_ScriptDir%\Yunit\StdOut.ahk #include +#include ; #Warn All ;#Warn LocalSameAsGlobal, Off #SingleInstance force -ReferenceVersion := "0.9.0" +ReferenceVersion := "0.10.4" debug := 1 +OutputDebug DBGVIEWCLEAR + ;Yunit.Use(YunitStdOut, YunitWindow).Test(_BaseTestSuite, TempTestSuite) -Yunit.Use(YunitStdOut, YunitWindow).Test(_BaseTestSuite, MiscTestSuite, NotRealWindowTestSuite, HideShowTestSuite, ExistTestSuite, RollupTestSuite, MoveResizeTestSuite, TransparencyTestSuite) +Yunit.Use(YunitStdOut, YunitWindow).Test(_BaseTestSuite, GeometryTestSuite, MiscTestSuite, NotRealWindowTestSuite, HideShowTestSuite, ExistTestSuite, RollupTestSuite, MoveResizeTestSuite, TransparencyTestSuite) Return @@ -25,15 +28,21 @@ class TempTestSuite { this.obj := new Windy(0, debug) } - scale() { - Global debug + border() { + Global debug + + dbgOut(">[" A_ThisFunc "]") + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" + Yunit.assert(this.obj.border == 1) + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" + this.obj.border := 0 + Yunit.assert(this.obj.border == 0) + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" + this.obj.border := 1 + Yunit.assert(this.obj.border == 1) + dbgOut("<[" A_ThisFunc "]") + } - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - this.obj.maximized := true - this.obj.scale(2) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" - } - End() { this.obj.kill() this.remove("obj") @@ -41,6 +50,7 @@ class TempTestSuite { } } +; ################################################################### class _BaseTestSuite { Begin() { Global debug @@ -48,10 +58,10 @@ class _BaseTestSuite { } Version() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") Global ReferenceVersion Yunit.assert(this.obj._version == ReferenceVersion) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } End() { @@ -61,6 +71,28 @@ class _BaseTestSuite { } } +; ################################################################### +class GeometryTestSuite { + Begin() { + Global debug + this.obj := new Windy(0, debug) + } + + captionheight() { + Global debug + + dbgOut(">[" A_ThisFunc "]") + x := this.obj.captionheight + Yunit.assert(x == 22) + dbgOut("<[" A_ThisFunc "]") + } + + End() { + this.obj.kill() + this.remove("obj") + this.obj := + } +} ; ################################################################### class TileTestSuite { @@ -72,10 +104,10 @@ class TileTestSuite { movePercental() { Global debug - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") this.obj.movePercental(25, 25, 50, 50) MsgBox % A_ThisFunc " - To be done ..." - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } End() { @@ -93,36 +125,36 @@ class TransparencyTestSuite { } Transparency() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "**** " A_ThisFunc " 1 ****" + dbgOut(">[" A_ThisFunc "]") + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 1 ****" t := this.obj.transparency Yunit.assert(t == 255) - OutputDebug % "**** " A_ThisFunc " 3 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 ****" this.obj.transparency(10) := 100 t := this.obj.transparency Yunit.assert(t == 100) - OutputDebug % "**** " A_ThisFunc " 3 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 ****" this.obj.transparency(1) := "OFF" t := this.obj.transparency Yunit.assert(t == 255) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } TransparencyNoCaption() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") this.obj.caption := false - OutputDebug % "**** " A_ThisFunc " 1 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 1 ****" t := this.obj.transparency Yunit.assert(t == 255) - OutputDebug % "**** " A_ThisFunc " 3 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 ****" this.obj.transparency(10) := 100 t := this.obj.transparency Yunit.assert(t == 100) - OutputDebug % "**** " A_ThisFunc " 3 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 ****" this.obj.transparency(1) := "OFF" t := this.obj.transparency Yunit.assert(t == 255) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } End() { @@ -142,41 +174,41 @@ class RollupTestSuite { RollupToggle() { Global debug - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "**** " A_ThisFunc " 1 ****" + dbgOut(">[" A_ThisFunc "]") + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 1 ****" val := this.obj.rolledUp Yunit.assert(val == false) - OutputDebug % "**** " A_ThisFunc " 2 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 2 ****" this.obj.rolledUp := false val := this.obj.rolledUp Yunit.assert(val == false) - OutputDebug % "**** " A_ThisFunc " 3 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 ****" this.obj.rolledUp := true val := this.obj.rolledUp Yunit.assert(val == true) - OutputDebug % "**** " A_ThisFunc " 4 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 4 ****" this.obj.rolledUp := false val := this.obj.rolledUp Yunit.assert(val == false) - OutputDebug % "**** " A_ThisFunc " 5 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 5 ****" this.obj.rolledUp := !this.obj.rolledUp ; as the window wasn't rolled up, it should be rolled up now val := this.obj.rolledUp Yunit.assert(val == true) - OutputDebug % "**** " A_ThisFunc " 6 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 6 ****" this.obj.rolledUp := !this.obj.rolledUp ; as the window was rolled up, it shouldn't be rolled up now val := this.obj.rolledUp Yunit.assert(val == false) - OutputDebug % "**** " A_ThisFunc " 7 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 7 ****" this.End() val := this.obj.rolledUp Yunit.assert(val == ) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } End() { @@ -194,7 +226,7 @@ class MoveResizeTestSuite { } Maximize() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") Yunit.assert(this.obj.maximized == false) Yunit.assert(this.obj.minimized == false) this.obj.maximized := true @@ -209,12 +241,12 @@ class MoveResizeTestSuite { this.obj.maximized := !this.obj.maximized Yunit.assert(this.obj.maximized == false) Yunit.assert(this.obj.minimized == false) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } Minimize() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") Yunit.assert(this.obj.maximized == false) Yunit.assert(this.obj.minimized == false) this.obj.minimized := true @@ -229,294 +261,294 @@ class MoveResizeTestSuite { this.obj.minimized := !this.obj.minimized Yunit.assert(this.obj.maximized == false) Yunit.assert(this.obj.minimized == false) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } MoveViaWinMove() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() xnew := oldPos.x+200 ynew := oldPos.y+200 - OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" + OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" WinMove % "ahk_id" this.obj.hwnd, ,xnew, ynew newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == xnew) Yunit.assert(newPos.y == ynew) Yunit.assert(newPos.w == oldPos.w) Yunit.assert(newPos.h == oldPos.h) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } MoveViaMoveMethod() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() xnew := oldPos.x+200 ynew := oldPos.y+200 - OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" + OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" this.obj.move(xnew, ynew, oldPos.w, oldPos.h) newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == xnew) Yunit.assert(newPos.y == ynew) Yunit.assert(newPos.w == oldPos.w) Yunit.assert(newPos.h == oldPos.h) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } MoveViaPosSizeProperty() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() xnew := oldPos.x+200 ynew := oldPos.y+200 - OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" + OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" this.obj.posSize := new Recty(xnew,ynew,oldPos.w,oldPos.h) newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == xnew) Yunit.assert(newPos.y == ynew) Yunit.assert(newPos.w == oldPos.w) Yunit.assert(newPos.h == oldPos.h) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } MoveViaPosProperty() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.pos - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() xnew := oldPos.x+200 ynew := oldPos.y+200 - OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew ")" + OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew ")" this.obj.pos := new Pointy(xnew,ynew) newPos := this.obj.pos - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == xnew) Yunit.assert(newPos.y == ynew) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } MoveResizeViaWinMove() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() xnew := oldPos.x+10 ynew := oldPos.y+20 wnew := oldPos.w+10 hnew := oldPos.h+20 - OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" + OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" WinMove % "ahk_id" this.obj.hwnd, , xnew, ynew, wnew, hnew newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == xnew) Yunit.assert(newPos.y == ynew) Yunit.assert(newPos.w == wnew) Yunit.assert(newPos.h == hnew) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } MoveResizeViaMoveMehod() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() xnew := oldPos.x+10 ynew := oldPos.y+20 wnew := oldPos.w+10 hnew := oldPos.h+20 - OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" + OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" this.obj.move(xnew, ynew, wnew, hnew) newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == xnew) Yunit.assert(newPos.y == ynew) Yunit.assert(newPos.w == wnew) Yunit.assert(newPos.h == hnew) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } MoveResizeViaPosSizeProperty() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() xnew := oldPos.x+10 ynew := oldPos.y+20 wnew := oldPos.w+10 hnew := oldPos.h+20 - OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" + OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" this.obj.posSize := new Recty(xnew, ynew, wnew, hnew) newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == xnew) Yunit.assert(newPos.y == ynew) Yunit.assert(newPos.w == wnew) Yunit.assert(newPos.h == hnew) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } ResizeViaWinMove() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() wnew := oldPos.w+100 hnew := oldPos.h+200 - OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" + OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" WinMove % "ahk_id" this.obj.hwnd, , oldPos.x, oldPos.y, wnew, hnew newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == oldPos.x) Yunit.assert(newPos.y == oldPos.y) Yunit.assert(newPos.w == wnew) Yunit.assert(newPos.h == hnew) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } ResizeViaMoveMethod() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() wnew := oldPos.w+100 hnew := oldPos.h+200 - OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" + OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" this.obj.move(oldPos.x, oldPos.y, wnew, hnew) newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == oldPos.x) Yunit.assert(newPos.y == oldPos.y) Yunit.assert(newPos.w == wnew) Yunit.assert(newPos.h == hnew) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } ResizeViaPosSizeProperty() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() wnew := oldPos.w+100 hnew := oldPos.h+200 - OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" + OutputDebug % "[IMPORTANT]BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" this.obj.posSize := new Recty(oldPos.x, oldPos.y, wnew, hnew) newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == oldPos.x) Yunit.assert(newPos.y == oldPos.y) Yunit.assert(newPos.w == wnew) Yunit.assert(newPos.h == hnew) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } ResizeViaSizeProperty() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldSize:= this.obj.size - OutputDebug % "Initial Size: " oldSize.Dump() + OutputDebug % "[IMPORTANT]Initial Size: " oldSize.Dump() wnew := oldSize.x+100 hnew := oldSize.y+200 - OutputDebug % "BEFORE - Resizing from " oldSize.Dump() " to (" wnew "," hnew ")" + OutputDebug % "[IMPORTANT]BEFORE - Resizing from " oldSize.Dump() " to (" wnew "," hnew ")" this.obj.size := new Pointy(wnew, hnew) newSize := this.obj.size - OutputDebug % "AFTER - Resizing from " oldSize.Dump() " to " newSize.Dump() + OutputDebug % "[IMPORTANT]AFTER - Resizing from " oldSize.Dump() " to " newSize.Dump() Yunit.assert(newSize.x == wnew) Yunit.assert(newSize.y == hnew) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } NoMoveResizeViaWinMove() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() WinMove % "ahk_id" this.obj.hwnd, , oldPos.x, oldPos.y, oldPos.w, oldPos.h newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == oldPos.x) Yunit.assert(newPos.y == oldPos.y) Yunit.assert(newPos.w == oldPos.w) Yunit.assert(newPos.h == oldPos.h) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } NoMoveResizeViaMoveMehod() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() this.obj.move(oldPos.x, oldPos.y, oldPos.w, oldPos.h) newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == oldPos.x) Yunit.assert(newPos.y == oldPos.y) Yunit.assert(newPos.w == oldPos.w) Yunit.assert(newPos.h == oldPos.h) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } NoMoveResizeViaPosSizeProperty() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.posSize - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() this.obj.posSize := new Recty(oldPos.x, oldPos.y, oldPos.w, oldPos.h) newPos := this.obj.posSize - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == oldPos.x) Yunit.assert(newPos.y == oldPos.y) Yunit.assert(newPos.w == oldPos.w) Yunit.assert(newPos.h == oldPos.h) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } NoMoveViaPosProperty() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldPos := this.obj.pos - OutputDebug % "Initial Position: " oldPos.Dump() + OutputDebug % "[IMPORTANT]Initial Position: " oldPos.Dump() this.obj.pos := new Pointy(oldPos.x, oldPos.y) newPos := this.obj.pos - OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + OutputDebug % "[IMPORTANT]AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() Yunit.assert(newPos.x == oldPos.x) Yunit.assert(newPos.y == oldPos.y) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } NoResizeViaSizeProperty() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") oldSize := this.obj.size - OutputDebug % "Initial Size: " oldSize.Dump() + OutputDebug % "[IMPORTANT]Initial Size: " oldSize.Dump() this.obj.size := new Pointy(oldSize.x, oldSize.y) newSize := this.obj.size - OutputDebug % "AFTER - Resizing from " oldSize.Dump() " to " newSize.Dump() + OutputDebug % "[IMPORTANT]AFTER - Resizing from " oldSize.Dump() " to " newSize.Dump() Yunit.assert(newSize.x == oldSize.x) Yunit.assert(newSize.y == oldSize.y) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } scale() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") this.obj.maximized := true this.obj.scale(2) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } End() { @@ -534,7 +566,7 @@ class HideShowTestSuite { } HideShowToggle() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") Yunit.assert(this.obj.hidden == false) this.obj.hidden := false Yunit.assert(this.obj.hidden == false) @@ -548,27 +580,27 @@ class HideShowTestSuite { Yunit.assert(this.obj.hidden == false) this.obj.hidden := !this.obj.hidden ; as the window wasn't hidden, it should be hidden now Yunit.assert(this.obj.hidden == true) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } HiddenFalse() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") Yunit.assert(this.obj.hidden==false) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } HiddenTrue() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") this.obj.hidden := true Yunit.assert(this.obj.hidden == true) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } HiddenDoesNotExist() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") this.obj.kill() Yunit.assert(this.obj.hidden==-1) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } End() { @@ -581,12 +613,12 @@ class HideShowTestSuite { ; ################################################################### class NotRealWindowTestSuite { Test() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") Global debug HDesktop := DllCall("User32.dll\GetDesktopWindow", "UPtr") this.obj := new Windy(HDesktop, debug) Yunit.assert(this.obj==) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } } @@ -601,151 +633,201 @@ class MiscTestSuite { _hWnd := WinExist("ahk_class Notepad") this.obj := new Windy(_hWnd, debug) } - + + activated() { + Global debug + + dbgOut(">[" A_ThisFunc "]") + this.obj.activated := true + sleep 1000 + val := (this.obj.activated == true) + Yunit.assert(val == true) + this.obj.activated := false + Yunit.assert(this.obj.activated == false) + this.obj.activated := true + newObj := new Windy(0, debug) + Yunit.assert(this.obj.activated == false) + dbgOut("<[" A_ThisFunc "]") + } + + border() { + Global debug + + dbgOut(">[" A_ThisFunc "]") + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" + Yunit.assert(this.obj.border == 1) + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" + this.obj.border := 0 + Yunit.assert(this.obj.border == 0) + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" + this.obj.border := 1 + Yunit.assert(this.obj.border == 1) + dbgOut("<[" A_ThisFunc "]") + } + + Caption() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "....[" A_ThisFunc "] > 1" + dbgOut(">[" A_ThisFunc "]") + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" Yunit.assert(this.obj.caption == 1) - OutputDebug % "....[" A_ThisFunc "] > 0" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" this.obj.caption := 0 Yunit.assert(this.obj.caption == 0) - OutputDebug % "....[" A_ThisFunc "] > 1" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" this.obj.caption := 1 Yunit.assert(this.obj.caption == 1) - OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } Center() { Global debug - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") hwnd := this.obj.hwnd WinGetPos x, y, w, h, ahk_id %hwnd% centerx := round(x+(w)/2) centery := round(y+(h)/2) - OutputDebug % "**** " A_ThisFunc " 1 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 1 ****" center := this.obj.centercoords Yunit.assert(center.x == centerx) Yunit.assert(center.y == centery) - OutputDebug % "**** " A_ThisFunc " 2 ****" + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 2 ****" newCenter := new Pointy(205,205,debug) this.obj.centercoords := newCenter center := this.obj.centercoords Yunit.assert(center.x == 205) Yunit.assert(center.y == 205) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } Classname() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") Yunit.assert(this.obj.classname =="Notepad") - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } - hscrollable() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "....[" A_ThisFunc "] > Initial" + hscrollable() { + dbgOut(">[" A_ThisFunc "]") + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > Initial" Yunit.assert(this.obj.hscrollable == 0) - OutputDebug % "....[" A_ThisFunc "] > 1" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" this.obj.hscrollable := 1 Yunit.assert(this.obj.hscrollable == 1) - OutputDebug % "....[" A_ThisFunc "] > 0" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" this.obj.hscrollable := 0 Yunit.assert(this.obj.hscrollable == 0) - OutputDebug % "....[" A_ThisFunc "] > 1" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" this.obj.hscrollable := !this.obj.hscrollable Yunit.assert(this.obj.hscrollable == 1) - OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } maximizebox() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "....[" A_ThisFunc "] > Initial" + dbgOut(">[" A_ThisFunc "]") + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > Initial" Yunit.assert(this.obj.maximizebox == 1) - OutputDebug % "....[" A_ThisFunc "] > 0" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" this.obj.maximizebox := 0 Yunit.assert(this.obj.maximizebox == 0) - OutputDebug % "....[" A_ThisFunc "] > 1" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" this.obj.maximizebox := !this.obj.maximizebox Yunit.assert(this.obj.caption == 1) - OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } minimizebox() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "....[" A_ThisFunc "] > Initial" + dbgOut(">[" A_ThisFunc "]") + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > Initial" Yunit.assert(this.obj.minimizebox == 1) - OutputDebug % "....[" A_ThisFunc "] > 0" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" this.obj.minimizebox := 0 Yunit.assert(this.obj.minimizebox == 0) - OutputDebug % "....[" A_ThisFunc "] > 1" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" this.obj.minimizebox := !this.obj.minimizebox Yunit.assert(this.obj.caption == 1) - OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") + } + + nextprevious() { + Global debug + + dbgOut(">[" A_ThisFunc "]") + hwndNext := this.obj.next + nextObj := new Windy(hwndNext, 0) + OutputDebug % "[IMPORTANT] NEXT OF [" this.obj.hwnd "-<" this.obj.title ">]: [" hwndNext "-<" nextObj.title ">]" + hwndPrev := this.obj.previous + prevObj := new Windy(hwndPrev, 0) + OutputDebug % "[IMPORTANT] PREVIOUS OF [" this.obj.hwnd "-<" this.obj.title ">]: [" hwndPrev "-" prevObj.title "]" + + Yunit.assert(this.obj.hwnd == prevObj.next) + Yunit.assert(this.obj.hwnd == nextObj.previous) + + dbgOut("<[" A_ThisFunc "]") + } Title() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") Yunit.assert(this.obj.title =="Unbenannt - Editor") this.obj.title := "Halllloo" Yunit.assert(this.obj.title =="Halllloo") - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } Parent() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") parent := this.parent Yunit.assert(parent == ) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } Processname() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") val := this.obj.processname Yunit.assert( val == "notepad.exe") - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } ProcessID() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") val := this.obj.processID Yunit.assert( val > 0) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } Resizable() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "...[" A_ThisFunc "]> 1" + dbgOut(">[" A_ThisFunc "]") + OutputDebug % "[IMPORTANT]...[" A_ThisFunc "]> 1" Yunit.assert( this.obj.resizable == 1) - OutputDebug % "...[" A_ThisFunc "]> 0" + OutputDebug % "[IMPORTANT]...[" A_ThisFunc "]> 0" this.obj.resizable := 0 Yunit.assert( this.obj.resizable == 0) - OutputDebug % "...[" A_ThisFunc "]> toggle" + OutputDebug % "[IMPORTANT]...[" A_ThisFunc "]> toggle" this.obj.resizable := !this.obj.resizable Yunit.assert( this.obj.resizable == 1) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") sleep, 500 } vscrollable() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "....[" A_ThisFunc "] > Initial" + dbgOut(">[" A_ThisFunc "]") + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > Initial" Yunit.assert(this.obj.vscrollable == 0) - OutputDebug % "....[" A_ThisFunc "] > 1" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" this.obj.vscrollable := 1 Yunit.assert(this.obj.vscrollable == 1) - OutputDebug % "....[" A_ThisFunc "] > 0" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 0" this.obj.vscrollable := 0 Yunit.assert(this.obj.vscrollable == 0) - OutputDebug % "....[" A_ThisFunc "] > 1" + OutputDebug % "[IMPORTANT]....[" A_ThisFunc "] > 1" this.obj.vscrollable := !this.obj.vscrollable Yunit.assert(this.obj.vscrollable == 1) - OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } AlwaysOnTop() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") Yunit.assert(this.obj.alwaysontop == false) this.obj.alwaysOnTop := true Yunit.assert(this.obj.alwaysontop == true) @@ -757,50 +839,50 @@ class MiscTestSuite { Yunit.assert(this.obj.alwaysontop == true) this.obj.alwaysOnTop := !this.obj.alwaysOnTop Yunit.assert(this.obj.alwaysontop == false) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } MonitorID() { Global debug - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "**** " A_ThisFunc " 1 ****" + dbgOut(">[" A_ThisFunc "]") + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 1 ****" this.obj.Move(2,2,300,300) monID := this.obj.monitorID - Yunit.assert(monId == 1) - OutputDebug % "**** " A_ThisFunc " 2 - via Move ****" + Yunit.assert(monId == 2) + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 2 - via Move ****" obj := new Mony(2, debug) rect2 := obj.boundary this.obj.Move(rect2.x+10,rect2.y+10,300,300) monID := this.obj.monitorID Yunit.assert(monId == 2) - OutputDebug % "**** " A_ThisFunc " 3 - via MonitorID ****" - this.obj.monitorID := 1 + OutputDebug % "[IMPORTANT]**** " A_ThisFunc " 3 - via MonitorID ****" + this.obj.monitorID := 2 monID := this.obj.monitorID - Yunit.assert(monId == 1) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + Yunit.assert(monId == 2) + dbgOut("<[" A_ThisFunc "]") } Hangs() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") val := this.obj.hangs Yunit.assert(val == false) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } Getter() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") hwnd := this.obj.hwnd WinGetPos x, y, w, h, ahk_id %hwnd% Yunit.assert(1 == ((this.obj.posSize.x == x) && (this.obj.posSize.y == y) && (this.obj.posSize.w == w) && (this.obj.posSize.h == h))) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } owner() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") own:= this.obj.owner Yunit.assert(own == 0) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } End() { @@ -824,9 +906,9 @@ class ExistTestSuite { } ExistExistingWindow() { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + dbgOut(">[" A_ThisFunc "]") Yunit.assert(this.obj.exist ==true) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + dbgOut("<[" A_ThisFunc "]") } End() { @@ -835,98 +917,3 @@ class ExistTestSuite { this.obj := } } - - -/* -; ################################################################### -class MoveResizeTestSuite -{ - Begin() - { - Global debug - this.obj := new Windy(0, debug) - sleep 1000 - } - - MoveViaWinMove() - { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "Initial Position: " this.obj._lastPos.Dump() " - Restore: " this.obj._restorePos.Dump() - hwnd := this.obj.hwnd - xold := this.obj._lastPos.x - yold := this.obj._lastPos.y - xnew := xold+10 - ynew := yold+10 - - OutputDebug % "BEFORE - Moving from x,y(" xold "," yold ") to (" xnew "," ynew ")" - WinMove % "ahk_id" this.obj.hwnd, ,xnew, ynew - OutputDebug % "AFTER - Moving from x,y(" xold "," yold ") to (" xnew "," ynew ")" - Yunit.assert(this.obj.isMoved()==1) - Yunit.assert(this.obj.isResized()==0) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" - } - - MoveResizeViaWinMove() - { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "Initial Position: " this.obj._lastPos.Dump() " - Restore: " this.obj._restorePos.Dump() - hwnd := this.obj.hwnd - xold := this.obj._lastPos.x - yold := this.obj._lastPos.y - wold := this.obj._lastPos.w - hold := this.obj._lastPos.h - xnew := xold+10 - ynew := yold+20 - wnew := wold+10 - hnew := hold+20 - OutputDebug % "BEFORE- Moving/Resizing from x,y,w,h(" xold "," yold "," wold "," hold ") to (" xnew "," ynew "," wnew "," hnew ")" - WinMove % "ahk_id" this.obj.hwnd, , xnew, ynew, wnew, hnew - OutputDebug % "AFTER - Moving/Resizing from x,y,w,h(" xold "," yold "," wold "," hold ") to (" xnew "," ynew "," wnew "," hnew ")" - Yunit.assert(this.obj.isMoved()==1) - Yunit.assert(this.obj.isResized()==1) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" - } - - ResizeViaWinMove() - { - OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" - OutputDebug % "Initial Position: " this.obj._lastPos.Dump() " - Restore: " this.obj._restorePos.Dump() - hwnd := this.obj.hwnd - hwnd := this.obj.hwnd - xold := this.obj._lastPos.x - yold := this.obj._lastPos.y - wold := this.obj._lastPos.w - hold := this.obj._lastPos.h - wnew := wold+10 - hnew := hold+20 - OutputDebug % "BEFORE- Resizing from w,h(" wold "," hold ") to (" wnew "," hnew ")" - WinMove % "ahk_id" this.obj.hwnd, , xold, yold, wnew, hnew - OutputDebug % "AFTER- Resizing from w,h(" wold "," hold ") to (" wnew "," hnew ")" - Yunit.assert(this.obj.isMoved()==0) - Yunit.assert(this.obj.isResized()==1) - OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" - } - - NoMoveResize() { - Global debug - success := 1 - l := new Windy(0, debug) - WinMove % "ahk_id" l._hWnd, , l._lastPos.x, l._lastPos.y, l._lastPos.w, l._lastPos.h - isMoved := l.isMoved() - isResized := l.isResized() - success := success && !(isMoved) && !(isResized) - l.kill() - if !success - throw " - } - - End() - { - sleep,2000 - this.obj.kill() - this.remove("obj") - this.obj := - } -} - -*/ \ No newline at end of file diff --git a/YUnit_Windy_Fade.ahk b/YUnit_Windy_Fade.ahk new file mode 100644 index 0000000..f40c97d --- /dev/null +++ b/YUnit_Windy_Fade.ahk @@ -0,0 +1,949 @@ +;#NoEnv +#Warn + +#Include %A_ScriptDir%\Yunit\Yunit.ahk +#Include %A_ScriptDir%\Yunit\Window.ahk +#Include %A_ScriptDir%\Yunit\StdOut.ahk +#include +#include %A_ScriptDir%\lib\\DbgOut.ahk + +; #Warn All +;#Warn LocalSameAsGlobal, Off +#SingleInstance force + +ReferenceVersion := "0.10.2" +debug := 1 + +OutputDebug DBGVIEWCLEAR + +Yunit.Use(YunitStdOut, YunitWindow).Test(_BaseTestSuite, TransparencyTestSuite) +;Yunit.Use(YunitStdOut, YunitWindow).Test(_BaseTestSuite, MiscTestSuite, NotRealWindowTestSuite, HideShowTestSuite, ExistTestSuite, RollupTestSuite, MoveResizeTestSuite, TransparencyTestSuite) +Return + + +; ################################################################### +class TempTestSuite { + Begin() { + Global debug + this.obj := new Windy(0, debug) + } + + activated() { + Global debug + + dbgOut(">[" A_ThisFunc "]") + this.obj.activated := true + sleep 1000 + val := (this.obj.activated == true) + Yunit.assert(val == true) + this.obj.activated := false + Yunit.assert(this.obj.activated == false) + this.obj.activated := true + newObj := new Windy(0, debug) + Yunit.assert(this.obj.activated == false) + dbgOut("<[" A_ThisFunc "]") + } + + End() { + this.obj.kill() + this.remove("obj") + this.obj := + } +} + +class _BaseTestSuite { + Begin() { + Global debug + this.obj := new Windy(0, debug) + } + + Version() { + dbgOut(">[" A_ThisFunc "]") + Global ReferenceVersion + Yunit.assert(this.obj._version == ReferenceVersion) + dbgOut("<[" A_ThisFunc "]") + } + + End() { + this.obj.kill() + this.remove("obj") + this.obj := + } +} + + +; ################################################################### +class TileTestSuite { + Begin() { + Global debug + this.obj := new Windy(0, debug) + } + + movePercental() { + Global debug + + dbgOut(">[" A_ThisFunc "]") + this.obj.movePercental(25, 25, 50, 50) + MsgBox % A_ThisFunc " - To be done ..." + dbgOut("<[" A_ThisFunc "]") + } + + End() { + this.obj.kill() + this.remove("obj") + this.obj := + } +} + +; ################################################################### +class TransparencyTestSuite { + Begin() { + Global debug + this.obj := new Windy(0, debug) + } + + Transparency() { + dbgOut(">[" A_ThisFunc "]") +; OutputDebug % "**** " A_ThisFunc " 1 ****" +; t := this.obj.transparency +; Yunit.assert(t == 255) +; OutputDebug % "**** " A_ThisFunc " 3 ****" +; this.obj.transparency(1,5) := 100 +; t := this.obj.transparency +; Yunit.assert(t == 100) +; OutputDebug % "**** " A_ThisFunc " 3 ****" +; this.obj.transparency(1,5) := "OFF" +; t := this.obj.transparency +; Yunit.assert(t == 255) + step := 20 + delay := 3 + this.obj.transparency(step,delay) := 100 + this.obj.transparency(step,delay) := "OFF" + this.obj.transparency(step,delay) := 100 + this.obj.transparency(step,delay) := "OFF" + + dbgOut("<[" A_ThisFunc "]") + } + + + End() { + this.obj.kill() + this.remove("obj") + this.obj := + } +} + +; ################################################################### +class RollupTestSuite { + Begin() { + Global debug + this.obj := new Windy(0, debug) + } + + RollupToggle() { + Global debug + + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + OutputDebug % "**** " A_ThisFunc " 1 ****" + val := this.obj.rolledUp + Yunit.assert(val == false) + + OutputDebug % "**** " A_ThisFunc " 2 ****" + this.obj.rolledUp := false + val := this.obj.rolledUp + Yunit.assert(val == false) + + OutputDebug % "**** " A_ThisFunc " 3 ****" + this.obj.rolledUp := true + val := this.obj.rolledUp + Yunit.assert(val == true) + + OutputDebug % "**** " A_ThisFunc " 4 ****" + this.obj.rolledUp := false + val := this.obj.rolledUp + Yunit.assert(val == false) + + OutputDebug % "**** " A_ThisFunc " 5 ****" + this.obj.rolledUp := !this.obj.rolledUp ; as the window wasn't rolled up, it should be rolled up now + val := this.obj.rolledUp + Yunit.assert(val == true) + + OutputDebug % "**** " A_ThisFunc " 6 ****" + this.obj.rolledUp := !this.obj.rolledUp ; as the window was rolled up, it shouldn't be rolled up now + val := this.obj.rolledUp + Yunit.assert(val == false) + + OutputDebug % "**** " A_ThisFunc " 7 ****" + this.End() + val := this.obj.rolledUp + Yunit.assert(val == ) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + End() { + this.obj.kill() + this.remove("obj") + this.obj := + } +} + +; ################################################################### +class MoveResizeTestSuite { + Begin() { + Global debug + this.obj := new Windy(0, debug) + } + + Maximize() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + Yunit.assert(this.obj.maximized == false) + Yunit.assert(this.obj.minimized == false) + this.obj.maximized := true + Yunit.assert(this.obj.maximized == true) + Yunit.assert(this.obj.minimized == false) + this.obj.maximized := false + Yunit.assert(this.obj.maximized == false) + Yunit.assert(this.obj.minimized == false) + this.obj.maximized := !this.obj.maximized + Yunit.assert(this.obj.maximized == true) + Yunit.assert(this.obj.minimized == false) + this.obj.maximized := !this.obj.maximized + Yunit.assert(this.obj.maximized == false) + Yunit.assert(this.obj.minimized == false) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + + } + + Minimize() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + Yunit.assert(this.obj.maximized == false) + Yunit.assert(this.obj.minimized == false) + this.obj.minimized := true + Yunit.assert(this.obj.maximized == false) + Yunit.assert(this.obj.minimized == true) + this.obj.minimized := false + Yunit.assert(this.obj.maximized == false) + Yunit.assert(this.obj.minimized == false) + this.obj.minimized := !this.obj.minimized + Yunit.assert(this.obj.maximized == false) + Yunit.assert(this.obj.minimized == true) + this.obj.minimized := !this.obj.minimized + Yunit.assert(this.obj.maximized == false) + Yunit.assert(this.obj.minimized == false) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + + } + + MoveViaWinMove() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + + xnew := oldPos.x+200 + ynew := oldPos.y+200 + + OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" + WinMove % "ahk_id" this.obj.hwnd, ,xnew, ynew + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == xnew) + Yunit.assert(newPos.y == ynew) + Yunit.assert(newPos.w == oldPos.w) + Yunit.assert(newPos.h == oldPos.h) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + MoveViaMoveMethod() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + + xnew := oldPos.x+200 + ynew := oldPos.y+200 + + OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" + this.obj.move(xnew, ynew, oldPos.w, oldPos.h) + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == xnew) + Yunit.assert(newPos.y == ynew) + Yunit.assert(newPos.w == oldPos.w) + Yunit.assert(newPos.h == oldPos.h) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + MoveViaPosSizeProperty() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + + xnew := oldPos.x+200 + ynew := oldPos.y+200 + + OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," oldPos.w "," oldPos.h ")" + this.obj.posSize := new Recty(xnew,ynew,oldPos.w,oldPos.h) + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == xnew) + Yunit.assert(newPos.y == ynew) + Yunit.assert(newPos.w == oldPos.w) + Yunit.assert(newPos.h == oldPos.h) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + MoveViaPosProperty() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.pos + OutputDebug % "Initial Position: " oldPos.Dump() + + xnew := oldPos.x+200 + ynew := oldPos.y+200 + + OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew ")" + this.obj.pos := new Pointy(xnew,ynew) + newPos := this.obj.pos + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == xnew) + Yunit.assert(newPos.y == ynew) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + MoveResizeViaWinMove() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + + xnew := oldPos.x+10 + ynew := oldPos.y+20 + wnew := oldPos.w+10 + hnew := oldPos.h+20 + OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" + WinMove % "ahk_id" this.obj.hwnd, , xnew, ynew, wnew, hnew + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == xnew) + Yunit.assert(newPos.y == ynew) + Yunit.assert(newPos.w == wnew) + Yunit.assert(newPos.h == hnew) + + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + MoveResizeViaMoveMehod() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + + xnew := oldPos.x+10 + ynew := oldPos.y+20 + wnew := oldPos.w+10 + hnew := oldPos.h+20 + OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" + this.obj.move(xnew, ynew, wnew, hnew) + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == xnew) + Yunit.assert(newPos.y == ynew) + Yunit.assert(newPos.w == wnew) + Yunit.assert(newPos.h == hnew) + + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + MoveResizeViaPosSizeProperty() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + + xnew := oldPos.x+10 + ynew := oldPos.y+20 + wnew := oldPos.w+10 + hnew := oldPos.h+20 + OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" xnew "," ynew "," wnew "," hnew ")" + this.obj.posSize := new Recty(xnew, ynew, wnew, hnew) + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == xnew) + Yunit.assert(newPos.y == ynew) + Yunit.assert(newPos.w == wnew) + Yunit.assert(newPos.h == hnew) + + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + ResizeViaWinMove() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + + wnew := oldPos.w+100 + hnew := oldPos.h+200 + + OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" + WinMove % "ahk_id" this.obj.hwnd, , oldPos.x, oldPos.y, wnew, hnew + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == oldPos.x) + Yunit.assert(newPos.y == oldPos.y) + Yunit.assert(newPos.w == wnew) + Yunit.assert(newPos.h == hnew) + + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + ResizeViaMoveMethod() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + + wnew := oldPos.w+100 + hnew := oldPos.h+200 + + OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" + this.obj.move(oldPos.x, oldPos.y, wnew, hnew) + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == oldPos.x) + Yunit.assert(newPos.y == oldPos.y) + Yunit.assert(newPos.w == wnew) + Yunit.assert(newPos.h == hnew) + + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + ResizeViaPosSizeProperty() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + + wnew := oldPos.w+100 + hnew := oldPos.h+200 + + OutputDebug % "BEFORE - Moving from " oldPos.Dump() " to (" oldPos.x "," oldPos.y "," wnew "," hnew ")" + this.obj.posSize := new Recty(oldPos.x, oldPos.y, wnew, hnew) + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == oldPos.x) + Yunit.assert(newPos.y == oldPos.y) + Yunit.assert(newPos.w == wnew) + Yunit.assert(newPos.h == hnew) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + ResizeViaSizeProperty() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldSize:= this.obj.size + OutputDebug % "Initial Size: " oldSize.Dump() + + wnew := oldSize.x+100 + hnew := oldSize.y+200 + + OutputDebug % "BEFORE - Resizing from " oldSize.Dump() " to (" wnew "," hnew ")" + this.obj.size := new Pointy(wnew, hnew) + newSize := this.obj.size + OutputDebug % "AFTER - Resizing from " oldSize.Dump() " to " newSize.Dump() + Yunit.assert(newSize.x == wnew) + Yunit.assert(newSize.y == hnew) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + NoMoveResizeViaWinMove() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + WinMove % "ahk_id" this.obj.hwnd, , oldPos.x, oldPos.y, oldPos.w, oldPos.h + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == oldPos.x) + Yunit.assert(newPos.y == oldPos.y) + Yunit.assert(newPos.w == oldPos.w) + Yunit.assert(newPos.h == oldPos.h) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + NoMoveResizeViaMoveMehod() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + this.obj.move(oldPos.x, oldPos.y, oldPos.w, oldPos.h) + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == oldPos.x) + Yunit.assert(newPos.y == oldPos.y) + Yunit.assert(newPos.w == oldPos.w) + Yunit.assert(newPos.h == oldPos.h) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + NoMoveResizeViaPosSizeProperty() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.posSize + OutputDebug % "Initial Position: " oldPos.Dump() + this.obj.posSize := new Recty(oldPos.x, oldPos.y, oldPos.w, oldPos.h) + newPos := this.obj.posSize + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == oldPos.x) + Yunit.assert(newPos.y == oldPos.y) + Yunit.assert(newPos.w == oldPos.w) + Yunit.assert(newPos.h == oldPos.h) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + NoMoveViaPosProperty() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldPos := this.obj.pos + OutputDebug % "Initial Position: " oldPos.Dump() + this.obj.pos := new Pointy(oldPos.x, oldPos.y) + newPos := this.obj.pos + OutputDebug % "AFTER - Moving from " oldPos.Dump() " to " newPos.Dump() + Yunit.assert(newPos.x == oldPos.x) + Yunit.assert(newPos.y == oldPos.y) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + NoResizeViaSizeProperty() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + oldSize := this.obj.size + OutputDebug % "Initial Size: " oldSize.Dump() + this.obj.size := new Pointy(oldSize.x, oldSize.y) + newSize := this.obj.size + OutputDebug % "AFTER - Resizing from " oldSize.Dump() " to " newSize.Dump() + Yunit.assert(newSize.x == oldSize.x) + Yunit.assert(newSize.y == oldSize.y) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + scale() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + this.obj.maximized := true + this.obj.scale(2) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + End() { + this.obj.kill() + this.remove("obj") + this.obj := + } +} + +; ################################################################### +class HideShowTestSuite { + Begin() { + Global debug + this.obj := new Windy(0, debug) + } + + HideShowToggle() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + Yunit.assert(this.obj.hidden == false) + this.obj.hidden := false + Yunit.assert(this.obj.hidden == false) + this.obj.hidden := true + Yunit.assert(this.obj.hidden == true) + this.obj.hidden := false + Yunit.assert(this.obj.hidden == false) + this.obj.hidden := true + Yunit.assert(this.obj.hidden == true) + this.obj.hidden := !this.obj.hidden ; as the window was hidden, it shouldn't be hidden now + Yunit.assert(this.obj.hidden == false) + this.obj.hidden := !this.obj.hidden ; as the window wasn't hidden, it should be hidden now + Yunit.assert(this.obj.hidden == true) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + HiddenFalse() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + Yunit.assert(this.obj.hidden==false) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + HiddenTrue() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + this.obj.hidden := true + Yunit.assert(this.obj.hidden == true) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + HiddenDoesNotExist() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + this.obj.kill() + Yunit.assert(this.obj.hidden==-1) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + End() { + this.obj.kill() + this.remove("obj") + this.obj := + } +} + +; ################################################################### +class NotRealWindowTestSuite { + Test() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + Global debug + HDesktop := DllCall("User32.dll\GetDesktopWindow", "UPtr") + this.obj := new Windy(HDesktop, debug) + Yunit.assert(this.obj==) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } +} + +; ################################################################### +class MiscTestSuite { + Begin() { + Global debug + ; Create a Testwindow ... + Run, notepad.exe + WinWait, ahk_class Notepad, , 2 + WinMove, ahk_class Notepad,, 10, 10, 300, 300 + _hWnd := WinExist("ahk_class Notepad") + this.obj := new Windy(_hWnd, debug) + } + + activated() { + Global debug + + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + this.obj.activated := true + sleep 1000 + val := (this.obj.activated == true) + Yunit.assert(val == true) + this.obj.activated := false + Yunit.assert(this.obj.activated == false) + this.obj.activated := true + newObj := new Windy(0, debug) + Yunit.assert(this.obj.activated == false) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + Caption() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + OutputDebug % "....[" A_ThisFunc "] > 1" + Yunit.assert(this.obj.caption == 1) + OutputDebug % "....[" A_ThisFunc "] > 0" + this.obj.caption := 0 + Yunit.assert(this.obj.caption == 0) + OutputDebug % "....[" A_ThisFunc "] > 1" + this.obj.caption := 1 + Yunit.assert(this.obj.caption == 1) + OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" + } + + Center() { + Global debug + + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + hwnd := this.obj.hwnd + WinGetPos x, y, w, h, ahk_id %hwnd% + centerx := round(x+(w)/2) + centery := round(y+(h)/2) + OutputDebug % "**** " A_ThisFunc " 1 ****" + center := this.obj.centercoords + Yunit.assert(center.x == centerx) + Yunit.assert(center.y == centery) + + OutputDebug % "**** " A_ThisFunc " 2 ****" + newCenter := new Pointy(205,205,debug) + this.obj.centercoords := newCenter + center := this.obj.centercoords + Yunit.assert(center.x == 205) + Yunit.assert(center.y == 205) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + Classname() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + Yunit.assert(this.obj.classname =="Notepad") + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + hscrollable() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + OutputDebug % "....[" A_ThisFunc "] > Initial" + Yunit.assert(this.obj.hscrollable == 0) + OutputDebug % "....[" A_ThisFunc "] > 1" + this.obj.hscrollable := 1 + Yunit.assert(this.obj.hscrollable == 1) + OutputDebug % "....[" A_ThisFunc "] > 0" + this.obj.hscrollable := 0 + Yunit.assert(this.obj.hscrollable == 0) + OutputDebug % "....[" A_ThisFunc "] > 1" + this.obj.hscrollable := !this.obj.hscrollable + Yunit.assert(this.obj.hscrollable == 1) + OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" + } + + maximizebox() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + OutputDebug % "....[" A_ThisFunc "] > Initial" + Yunit.assert(this.obj.maximizebox == 1) + OutputDebug % "....[" A_ThisFunc "] > 0" + this.obj.maximizebox := 0 + Yunit.assert(this.obj.maximizebox == 0) + OutputDebug % "....[" A_ThisFunc "] > 1" + this.obj.maximizebox := !this.obj.maximizebox + Yunit.assert(this.obj.caption == 1) + OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" + } + + minimizebox() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + OutputDebug % "....[" A_ThisFunc "] > Initial" + Yunit.assert(this.obj.minimizebox == 1) + OutputDebug % "....[" A_ThisFunc "] > 0" + this.obj.minimizebox := 0 + Yunit.assert(this.obj.minimizebox == 0) + OutputDebug % "....[" A_ThisFunc "] > 1" + this.obj.minimizebox := !this.obj.minimizebox + Yunit.assert(this.obj.caption == 1) + OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" + } + + Title() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + Yunit.assert(this.obj.title =="Unbenannt - Editor") + this.obj.title := "Halllloo" + Yunit.assert(this.obj.title =="Halllloo") + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + Parent() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + parent := this.parent + Yunit.assert(parent == ) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + Processname() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + val := this.obj.processname + Yunit.assert( val == "notepad.exe") + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + ProcessID() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + val := this.obj.processID + Yunit.assert( val > 0) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + Resizable() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + OutputDebug % "...[" A_ThisFunc "]> 1" + Yunit.assert( this.obj.resizable == 1) + OutputDebug % "...[" A_ThisFunc "]> 0" + this.obj.resizable := 0 + Yunit.assert( this.obj.resizable == 0) + OutputDebug % "...[" A_ThisFunc "]> toggle" + this.obj.resizable := !this.obj.resizable + Yunit.assert( this.obj.resizable == 1) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + sleep, 500 + } + + vscrollable() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + OutputDebug % "....[" A_ThisFunc "] > Initial" + Yunit.assert(this.obj.vscrollable == 0) + OutputDebug % "....[" A_ThisFunc "] > 1" + this.obj.vscrollable := 1 + Yunit.assert(this.obj.vscrollable == 1) + OutputDebug % "....[" A_ThisFunc "] > 0" + this.obj.vscrollable := 0 + Yunit.assert(this.obj.vscrollable == 0) + OutputDebug % "....[" A_ThisFunc "] > 1" + this.obj.vscrollable := !this.obj.vscrollable + Yunit.assert(this.obj.vscrollable == 1) + OutputDebug % "<<<<<[" A_ThisFunc "]<<<<<" + } + + AlwaysOnTop() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + Yunit.assert(this.obj.alwaysontop == false) + this.obj.alwaysOnTop := true + Yunit.assert(this.obj.alwaysontop == true) + this.obj.alwaysOnTop := false + Yunit.assert(this.obj.alwaysontop == false) + this.obj.alwaysOnTop := false + Yunit.assert(this.obj.alwaysontop == false) + this.obj.alwaysOnTop := !this.obj.alwaysOnTop + Yunit.assert(this.obj.alwaysontop == true) + this.obj.alwaysOnTop := !this.obj.alwaysOnTop + Yunit.assert(this.obj.alwaysontop == false) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + MonitorID() { + Global debug + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + OutputDebug % "**** " A_ThisFunc " 1 ****" + this.obj.Move(2,2,300,300) + monID := this.obj.monitorID + Yunit.assert(monId == 1) + OutputDebug % "**** " A_ThisFunc " 2 - via Move ****" + obj := new Mony(2, debug) + rect2 := obj.boundary + this.obj.Move(rect2.x+10,rect2.y+10,300,300) + monID := this.obj.monitorID + Yunit.assert(monId == 2) + OutputDebug % "**** " A_ThisFunc " 3 - via MonitorID ****" + this.obj.monitorID := 1 + monID := this.obj.monitorID + Yunit.assert(monId == 1) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + Hangs() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + val := this.obj.hangs + Yunit.assert(val == false) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + + } + + Getter() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + hwnd := this.obj.hwnd + WinGetPos x, y, w, h, ahk_id %hwnd% + Yunit.assert(1 == ((this.obj.posSize.x == x) && (this.obj.posSize.y == y) && (this.obj.posSize.w == w) && (this.obj.posSize.h == h))) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + owner() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + own:= this.obj.owner + Yunit.assert(own == 0) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + End() { + this.obj.kill() + this.remove("obj") + this.obj := + } + +} + +; ################################################################### +class ExistTestSuite { + Begin() { + Global debug + this.obj := new Windy(0, debug) + } + + ExistNonExistingWindow() { + this.obj.kill() + Yunit.assert(this.obj.exist == false) + } + + ExistExistingWindow() { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + Yunit.assert(this.obj.exist ==true) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + End() { + this.obj.kill() + this.remove("obj") + this.obj := + } +} + + +/* +; ################################################################### +class MoveResizeTestSuite +{ + Begin() + { + Global debug + this.obj := new Windy(0, debug) + sleep 1000 + } + + MoveViaWinMove() + { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + OutputDebug % "Initial Position: " this.obj._lastPos.Dump() " - Restore: " this.obj._restorePos.Dump() + hwnd := this.obj.hwnd + xold := this.obj._lastPos.x + yold := this.obj._lastPos.y + xnew := xold+10 + ynew := yold+10 + + OutputDebug % "BEFORE - Moving from x,y(" xold "," yold ") to (" xnew "," ynew ")" + WinMove % "ahk_id" this.obj.hwnd, ,xnew, ynew + OutputDebug % "AFTER - Moving from x,y(" xold "," yold ") to (" xnew "," ynew ")" + Yunit.assert(this.obj.isMoved()==1) + Yunit.assert(this.obj.isResized()==0) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + MoveResizeViaWinMove() + { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + OutputDebug % "Initial Position: " this.obj._lastPos.Dump() " - Restore: " this.obj._restorePos.Dump() + hwnd := this.obj.hwnd + xold := this.obj._lastPos.x + yold := this.obj._lastPos.y + wold := this.obj._lastPos.w + hold := this.obj._lastPos.h + xnew := xold+10 + ynew := yold+20 + wnew := wold+10 + hnew := hold+20 + OutputDebug % "BEFORE- Moving/Resizing from x,y,w,h(" xold "," yold "," wold "," hold ") to (" xnew "," ynew "," wnew "," hnew ")" + WinMove % "ahk_id" this.obj.hwnd, , xnew, ynew, wnew, hnew + OutputDebug % "AFTER - Moving/Resizing from x,y,w,h(" xold "," yold "," wold "," hold ") to (" xnew "," ynew "," wnew "," hnew ")" + Yunit.assert(this.obj.isMoved()==1) + Yunit.assert(this.obj.isResized()==1) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + ResizeViaWinMove() + { + OutputDebug % ">>>>>[" A_ThisFunc "]>>>>>" + OutputDebug % "Initial Position: " this.obj._lastPos.Dump() " - Restore: " this.obj._restorePos.Dump() + hwnd := this.obj.hwnd + hwnd := this.obj.hwnd + xold := this.obj._lastPos.x + yold := this.obj._lastPos.y + wold := this.obj._lastPos.w + hold := this.obj._lastPos.h + wnew := wold+10 + hnew := hold+20 + OutputDebug % "BEFORE- Resizing from w,h(" wold "," hold ") to (" wnew "," hnew ")" + WinMove % "ahk_id" this.obj.hwnd, , xold, yold, wnew, hnew + OutputDebug % "AFTER- Resizing from w,h(" wold "," hold ") to (" wnew "," hnew ")" + Yunit.assert(this.obj.isMoved()==0) + Yunit.assert(this.obj.isResized()==1) + OutputDebug % "<<<<[" A_ThisFunc "]<<<<<" + } + + NoMoveResize() { + Global debug + success := 1 + l := new Windy(0, debug) + WinMove % "ahk_id" l._hWnd, , l._lastPos.x, l._lastPos.y, l._lastPos.w, l._lastPos.h + isMoved := l.isMoved() + isResized := l.isResized() + success := success && !(isMoved) && !(isResized) + l.kill() + if !success + throw " + } + + End() + { + sleep,2000 + this.obj.kill() + this.remove("obj") + this.obj := + } +} + +*/ \ No newline at end of file diff --git a/lib/DbgOut.ahk b/lib/DbgOut.ahk new file mode 100644 index 0000000..600f8cd --- /dev/null +++ b/lib/DbgOut.ahk @@ -0,0 +1,43 @@ +/* +Name: dbgOut - Prints given String via OutputDebug and indents string according to a given prefix +Version 0.1 (20161130) +Created: 20161130 +Author: hoppfrosch +Description: + Prints the given Debug-String via command OutputDebug. + The string is indented according to a given prefix in the Debug-String. + This allows a better tracing of stack depth with deep function calls. + + Supported prefixes are currently: + * ">" - This should be used when a funtion is entered. On each usage of this Prefix the indentation level is increased + Example: dbgOut(">[" A_ThisFunc "()]") + * "<" - This should be used when a funtion is exited. On each usage of this Prefix the indentation level is decreased + Example: dbgOut("<[" A_ThisFunc "()]") + * "|" - This should be used for temporary indentation +*/ +dbgOut(str, debug := 1) { + static indentLvl := 0 + x1 := SubStr(str, 1, 1) + if (x1 = "<") { + indentLvl := indentLvl - 1 + } + ;if (x1 = "|") { + ; indentLvl := indentLvl + 1 + ;} + + if (debug) { + i := 0 + indent := "" + while (i < indentLvl) { + indent := indent "++" + i := i + 1 + } + OutputDebug % indent str + } + if (x1 = ">") { + indentLvl := indentLvl + 1 + } + ;if (x1 = "|") { + ; indentLvl := indentLvl - 1 + ;} +} diff --git a/lib/Windy.ahk b/lib/Windy.ahk index 33a9180..9c5da70 100644 --- a/lib/Windy.ahk +++ b/lib/Windy.ahk @@ -1,5 +1,5 @@ /* - Title: Windy, v0.15.3 + Title: Windy, v0.15.4 Windy provides a collection of classes, which allow a class based approach of handling windows, monitors, etc. @@ -31,4 +31,4 @@ #include Windy.ahk -Version := "0.15.3" \ No newline at end of file +Version := "0.15.4" \ No newline at end of file diff --git a/lib/Windy/Const_WinUser.ahk b/lib/Windy/Const_WinUser.ahk index fcb8210..426a815 100644 --- a/lib/Windy/Const_WinUser.ahk +++ b/lib/Windy/Const_WinUser.ahk @@ -2,8 +2,21 @@ ; Function: Several Constants from Windows_API (winuser.h) ; AHK version: 1.1.05+ ; Language: English -; Version: 1.0.00.00/2014-09-19/hoppfrosch +; Version: 1.0.01.00/2016-02-08/hoppfrosch + +; GetWindow() constants ====================== (winuser.h) ============================================================= +class GW { + ; hhttps://msdn.microsoft.com/de-de/library/windows/desktop/ms633515%28v=vs.85%29.aspx + static HWNDFIRST := 0 + static HWNDLAST := 1 + static HWNDNEXT := 2 + static HWNDPREV := 3 + static OWNER := 4 + static CHILD := 5 + static ENABLEDPOPUP := 6 + static MAX := 6 +} ; Window field offsets for GetWindowLong() === (winuser.h) ============================================================= class GWL { ; http://msdn.microsoft.com/en-us/library/windows/desktop/ms633584%28v=vs.85%29.aspx @@ -316,6 +329,7 @@ class WS { static OVERLAPPEDWINDOW := 0x00CF0000 ; WS_OVERLAPPED|CAPTION|SYSMENU|THICKFRAME|MINIMIZEBOX|MAXIMIZEBOX static POPUPWINDOW := 0x80880000 ; WS_POPUP|BORDER|SYSMENU static TILEDWINDOW := 0x00CF0000 ; WS_OVERLAPPEDWINDOW + static BORDERLESS := 0x00C40000 ; WS_BORDER|WS_DLGFRAME|WS_SIZEBOX class EX { ; ExStyles ============================================================================================================= @@ -342,6 +356,7 @@ class WS { static TOOLWINDOW := 0x00000080 static TOPMOST := 0x00000008 static TRANSPARENT := 0x00000020 + static CLICKTHROUGH := 0x00000020 ; http://stackoverflow.com/questions/1524035/topmost-form-clicking-through-possible static WINDOWEDGE := 0x00000100 static OVERLAPPEDWINDOW := 0x00000300 ; WS_EX_WINDOWEDGE|EX_CLIENTEDGE static PALETTEWINDOW := 0x00000188 ; WS_EX_WINDOWEDGE|EX_TOOLWINDOW|EX_TOPMOST diff --git a/lib/Windy/MultiMony.ahk b/lib/Windy/MultiMony.ahk index 62eebc9..9eeda2b 100644 --- a/lib/Windy/MultiMony.ahk +++ b/lib/Windy/MultiMony.ahk @@ -19,7 +19,7 @@ */ class MultiMony { _debug := 0 - _version := "1.0.1" + _version := "1.0.2" ; ===== Properties ============================================================== debug[] { @@ -39,6 +39,33 @@ class MultiMony { return this._debug } } + idPrimary[] { + /* --------------------------------------------------------------------------------------- + Property: idPrimary [get] + Get the ID of the primary monitor + + Remarks: + * There is no setter available, since this is a constant system property + */ + get { + SysGet, ret, MonitorPrimary + if (this._debug) ; _DBG_ + OutputDebug % "|[" A_ThisFunc "([" this.id "]) -> (" ret ")]" ; _DBG_ + return ret + } + } + idTaskbar[] { + /* --------------------------------------------------------------------------------------- + Property: idTaskbar [get] + Get the ID of the monitor where the taskbar is on (aka. primary monitor) + + Remarks: + * There is no setter available, since this is a constant system property + */ + get { + return this.idPrimary + } + } monitorsCount[] { /* --------------------------------------------------------------------------------------- Property: monitorsCount [get] diff --git a/lib/Windy/Recty.ahk b/lib/Windy/Recty.ahk index c8244db..ed863ac 100644 --- a/lib/Windy/Recty.ahk +++ b/lib/Windy/Recty.ahk @@ -1,4 +1,7 @@ -; ****** HINT: Documentation can be extracted to HTML using NaturalDocs (http://www.naturaldocs.org/) ************** +#include %A_LineFile%\.. +#include ..\DbgOut.ahk + +; ****** HINT: Documentation can be extracted to HTML using NaturalDocs (http://www.naturaldocs.org/) ************** class Recty { ; ****************************************************************************************************************************************** @@ -219,8 +222,7 @@ class Recty { this.y := y this.w := w this.h := h - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" hwnd "])] -> x,y,w,h: (" x "," y "," w "," h ")" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" hwnd "])] -> x,y,w,h: (" x "," y "," w "," h ")", this.debug) } /* --------------------------------------------------------------------------------------- Method: fromRectangle(new) @@ -234,8 +236,7 @@ class Recty { this.y := new.y this.w := new.w this.h := new.h - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "] -> x,y,w,h: " this.Dump() ; _DBG_ + dbgOut("=[" A_ThisFunc "] -> x,y,w,h: " this.Dump(), this.debug) } /* --------------------------------------------------------------------------------------- Method: __New @@ -247,8 +248,7 @@ class Recty { */ __New(x=0, y=0, w=0, h=0, debug=false) { this._debug := debug ; _DBG_ - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "(x=" x ", y=" y ", w=" w ", h=" h ", _debug=" debug ")] (version: " this._version ")" ; _DBG_ + dbgOut("=[" A_ThisFunc "(x=" x ", y=" y ", w=" w ", h=" h ", _debug=" debug ")] (version: " this._version ")", this._debug) this.x := x this.y := y this.w := w diff --git a/lib/Windy/WindLy.ahk b/lib/Windy/WindLy.ahk index 3a00dac..08f21b6 100644 --- a/lib/Windy/WindLy.ahk +++ b/lib/Windy/WindLy.ahk @@ -4,6 +4,7 @@ #include %A_LineFile%\.. #include Windy.ahk #include Const_WinUser.ahk +#include ..\DbgOut.ahk /* ****************************************************************************************************************************************** @@ -137,7 +138,7 @@ class WindLy { oWindy - Object to be inserted */ intersection(oWindLy) { - result := new WindLy() + result := new WindLy(this.debug) for _currhwnd, _data in oWindLy.list { if (this._wl[_data.hwnd]) { result.insert(_data) @@ -154,18 +155,18 @@ class WindLy { do currently exist. Non existing windows are removed from the list. */ removeNonExisting() { - OutputDebug % ">>>>>>>> Windly.removeNonExisting()" - u := new WindLy() + dbgOut(">[" A_ThisFunc "([" this.hwnd "])]", this.debug) + u := new WindLy(this.debug) u.list := this.list.Clone() for key, data in u.list { OutputDebug % " CURRENT:" key ": " data.hwnd ": " data.title " (" key ")" if !data.exist { - OutputDebug % " REMOVE SINCE NON EXISTANT:" key ": " data.hwnd + dbgOut("|[" A_ThisFunc "([" this.hwnd "])] - REMOVE SINCE NON EXISTANT:" key ": " data.hwnd, this.debug) u.delete(data) } } this.list := u.list.Clone() - OutputDebug % "<<<<<<<< Windly.removeNonExisting()" + dbgOut("<[" A_ThisFunc "([" this.hwnd "])]", this.debug) return this.list } /* ------------------------------------------------------------------------------- @@ -176,8 +177,10 @@ class WindLy { List of Objects. */ snapshot() { + dbgOut(">[" A_ThisFunc "()]", this.debug) this.__reset() this._wl := this.__all() + dbgOut("<[" A_ThisFunc "()]", this.debug) return this._wl } /* ------------------------------------------------------------------------------- @@ -191,9 +194,9 @@ class WindLy { oWindy - Object to operate with */ symmetricDifference(oWindLy) { - result := new WindLy() - u := new WindLy() - i := new WindLy() + result := new WindLy(this.debug) + u := new WindLy(this.debug) + i := new WindLy(this.debug) ; The symmetric difference is the union without the intersection: u.list := this.list.Clone() @@ -238,16 +241,17 @@ class WindLy { List of Objects */ __all() { + dbgOut(">[" A_ThisFunc "()]", this.debug) hwnds := this.__hwnds(true) ret := {} Loop % hwnds.MaxIndex() { h_Wnd := hwnds[A_Index] h_WndHex := this.__hexStr(h_Wnd) - _w := new Windy(h_Wnd) + _w := new Windy(h_Wnd, this.debug) ret[h_WndHex] := _w } - + dbgOut("<[" A_ThisFunc "()]", this.debug) return ret } /*! --------------------------------------------------------------------------------------- @@ -296,6 +300,7 @@ class WindLy { __isRealWindow(h_Wnd) { WinGet, s, Style, ahk_id %h_Wnd% ret := s & WS.CAPTION ? (s & WS.POPUP ? 0 : 1) : 0 + dbgOut("=[" A_ThisFunc "([hWnd=" h_wnd "])] -> " ret, this.debug) return ret } /*! ------------------------------------------------------------------------------- @@ -303,6 +308,7 @@ class WindLy { Initializes all the data (*INTERNAL*) */ __reset() { + dbgOut("=[" A_ThisFunc "()]", this.debug) this._wl := {} } /* --------------------------------------------------------------------------------------- @@ -314,8 +320,7 @@ class WindLy { */ __New(_debug=0) { this._debug := _debug - if (this._debug) ; _DBG_ - OutputDebug % ">[" A_ThisFunc "()] (version: " this._version ")" ; _DBG_ + dbgOut(">[" A_ThisFunc "()] (version: " this._version ")", _debug) if % (A_AhkVersion < "1.1.20.02" || A_AhkVersion >= "2.0") { MsgBox 16, Error, %A_ThisFunc% :`n This class only needs AHK later than 1.1.20.01 (and before 2.0)`nAborting... @@ -323,10 +328,7 @@ class WindLy { OutputDebug % "<[" A_ThisFunc "(...) -> ()]: *ERROR* : This class needs AHK later than 1.1.20.01 (and before 2.0). Aborting..." ; _DBG_ return } - - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "()]" ; _DBG_ - + dbgOut("<[" A_ThisFunc "()]", _debug) return this } /*! --------------------------------------------------------------------------------------- diff --git a/lib/Windy/Windy.ahk b/lib/Windy/Windy.ahk index 37fb4e4..86b06a0 100644 --- a/lib/Windy/Windy.ahk +++ b/lib/Windy/Windy.ahk @@ -10,6 +10,7 @@ #include Const_WinUser.ahk #include _WindowHandlerEvent.ahk #include ..\SerDes.ahk +#include ..\DbgOut.ahk class Windy { ; ****************************************************************************************************************************************** @@ -23,7 +24,7 @@ class Windy { About: License This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See for more details. */ - _version := "0.9.0" + _version := "0.10.4" _debug := 0 _hWnd := 0 @@ -37,6 +38,36 @@ class Windy { _posStack := 0 ; ##################### Start of Properties (AHK >1.1.16.x) ############################################################ + activated[] { + /* --------------------------------------------------------------------------------------- + Property: activated [get/set] + Set/Unset the current window as active window or get the current state + + Value: + flag - *true* or *false* (activates/deactivates *activated*-Property) + + Remarks: + * To toogle, simply use + >obj.activated := !obj.activated + */ + get { + hwnd := this.hwnd + val := WinActive("ahk_id " hwnd) + ret := (val) > 0 ? 1 : 0 + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret " (" val ")", this.debug) + return ret + } + set { + hwnd := this.hwnd + if (value == true) + WinActivate, ahk_id hwnd + else if (value == false) + WinActivate, ahk_class Shell_TrayWnd ; see: https://autohotkey.com/board/topic/29314-windeactivate/ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> New Value:" this.activated, this.debug) + + return this.activated + } + } alwaysOnTop[] { /* --------------------------------------------------------------------------------------- Property: alwaysOnTop [get/set] @@ -51,8 +82,7 @@ class Windy { */ get { ret := (this.styleEx & WS.EX.TOPMOST) > 0 ? 1 : 0 - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } set { @@ -62,12 +92,42 @@ class Windy { else if (value == false) value := "off" WinSet, AlwaysOnTop, %value%, ahk_id %hwnd% - if (this._debug) ; _DBG_ - OutputDebug % "[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> New Value:" this.alwaysontop ; _DBG_ - + dbgOut("=[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> New Value:" this.alwaysontop, this.debug) return this.alwaysOnTop } } + border[] { + /* --------------------------------------------------------------------------------------- + Property: border [get/set] + Set/Unset visibility of the windows border (caption, sizebox) + + Value: + flag - *true* or *false* (activates/deactivates *border*-Property) + + Remarks: + * To toogle, simply use + > obj.border := !obj.border + */ + get { + ret := (this.style & WS.BORDERLESS) > 0 ? 1 : 0 + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) + return ret + } + + set { + style := "-" this.__hexStr(WS.BORDERLESS) + if (value) { + style := "+" this.__hexStr(WS.BORDERLESS) + } + prevState := A_DetectHiddenWindows + DetectHiddenWindows, on + this.style := style + this.redraw() + DetectHiddenWindows, %prevState% + dbgOut("=[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.caption, this.debug) + return value + } + } caption[] { /* --------------------------------------------------------------------------------------- Property: caption [get/set] @@ -82,8 +142,7 @@ class Windy { */ get { ret := (this.style & WS.CAPTION) > 0 ? 1 : 0 - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } @@ -98,11 +157,24 @@ class Windy { this.style := style this.redraw() DetectHiddenWindows, %prevState% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.caption ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.caption, this.debug) return value } } + captionHeight[] { + /* --------------------------------------------------------------------------------------- + Property: captionHeight [get] + Height of the caption bar + + Remarks: + * There is no setter available, since this is a constant window property + */ + get { + SysGet, val, 4 + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " val, this.debug) + return val + } + } centercoords[] { /* --------------------------------------------------------------------------------------- Property: centercoords [get/set] @@ -117,8 +189,7 @@ class Windy { x := Round((pos.w)/2 + pos.x) y := Round((pos.h)/2 + pos.y) centerPos := new Pointy(x,y,this._debug) - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "(pos="pos.dump() " [" this.hwnd "])] -> " centerPos.dump() ; _DBG_ + dbgOut("=[" A_ThisFunc "(pos="pos.dump() " [" this.hwnd "])] -> " centerPos.dump(), this.debug) return centerPos } @@ -134,8 +205,7 @@ class Windy { this.move(x,y,99999,99999) centerPos := this.centercoords - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "(pos=" value.dump() " [" this.hwnd "])] -> " centerPos.dump() ; _DBG_ + dbgOut("=[" A_ThisFunc "(pos=" value.dump() " [" this.hwnd "])] -> " centerPos.dump(), this.debug) return centerPos } } @@ -150,11 +220,47 @@ class Windy { get { val := this.hwnd WinGetClass, __classname, ahk_id %val% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "]) -> (" __classname ")]" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "]) -> (" __classname ")]", this.debug) return __classname } } + clickThrough[transparency := 128, alwaysOnTop := 0] { + /* --------------------------------------------------------------------------------------- + Property: clickThrough [get/set] + Set/Unset clickThrough flag of the current window or get the current state + + When a Window is set to clickthrough, its recommended to set the *alwaysontop*-Property as well + + Parameters: + transparency - transparency to be set on clickthrough. If clickthrough is disabled transparency will be switched off + + Value: + flag - *true* or *false* (activates/deactivates *clickThrough*-Property) + + Remarks: + * To toogle, simply use + >obj.clickThrough := !obj.clickThrough + */ + get { + ret := (this.styleEx & WS.EX.CLICKTHROUGH) > 0 ? 1 : 0 + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) + return ret + } + set { + hwnd := this.hwnd + if (value == true) { + value := "+" WS.EX.CLICKTHROUGH + tp := transparency + } else if (value == false) { + value := "-" WS.EX.CLICKTHROUGH + tp := "OFF" + } + this.transparency(100) := tp + WinSet, ExStyle, %value%, ahk_id %hwnd% + dbgOut("=[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> New Value:" this.clickThrough, this.debug) + return this.clickThrough + } + } debug[] { /* ------------------------------------------------------------------------------- Property: debug [get/set] @@ -189,8 +295,7 @@ class Windy { ret := true if (_hWnd = 0) ret := false - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } } @@ -227,16 +332,12 @@ class Windy { } DetectHiddenWindows, %prevState% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } set{ mode := value - if (this._debug) ; _DBG_ - OutputDebug % ">[" A_ThisFunc "([" this.hwnd "], mode=" mode ")] -> Current Value:" this.hidden ; _DBG_ - val := this.hwnd ret := 0 if (mode == true) { @@ -249,8 +350,7 @@ class Windy { } isHidden := this.hidden - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "([" this.hwnd "], mode=" mode ")] -> New Value:" isHidden ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], mode=" mode ")] -> New Value:" isHidden, this.debug) return isHidden } @@ -278,8 +378,7 @@ class Windy { */ get { ret := DllCall("user32\IsHungAppWindow", "Ptr", this.hwnd) - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } } @@ -297,8 +396,7 @@ class Windy { */ get { ret := (this.style & WS.HSCROLL) > 0 ? 1 : 0 - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } @@ -312,8 +410,7 @@ class Windy { this.style := style this.redraw() DetectHiddenWindows, %prevState% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.hscrollable ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.hscrollable, this.debug) return value } } @@ -331,8 +428,7 @@ class Windy { */ get { ret := (this.style & WS.MAXIMIZEBOX) > 0 ? 1 : 0 - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } @@ -346,8 +442,7 @@ class Windy { this.style := style this.redraw() DetectHiddenWindows, %prevState% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.maximizebox ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.maximizebox, this.debug) return value } } @@ -369,6 +464,7 @@ class Windy { ret := 0 if (s == 1) ret := 1 + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } @@ -388,8 +484,7 @@ class Windy { DetectHiddenWindows, %prevState% isMax := this.maximized - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], mode=" mode ")] -> New Value:" isMax ; _DBG_ + dbgOut("=[[" A_ThisFunc "([" this.hwnd "], mode=" mode ")] -> New Value:" isMax, this.debug) return isMax } @@ -408,8 +503,7 @@ class Windy { */ get { ret := (this.style & WS.MINIMIZEBOX) > 0 ? 1 : 0 - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } @@ -423,8 +517,7 @@ class Windy { this.style := style this.redraw() DetectHiddenWindows, %prevState% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.minimizebox ; _DBG_ + dbgOut("=[[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.minimizebox, this.debug) return value } } @@ -445,7 +538,8 @@ class Windy { WinGet, s, MinMax, ahk_id %val% ret := 0 if (s == -1) - ret := 1 + ret := 1 + dbgOut("=[[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } @@ -465,8 +559,7 @@ class Windy { DetectHiddenWindows, %prevState% isMin := this.minimized - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "([" this.hwnd "], mode=" mode ")] -> New Value:" isMin ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], mode=" mode ")] -> New Value:" isMin, this.debug) return isMin } @@ -487,8 +580,7 @@ class Windy { c := this.centercoords md := new MultiMony(this._debug) mon := md.idFromCoord(c.x,c.y,mon) - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " mon ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " mon, this.debug) return mon } @@ -515,12 +607,44 @@ class Windy { } monID := this.monitorID - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], ID=" value ")] -> New Value:" monID " (from: " oldID ")" ; _DBG_ + dbgOut("=[[" A_ThisFunc "([" this.hwnd "], ID=" value ")] -> New Value:" monID " (from: " oldID ")", this.debug) return monID } } + next[] { + /* --------------------------------------------------------------------------------------- + Property: next [get] + gets the object below the current object in the Z order. + + Returns: + new -object + + Remarks: + * There is no setter available, since this is a constant window property + */ + get { + ; http://autohotkey.com/board/topic/32171-how-to-get-the-id-of-the-next-or-previous-window-in-z-order/?p=205384 + hwndnext := this.hwnd + Loop { + hwndnext := DllCall("GetWindow", "uint", hwndnext, "uint", GW.HWNDNEXT) + ; GetWindow() returns a decimal value, so we have to convert it to hex + SetFormat,integer,hex + hwndnext += 0 + SetFormat,integer,d + if (hwndnext = 0) + break + if (this.__isWindow(hwndnext)) { + ; GetWindow() processes even hidden windows, so we move down the z oder until the next visible window is found + if (DllCall("IsWindowVisible","uint",hwndnext) = 1) + break + } + } + if (this._debug) ; _DBG_ + OutputDebug % "|[" A_ThisFunc "([" this.hwnd "]) -> (" hwndnext ")]" ; _DBG_ + return hwndnext + } + } owner[] { /* --------------------------------------------------------------------------------------- Property: owner [get/set] @@ -537,8 +661,7 @@ class Windy { */ get { hwndOwner := DllCall("GetWindowLong", "uint", this.hwnd, "int", GWL.HWNDPARENT, "UInt") - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " hwndOwner ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " hwndOwner, this.debug) return hwndOwner } @@ -547,8 +670,7 @@ class Windy { ret := DllCall("SetWindowLong", "uint", this.hwnd, "int", GWL.HWNDPARENT, "uint", hwndOwner) if ret == 0 hwndOwner := 0 - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], hwndOwner= " hwndOwner ")] -> hwndOwner:" hwndOwner ")" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], hwndOwner= " hwndOwner ")] -> hwndOwner:" hwndOwner ")", this.debug) return hwndOwner } } @@ -572,8 +694,7 @@ class Windy { */ get { hwndPar := DllCall("GetParent", "uint", hwndPar, "UInt") - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " hwndPar ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " hwndPar, this.debug) return hwndPar } @@ -595,8 +716,7 @@ class Windy { else SendMessage, WM.CHANGEUISTATE, UIS.NITIALIZE,,,ahk_id %hwndPar% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], hwndPar= " hwndPar ", bfixStyle=" bFixStyle ")] -> hwnd:" hwndPar ")" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], hwndPar= " hwndPar ", bfixStyle=" bFixStyle ")] -> hwnd:" hwndPar ")", this.debug) return hwndPar } } @@ -613,6 +733,7 @@ class Windy { pt := new Pointy() pt.x := ps.x pt.y := ps.y + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> (" pt.dump() ")", this.debug) return pt } set { @@ -621,6 +742,7 @@ class Windy { ps.x := pt.x ps.y := pt.y this.posSize := ps + dbgOut("=[" A_ThisFunc "([" this.hwnd "], pt=" pt.Dump()")] -> New Value:" pt.Dump(), this.debug) return pt } } @@ -635,8 +757,7 @@ class Windy { get { info := this.windowinfo currPos := new Recty(info.window.xul,info.window.yul,info.window.xlr-info.window.xul,info.window.ylr-info.window.yul,this._debug) - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> (" currPos.dump() ")" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> (" currPos.dump() ")", this.debug) return currPos } @@ -644,11 +765,43 @@ class Windy { rect := value this.move(rect.x, rect.y, rect.w, rect.h) newPos := this.posSize - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], pos=" newPos.Dump()")] -> New Value:" newPos.Dump() ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], pos=" newPos.Dump()")] -> New Value:" newPos.Dump(), this.debug) return newPos } } + previous[] { + /* --------------------------------------------------------------------------------------- + Property: previous [get] + gets the object above the current object in the Z order. + + Returns: + new -object + + Remarks: + * There is no setter available, since this is a constant window property + */ + get { + ; http://autohotkey.com/board/topic/32171-how-to-get-the-id-of-the-next-or-previous-window-in-z-order/?p=205384 + hwndprev := this.hwnd + Loop { + hwndprev := DllCall("GetWindow", "uint", hwndprev, "uint", GW.HWNDPREV) + ; GetWindow() returns a decimal value, so we have to convert it to hex + SetFormat,integer,hex + hwndprev += 0 + SetFormat,integer,d + if (hwndprev =0) + break + if (this.__isWindow(hwndprev)) { + ; GetWindow() processes even hidden windows, so we move down the z oder until the next visible window is found + if (DllCall("IsWindowVisible","uint",hwndprev) = 1) + break + } + } + if (this._debug) ; _DBG_ + OutputDebug % "|[" A_ThisFunc "([" this.hwnd "]) -> (" hwndprev ")]" ; _DBG_ + return hwndprev + } + } processID[] { /*--------------------------------------------------------------------------------------- Property: processID [get] @@ -663,8 +816,7 @@ class Windy { WinGet, PID, PID, % "ahk_id " this.hwnd ret := PID } - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } } @@ -682,8 +834,7 @@ class Windy { WinGet, PName, ProcessName, % "ahk_id " this.hwnd ret := PName } - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } } @@ -733,8 +884,7 @@ class Windy { ret := 1 } } - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } @@ -769,8 +919,7 @@ class Windy { } isRolled := this.rolledUp - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "([" this.hwnd "], mode=" mode ")] -> New Value:" isRolled ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], mode=" mode ")] -> New Value:" isRolled, this.debug) return isRolled } @@ -785,6 +934,7 @@ class Windy { */ get { SysGet, ret, 29 + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } @@ -821,8 +971,7 @@ class Windy { hdest := currPos.h * scaleY rt := new Recty(xdest, ydest, wdest, hdest, this._debug) - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.id "],monDest:= " monIdDest "] (" currPos.dump() ") -> (" rt.dump() ")" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.id "],monDest:= " monIdDest "] (" currPos.dump() ") -> (" rt.dump() ")", this.debug) return rt } } @@ -839,6 +988,7 @@ class Windy { pt := new Pointy() pt.x := ps.w pt.y := ps.h + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> (" pt.dump() ")", this.debug) return pt } set { @@ -847,6 +997,7 @@ class Windy { ps.w := pt.x ps.h := pt.y this.posSize := ps + dbgOut("=[" A_ThisFunc "([" this.hwnd "], value=" value.Dump()")] -> New Value:" pt.Dump(), this.debug) return pt } } @@ -865,8 +1016,7 @@ class Windy { */ get { ret := (this.style & WS.SIZEBOX) > 0 ? 1 : 0 - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } @@ -880,8 +1030,7 @@ class Windy { this.style := style this.redraw() DetectHiddenWindows, %prevState% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.sizebox ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.sizebox, this.debug) return value } } @@ -893,8 +1042,7 @@ class Windy { get { hWnd := this._hwnd WinGet, currStyle, Style, ahk_id %hwnd% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this._hwnd "])] -> (" this.__hexStr(currStyle) ")" + dbgOut("=[" A_ThisFunc "([" this._hwnd "])] -> (" this.__hexStr(currStyle) ")", this.debug) return currStyle } set { @@ -902,8 +1050,7 @@ class Windy { WinSet, Style, %value%, ahk_id %hwnd% this.redraw() WinGet, currStyle, Style, ahk_id %hwnd% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], style=" this.__hexStr(value) ")] -> (" this.__hexStr(value) "/" this.__hexStr(currStyle) ")" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], style=" this.__hexStr(value) ")] -> (" this.__hexStr(value) "/" this.__hexStr(currStyle) ")", this.debug) return value } } @@ -916,8 +1063,7 @@ class Windy { get { hWnd := this._hwnd WinGet, currStyle, ExStyle, ahk_id %hwnd% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this._hwnd "])] -> (" this.__hexStr(currStyle) ")" + dbgOut("=[" A_ThisFunc "([" this._hwnd "])] -> (" this.__hexStr(currStyle) ")", this.debug) return currStyle } set { @@ -925,8 +1071,7 @@ class Windy { WinSet, ExStyle, %value%, ahk_id %hwnd% this.redraw() WinGet, currStyle, ExStyle, ahk_id %hwnd% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], styleEx=" this.__hexStr(value) ")] -> (" this.__hexStr(value) "/" this.__hexStr(currStyle) ")" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], styleEx=" this.__hexStr(value) ")] -> (" this.__hexStr(value) "/" this.__hexStr(currStyle) ")", this.debug) return value } } @@ -941,8 +1086,7 @@ class Windy { get { val := this.hwnd WinGetTitle, title, ahk_id %val% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "]) -> (" title ")]" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "]) -> (" title ")]", this.debug) return title } @@ -954,8 +1098,7 @@ class Windy { WinSetTitle, ahk_id %val%,, %title% DetectHiddenWindows, %prevState% newTitle := this.title - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], title=" title ")] -> " newTitle ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], title=" title ")] -> " newTitle, this.debug) return newTitle } } @@ -983,8 +1126,7 @@ class Windy { ret := 255 if (s != "") ret := s - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } @@ -1032,8 +1174,7 @@ class Windy { } transEnd := this.transparency - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "([" this.hwnd "], transparency=" transOrig "(" transStart "), increment=" increment ", delay=" delay ")] -> New Value:" transEnd ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], transparency=" transOrig "(" transStart "), increment=" increment ", delay=" delay ")] -> New Value:" transEnd, this.debug) return transEnd } } @@ -1051,8 +1192,7 @@ class Windy { */ get { ret := (this.style & WS.VSCROLL) > 0 ? 1 : 0 - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> " ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> " ret, this.debug) return ret } @@ -1066,8 +1206,7 @@ class Windy { this.style := style this.redraw() DetectHiddenWindows, %prevState% - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.vscrollable ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], value=" value ")] -> " this.vscrollable, this.debug) return value } } @@ -1107,14 +1246,14 @@ class Windy { } If !DllCall("User32.dll\IsWindow", "Ptr", this.hwnd) { ErrorLevel := 1 - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "]) -> false (is not a window)]" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "]) -> false (is not a window)]", this.debug) Return False } struct_WI := "" NumPut(VarSetCapacity(struct_WI, WI_Size, 0), struct_WI, 0, "UInt") If !(DllCall("User32.dll\GetWindowInfo", "Ptr", this.hwnd, "Ptr", &struct_WI)) { ErrorLevel := 2 - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "]) -> false]" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "]) -> false]", this.debug) Return False } obj_WI := {} @@ -1142,14 +1281,13 @@ class Windy { obj_WI[Key] := NumGet(struct_WI, Offset, Value[4]) } } - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] => (" SerDes(Obj_WI) ")" ; _DBG_ - Return obj_WI + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] => (" SerDes(Obj_WI) ")", this.debug) + Return obj_WI } } ; ##################### End of Properties (AHK >1.1.16.x) ############################################################## - ; ######################## Methods to be called directly ########################################################### + ; ######################## Methods to be called directly ########################################################### /* --------------------------------------------------------------------------------------- Method: border2percent translates a border string to monitor percents. @@ -1210,17 +1348,15 @@ class Windy { destPos := new Recty(x, y, currPos.w, currPos.h) ret := mon.rectToPercent(destPos) - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], border=""" border """)] pos (" this.posSize.Dump()") on Mon " this.monitorId " -> percent (" ret.Dump() ")" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], border=""" border """)] pos (" this.posSize.Dump()") on Mon " this.monitorId " -> percent (" ret.Dump() ")", this.debug) return ret - } + } - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], border=""" border """)] *** ERROR: Invalid border string <" border ">" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], border=""" border """)] *** ERROR: Invalid border string <" border ">", this.debug) - return - } + return + } /* --------------------------------------------------------------------------------------- Method: kill Kills the Window (Forces the window to close) @@ -1231,9 +1367,7 @@ class Windy { */ kill() { - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])]" ; _DBG_ - + dbgOut("=[" A_ThisFunc "([" this.hwnd "])]", this.debug) prevState := A_DetectHiddenWindows DetectHiddenWindows, On WinKill % "ahk_id" this.hwnd @@ -1259,8 +1393,7 @@ class Windy { , */ move(X,Y,W="99999",H="99999") { - if (this._debug) ; _DBG_ - OutputDebug % ">[" A_ThisFunc "([" this.hwnd "])(X=" X " ,Y=" Y " ,W=" W " ,H=" H ")]" ; _DBG_ + dbgOut(">[" A_ThisFunc "([" this.hwnd "])(X=" X " ,Y=" Y " ,W=" W " ,H=" H ")]") if (X = 99999 || Y = 99999 || W = 99999 || H = 9999) currPos := this.posSize @@ -1276,8 +1409,7 @@ class Windy { if (H = 99999) H := currPos.H - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "([" this.hwnd "])(X=" X " ,Y=" Y " ,W=" W " ,H=" H ")]" ; _DBG_ + dbgOut("<[" A_ThisFunc "([" this.hwnd "])(X=" X " ,Y=" Y " ,W=" W " ,H=" H ")]", this.debug) WinMove % "ahk_id" this.hwnd, , X, Y, W, H } /* --------------------------------------------------------------------------------------- @@ -1306,8 +1438,7 @@ class Windy { - The range of the method parameters is *NOT* checked, so be carefull using any values *<0* or *>100* */ movePercental(xFactor=0, yFactor=0, wFactor=100, hFactor=100) { - if (this._debug) ; _DBG_ - OutputDebug % ">[" A_ThisFunc "([" this.hwnd "], xFactor=" xFactor ", yFactor=" yFactor ", wFactor=" wFactor ", hFactor=" hFactor ")]" ; _DBG_ + dbgOut(">[" A_ThisFunc "([" this.hwnd "], xFactor=" xFactor ", yFactor=" yFactor ", wFactor=" wFactor ", hFactor=" hFactor ")]", this.debug) mon := new Mony(this.monitorID, this._debug) monWorkArea := mon.workingArea @@ -1322,8 +1453,7 @@ class Windy { this.move(x,y,w,h) - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "([" this.hwnd "], xFactor=" xFactor ", yFactor=" yFactor ", wFactor=" wFactor ", hFactor=" hFactor ")] -> padded to (" this.posSize.Dump() ") on Monitor (" this.monitorID ")" ; _DBG_ + dbgOut("<[" A_ThisFunc "([" this.hwnd "], xFactor=" xFactor ", yFactor=" yFactor ", wFactor=" wFactor ", hFactor=" hFactor ")] -> padded to (" this.posSize.Dump() ") on Monitor (" this.monitorID ")", this.debug) } /* --------------------------------------------------------------------------------------- Method: moveBorder @@ -1347,16 +1477,12 @@ class Windy { , */ moveBorder(border="") { - if (this._debug) ; _DBG_ - OutputDebug % ">[" A_ThisFunc "([" this.hwnd "], border=""" border """)] -> started from (" this.posSize.Dump() ") on Monitor (" this.monitorID ")" ; _DBG_ - + dbgOut(">[" A_ThisFunc "([" this.hwnd "], border=""" border """)] -> started from (" this.posSize.Dump() ") on Monitor (" this.monitorID ")", this.debug) factor := this.border2percent(border) if (factor) { this.movePercental(factor.x, factor.y, factor.w, factor.h) } - - if (this._debug) ; _DBG_ - OutputDebug % ">[" A_ThisFunc "([" this.hwnd "], border=""" border """)] -> moved to (" this.posSize.Dump() ") on Monitor (" this.monitorID ")" ; _DBG_ + dbgOut(">[" A_ThisFunc "([" this.hwnd "], border=""" border """)] -> moved to (" this.posSize.Dump() ") on Monitor (" this.monitorID ")", this.debug) } /* --------------------------------------------------------------------------------------- Method: posSize2percent @@ -1371,10 +1497,7 @@ class Windy { currPos := this.posSize mon := new Mony(this.monitorID, this._debug) ret := mon.rectToPercent(currPos) - - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] pos (" this.posSize.Dump()") on Mon " this.monitorId " -> percent (" ret.Dump() ")" ; _DBG_ - + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] pos (" this.posSize.Dump()") on Mon " this.monitorId " -> percent (" ret.Dump() ")", this.debug) return ret } /* --------------------------------------------------------------------------------------- @@ -1405,8 +1528,7 @@ class Windy { ifEqual, bEnable, 0, return } ret := DllCall("RedrawWindow", "uint", hwnd, "uint", 0, "uint", 0, "uint" ,RDW.INVALIDATE | RDW.ERASE | RDW.FRAME | RDW.ERASENOW | RDW.UPDATENOW | RDW.ALLCHILDREN) - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "], Option=" Option ")] -> ret=" ret ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "], Option=" Option ")] -> ret=" ret, this.debug) return ret } ; ######################## Internal Methods - not to be called directly ############################################ @@ -1425,11 +1547,8 @@ class Windy { */ __isWindow(hWnd) { WinGet, s, Style, ahk_id %hWnd% - ret := s & WS.CAPTION ? (s & WS.POPUP ? 0 : 1) : 0 ;WS_CAPTION AND !WS_POPUP(for tooltips etc) - - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" hWnd "])] -> " ret ; _DBG_ - + ret := s & WS.CAPTION ? (s & WS.POPUP ? 0 : 1) : 0 ;WS_CAPTION AND !WS_POPUP(for tooltips etc) + dbgOut("=[" A_ThisFunc "([" hWnd "])] -> " ret, this.debug) return ret } /* --------------------------------------------------------------------------------------- @@ -1450,7 +1569,7 @@ class Windy { __posPush() { this._posStack.Insert(1, this.posSize) if (this._debug) { ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])] -> (" this._posStack[1].dump() ")" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])] -> (" this._posStack[1].dump() ")", this.debug) this.__posStackDump() ; _DBG_ } } @@ -1460,7 +1579,7 @@ class Windy { */ __posStackDump() { For key,value in this._posStack ; loops through all elements in Stack - OutputDebug % "|[" A_ThisFunc "()] -> (" key "): (" Value.dump() ")" ; _DBG_ + dbgOut("=[" A_ThisFunc "()] -> (" key "): (" Value.dump() ")", this.debug) return } /* --------------------------------------------------------------------------------------- @@ -1471,8 +1590,7 @@ class Windy { index - Index of position to restore (*Optional*, Default = 2) (1 is the current position) */ __posRestore(index="2") { - if (this._debug) ; _DBG_ - OutputDebug % ">[" A_ThisFunc "([" this.hwnd "], index=" index ")]" ; _DBG_ + dbgOut(">[" A_ThisFunc "([" this.hwnd "], index=" index ")]", this.debug) restorePos := this._posStack[index] currPos := this.posSize @@ -1480,7 +1598,7 @@ class Windy { this.move(restorePos.x, restorePos.y, restorePos.w, restorePos.h) if (this._debug) { ; _DBG_ - OutputDebug % "<[" A_ThisFunc "([" this.hwnd "])] LastPos: " currPos.Dump() " - RestoredPos: " restorePos.Dump() ; _DBG_ + dbgOut("<[" A_ThisFunc "([" this.hwnd "])] LastPos: " currPos.Dump() " - RestoredPos: " restorePos.Dump(), this.debug) this.__posStackDump() ; _DBG_ } } @@ -1495,9 +1613,7 @@ class Windy { true or false, depending on result of dllcall */ __SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags) { - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])(eventMin=" eventMin ", eventMax=" eventMax ", hmodWinEventProc=" hmodWinEventProc ", lpfnWinEventProc=" lpfnWinEventProc ", idProcess=" idProcess ", idThread=" idThread ", dwFlags=" dwFlags ")" ; _DBG_ - + dbgOut("[" A_ThisFunc "([" this.hwnd "])(eventMin=" eventMin ", eventMax=" eventMax ", hmodWinEventProc=" hmodWinEventProc ", lpfnWinEventProc=" lpfnWinEventProc ", idProcess=" idProcess ", idThread=" idThread ", dwFlags=" dwFlags ")", this.debug) ret := DllCall("ole32\CoInitialize", Uint, 0) ; This is a WinEventProc (siehe ) - this determines parameters which can be handled by "HookProc" ret := DllCall("user32\SetWinEventHook" @@ -1517,27 +1633,24 @@ class Windy { * Store windows size/pos on each change */ __onLocationChange() { - if this.hwnd = 0 + if this.hwnd = 0 return - if (this._debug) ; _DBG_ - OutputDebug % ">[" A_ThisFunc "([" this.hwnd "])" ; _DBG_ + dbgOut(">[" A_ThisFunc "([" this.hwnd "])") currPos := this.posSize lastPos := this._posStack[1] ; current size/position is identical with previous Size/position if (currPos.equal(lastPos)) { - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "([" this.hwnd "])] Position has NOT changed!" ; _DBG_ + dbgOut("<[" A_ThisFunc "([" this.hwnd "])] Position has NOT changed!)", this.debug) return } ; size/position has been changed -> store it! this.__posPush() - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "([" this.hwnd "])] LastPos: " lastPos.Dump() " - NewPos: " currPos.Dump() ; _DBG_ + dbgOut("<[" A_ThisFunc "([" this.hwnd "])] LastPos: " lastPos.Dump() " - NewPos: " currPos.Dump(), this.debug) return } /* --------------------------------------------------------------------------------------- @@ -1548,9 +1661,7 @@ class Windy { if (this.hwnd <= 0) { return } - - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])" ; _DBG_ + dbgOut("=[" A_ThisFunc "([" this.hwnd "])", this.debug) if (this.__useEventHook == 1) { if (this.__hWinEventHook1) @@ -1560,9 +1671,6 @@ class Windy { if (this._HookProcAdr) DllCall( "kernel32\GlobalFree", UInt,&this._HookProcAdr ) ; free up allocated memory for RegisterCallback } - - if (this._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" this.hwnd "])" ; _DBG_ ; Reset all "dangerous" settings (all windows should be left in a user accessable state) if (this.alwaysontop == true) { @@ -1589,13 +1697,11 @@ class Windy { */ __New(_hWnd=-1, _debug=0, _test=0) { this._debug := _debug - if (this._debug) ; _DBG_ - OutputDebug % ">[" A_ThisFunc "(hWnd=(" _hWnd "))] (version: " this._version ")" ; _DBG_ + dbgOut(">[" A_ThisFunc "(hWnd=(" _hWnd "))] (version: " this._version ")", _debug) if % (A_AhkVersion < "1.1.08.00" || A_AhkVersion >= "2.0") { MsgBox 16, Error, %A_ThisFunc% :`n This class is only tested with AHK_L later than 1.1.08.00 (and before 2.0)`nAborting... - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "(...) -> ()]: *ERROR* : This class is only tested with AHK_L later than 1.1.08.00 (and before 2.0). Aborting..." ; _DBG_ + dbgOut("<[" A_ThisFunc "(...) -> ()]: *ERROR* : This class is only tested with AHK_L later than 1.1.08.00 (and before 2.0). Aborting...", _debug) return } @@ -1608,23 +1714,20 @@ class Windy { } else if % (_hWnd = -1) { ; hWnd is missing MsgBox 16, Error, %A_ThisFunc% :`n Required parameter is missing`nAborting... - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "(...) -> ()] *ERROR*: Required parameter is missing. Aborting..." ; _DBG_ + dbgOut("<[" A_ThisFunc "(...) -> ()] *ERROR*: Required parameter is missing. Aborting...", _debug) this.hwnd := -1 return } if (!this.__isWindow(_hWnd)) { - if (this._debug) ; _DBG_ - OutputDebug % ">[" A_ThisFunc "(hWnd=(" _hWnd "))] is NOT a true window. Aborting..." ; _DBG_ + dbgOut("<[" A_ThisFunc "(hWnd=(" _hWnd "))] is NOT a true window. Aborting...", _debug) this.hwnd := -1 return } _hWnd := this.__hexstr(_hWnd) this._hWnd := _hWnd - if (this._debug) ; _DBG_ - OutputDebug % ">[" A_ThisFunc "(hWnd=(" _hWnd "))] (WinTitle: " this.title ")" ; _DBG_ + dbgOut("|[" A_ThisFunc "(hWnd=(" _hWnd "))] (WinTitle: " this.title ")", _debug) this._posStack := Object() ; creates initially empty stack @@ -1640,9 +1743,7 @@ class Windy { this._hWinEventHook2 := this.__SetWinEventHook( CONST_EVENT.OBJECT.SHOW, CONST_EVENT.OBJECT.CONTENTSCROLLED, 0, this._HookProcAdr, 0, 0, 0 ) } - if (this._debug) ; _DBG_ - OutputDebug % "<[" A_ThisFunc "(hWnd=(" _hWnd "))]" ; _DBG_ - + dbgOut("<[" A_ThisFunc "(hWnd=(" _hWnd "))]", _debug) return this } @@ -1670,8 +1771,7 @@ ClassWindy_EventHook(hWinEventHook, Event, hWnd, idObject, idChild, dwEventThrea return self := Object(A_EventInfo) - if (Object(A_EventInfo)._debug) ; _DBG_ - OutputDebug % "|[" A_ThisFunc "([" Object(A_EventInfo)._hWnd "])(hWinEventHook=" hWinEventHook ", Event=" Event2Str(Event) ", hWnd=" hWnd ", idObject=" idObject ", idChild=" idChild ", dwEventThread=" dwEventThread ", dwmsEventTime=" dwmsEventTime ") -> A_EventInfo: " A_EventInfo ; _DBG_ + dbgOut("=[" A_ThisFunc "([" Object(A_EventInfo)._hWnd "])(hWinEventHook=" hWinEventHook ", Event=" Event2Str(Event) ", hWnd=" hWnd ", idObject=" idObject ", idChild=" idChild ", dwEventThread=" dwEventThread ", dwmsEventTime=" dwmsEventTime ") -> A_EventInfo: " A_EventInfo, Object(A_EventInfo)._debug) ; ########## START: Handling window movement ################################################## ; We want to detect when the window movement has finished finally, as onLocationChanged() has only to be called at the END of the movement