Advertisement
Guest User

Untitled

a guest
Aug 11th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5. #SingleInstance, Force
  6. ;#NoEnv
  7. SetBatchLines, -1
  8.  
  9. global GUI_Base_Fonts
  10.  
  11. global Test_Check := true
  12.  
  13. global GUI_Icon_Default_Location := []
  14. GUI_Icon_Default_Location[8,8] := "larva"
  15. GUI_Icon_Default_Location[16,8] := "queen"
  16. GUI_Icon_Default_Location[24,8] := "creeptumor"
  17. GUI_Icon_Default_Location[32,8] := "drone"
  18.  
  19. GUI_Icon_Default_Location[32,16] := "overlord"
  20. GUI_Icon_Default_Location[8,16] := "overseer"
  21. GUI_Icon_Default_Location[16,16] := "generatecreep"
  22. GUI_Icon_Default_Location[24,16] := "changeling"
  23.  
  24.  
  25. GUI_Icon_Default_Location[8,24] := "xelnaga"
  26. GUI_Icon_Default_Location[16,24] := "rubble"
  27. GUI_Icon_Default_Location[24,24] := "starmap"
  28. GUI_Icon_Default_Location[8,32] := "extractor"
  29. GUI_Icon_Default_Location[32,24] := "tutorial"
  30. GUI_Icon_Default_Location[24,32] := "visitthelab"
  31. GUI_Icon_Default_Location[24,40] := "baneling"
  32. ;GUI_Icon_Default_Location[40,8] := "burrow"
  33. GUI_Icon_Default_Location[40,16] := "swarmhost"
  34. GUI_Icon_Default_Location[48,16] := "locust"
  35. ;GUI_Icon_Default_Location[24,16] := "transfuse"
  36. ;GUI_Icon_Default_Location[24,16] := "untitled"
  37. ;GUI_Icon_Default_Location[40,24] := "contaminate"
  38. GUI_Icon_Default_Location[1,26] := "Auto_Inject_CheckBox"
  39. GUI_Icon_Default_Location[1,29] := "Auto_Ping_CheckBox"
  40. GUI_Icon_Default_Location[111,23] := "Lock_UI_CheckBox"
  41. GUI_Icon_Default_Location[111,29] := "Lock_Icons_CheckBox"
  42. GUI_Icon_Default_Location[111,26] := "Lock_Confine_Icons"
  43. GUI_Icon_Default_Location[100,8] := "Preview_Announcements"
  44. GUI_Icon_Default_Location[113,1] := "Volume_Slider"
  45.  
  46.  
  47. global GUI_Base_SliderBar_StaticID := []
  48. global GUI_Base_SliderBar_Indicator_StaticID := []
  49. global GUI_Base_SliderBar_Indicator_Pressed_StaticID := []
  50.  
  51. global GUI_Base_SliderBar_StaticID_Path := []
  52. global GUI_Base_SliderBar_Indicator_StaticID_Path := []
  53. global GUI_Base_SliderBar_Indicator_Pressed_StaticID_Path := []
  54.  
  55. global Gui_Base_SliderBar_Count := 0
  56. global Gui_Base_SliderBar_Name := []
  57.  
  58. global GUI_Base_SliderBar_VControl_Array := []
  59. global GUI_Base_SliderBar_Indicator_VControl_Array := []
  60. global GUI_Base_SliderBar_Indicator_Pressed_VControl_Array := []
  61.  
  62. global GUI_Base_SliderBar_StaticID_Database_Count := 0
  63. global GUI_Base_SliderBar_Prefix := "\GUI_Resources\Controls\"
  64. global GUI_Base_SliderBar_Suffix := ".png"
  65.  
  66.  
  67.  
  68. global GUI_Base_PlayButton_VControl_Array
  69. global GUI_Base_PlayButton_Highlighted_VControl_Array
  70. global GUI_Base_PlayButton_Playing_VControl_Array
  71.  
  72. global GUI_Base_PlayButton_StaticID_Database_Count := 0
  73.  
  74. global GUI_Base_PlayButton_StaticID := []
  75. global GUI_Base_PlayButton_Highlighted_StaticID := []
  76. global GUI_Base_PlayButton_Playing_StaticID := []
  77.  
  78. global GUI_Base_PlayButton_StaticID_Path := []
  79. global GUI_Base_PlayButton_Highlighted_StaticID_Path := []
  80. global GUI_Base_PlayButton_Playing_StaticID_Path := []
  81.  
  82. global GUI_Base_PlayButton_StaticID_Database_Count := 0
  83.  
  84. ;global Static := []
  85.  
  86.  
  87.  
  88. global GUI_Base_User_Opened_Options_First_Time := false
  89. global GUI_Base_User_In_Options := false
  90. global GUI_Base_User_Last_Clicked := ""
  91. global GUI_Base_User_Last_Clicked_Index := ""
  92.  
  93.  
  94.  
  95. global GUI_Options_MasterVolume := 0
  96. global GUI_Options_LastSoundEffectUsed := ""
  97. global GUI_Options_Preview_Playing := false
  98.  
  99. global GUI_Options_Input_Box := ""
  100. global GUI_Options_Lock_Icons := true
  101. global GUI_Options_Lock_Window := false
  102. global GUI_Options_Lock_Icons_TO_Window := true
  103. global GUI_Base_Grid_Watching := false
  104.  
  105.  
  106.  
  107.  
  108. global Debug_ToolTips := false
  109. global GUI_Base_Grid := 5
  110. global GUI_Base_GridX := []
  111. global GUI_Base_GridY := []
  112. global GUI_Base_GridOccupied := []
  113. global GUI_Base_GridOccupiedStatic := []
  114. global GUI_Base_GridOccupiedName := []
  115. global GUI_Base_GridOccupiedHasCreep := []
  116. global GUI_Base_GridOccupiedIconIndex := []
  117. global GUI_Base_GridOccupiedIconcVar := []
  118. global GUI_Base_GridOccupiedIconType := []
  119.  
  120. global GUI_Base_Grid_FrameX := 15
  121. global GUI_Base_Grid_FrameY := 15
  122.  
  123. ;all the frames are inside GUI_Base_Icon_ControlVLabel starting 1 1st = normal 2nd = 2nd normal etc
  124. ; so if GUI_Base_Icon index is 1 the vlabel for the first frame is GUI_Base_Icon_ControlVLabel[1,1]
  125. global GUI_Base_Icon_ControlVLabel = []
  126. global GUI_Base_Icon_ControlName = []
  127. global GUI_Base_Main_Icon_ControlVLabel = []
  128.  
  129. global GUI_Base_Icon_StaticID = []
  130. global GUI_Base_Icon_StaticID_Path = []
  131. global GUI_Base_Icon := []
  132. global GUI_Base_Icon_Count := 0
  133. global GUI_Base_Icon_Current_Frame := []
  134. global GUI_Base_Icon_Belongs_To_Race := []
  135. ; old global GUI_Base_Icon_ControlList := []
  136. global GUI_Base_Icon_ControlNames := []
  137. global GUI_Base_Icon_Prefix := "\GUI_Resources\Icons\Art\"
  138. global GUI_Base_Icon_Suffix := "_40.png"
  139.  
  140. global GUI_Base_Icon_Frame := []
  141. global GUI_Base_Icon_Frame_Prefix := "\GUI_Resources\Icons\Backgrounds\"
  142. global GUI_Base_Icon_Frame_Suffix := "_40.png"
  143. global GUI_Base_Icon_Frame_Count := 0
  144.  
  145.  
  146.  
  147.  
  148.  
  149. global Gui_Base_Label_Count := 0
  150. global Gui_Base_Label_Text := []
  151. global Gui_Base_Label_Width := []
  152. global Gui_Base_Label_Height := []
  153. global GUI_Base_Label_StaticID := []
  154. global GUI_Base_Label_StaticID_Path := []
  155. global Gui_Base_Label_VControl_Array := []
  156. global GUI_Base_Label_StaticID_Database_Count := 0
  157.  
  158.  
  159. global GUI_Base_CheckBox_StaticID_Database_Count := 0
  160. global GUI_Base_CheckBox_Normal_StaticID := []
  161. global GUI_Base_CheckBox_Normal_Over_StaticID := []
  162. global GUI_Base_CheckBox_Pressed_StaticID := []
  163. global GUI_Base_CheckBox_Pressed_Over_StaticID := []
  164. global GUI_Base_CheckBox_Pressed_Checked_StaticID := []
  165. global GUI_Base_CheckBox_Pressed_Over_Checked_StaticID := []
  166. global GUI_Base_CheckBox_Normal_StaticID_Path := []
  167. global GUI_Base_CheckBox_Normal_Over_StaticID_Path := []
  168. global GUI_Base_CheckBox_Normal_StaticID_Path := []
  169. global GUI_Base_CheckBox_Pressed_Checked_StaticID_Path := []
  170. global GUI_Base_CheckBox_Pressed_Over_StaticID_Path := []
  171. global GUI_Base_CheckBox_Pressed_Over_Checked_StaticID_Path := []
  172.  
  173.  
  174.  
  175.  
  176. global Gui_Base_CheckBox_Normal_Name_Array := []
  177. global Gui_Base_CheckBox_Count := 0
  178. global Gui_Base_CheckBox_Normal_Array := []
  179. global Gui_Base_CheckBox_Normal_Over_Array := []
  180. global Gui_Base_CheckBox_Pressed_Array := []
  181. global Gui_Base_CheckBox_Pressed_Over_Array := []
  182. global Gui_Base_CheckBox_Pressed_Checked_Array := []
  183. global Gui_Base_CheckBox_Pressed_Over_Checked_Array := []
  184. global GUI_Base_CheckBox_Prefix := "\GUI_Resources\Controls\"
  185. global GUI_Base_CheckBox_Suffix := "_50.png"
  186.  
  187.  
  188. global GUI_Base_Graphic_StaticID_Database_Name := []
  189. global GUI_Base_Graphic_StaticID_Database_Path := []
  190. global GUI_Base_Graphic_StaticID_Database_Count := 0
  191.  
  192. global MyGUIHWND := ""
  193.  
  194.  
  195.  
  196.  
  197.  
  198. global Big_Window_Frame := ""
  199. global Small_Window_Frame := ""
  200.  
  201. GUI_Base_Create_Main_Window(0,0)
  202. GUI_Base_Create_Main_Window_Border()
  203.  
  204. ;Make frames first, always!
  205. GUI_Base_AddIcon_Frame("protossframe")
  206. GUI_Base_AddIcon_Frame("redframe")
  207. GUI_Base_AddIcon_Frame("terranframe")
  208. GUI_Base_AddIcon_Frame("zergframe")
  209.  
  210. GUI_Base_AddIcon("creeptumor","Zerg","zergframe")
  211. GUI_Base_AddIcon("drone","Zerg","zergframe")
  212. GUI_Base_AddIcon("larva","Zerg","zergframe")
  213. GUI_Base_AddIcon("generatecreep","Zerg","zergframe")
  214. GUI_Base_AddIcon("changeling","Zerg","zergframe")
  215. GUI_Base_AddIcon("overlord","Zerg","zergframe")
  216. GUI_Base_AddIcon("overseer","Zerg","zergframe")
  217. GUI_Base_AddIcon("queen","Zerg","zergframe")
  218. GUI_Base_AddIcon("xelnaga","Generic","protossframe")
  219. GUI_Base_AddIcon("rubble","Generic","protossframe")
  220. GUI_Base_AddIcon("starmap","Generic","redframe")
  221. GUI_Base_AddIcon("tutorial","Generic","redframe")
  222.  
  223. GUI_Base_AddIcon("visitthelab","Zerg","zergframe")
  224. Gui_Base_AddCheckBox("UI_CheckBox", "Auto_Inject_CheckBox", "Auto Inject",80,15)
  225. Gui_Base_AddCheckBox("UI_CheckBox", "Auto_Ping_CheckBox", "Auto Ping",100,15)
  226. Gui_Base_AddCheckBox("UI_CheckBox", "Lock_UI_CheckBox", "Lock Window",90,15)
  227. Gui_Base_AddCheckBox("UI_CheckBox", "Lock_Icons_CheckBox", "Lock Icons",100,15)
  228. Gui_Base_AddCheckBox("UI_CheckBox", "Lock_Confine_Icons", "Confine Icons",100,15)
  229.  
  230. GUI_Base_AddSlider("SliderBar_1", "Volume_Slider")
  231.  
  232. ;GUI_Base_Check_Install_Fonts()
  233.  
  234. CreateLabels()
  235.  
  236.  
  237. GUI_Initialize_Icons()
  238.  
  239.  
  240. WinSet, TransColor, 0x000000
  241. GUI, Show
  242. GUI_Base_Create_Icon_Grid()
  243. Setup_Icons_Default()
  244. Setup_CheckBoxes_Default()
  245. Setup_Sliders_Default()
  246. GUI_Base_Create_Preview_Button()
  247. GUI_Base_Create_Static_DB()
  248. Setup_CheckBoxes_Grids()
  249. Setup_SliderBar_Grids()
  250. Setup_PlayButton_Grids()
  251.    
  252.    
  253. OnMessage(0x200, "OnMouseMove")     ; WM_MOUSEMOVE
  254. SetTimer, FixCursor, OFF
  255. RestoreCursors()
  256.    
  257. return
  258.  
  259.  
  260.  
  261. f9::
  262. SetTimer, WatchGrids, 100
  263.  
  264. return
  265.  
  266.  
  267. f1::
  268. GUI_Base_Create_Static_DB()
  269. return
  270. f2::
  271. ;CreateStaticList()
  272. New_Show_Options()
  273. return
  274.  
  275.  
  276. f3::
  277. Reload
  278. return
  279.  
  280.  
  281. Setup_PlayButton_Grids()
  282. {
  283.  
  284.  
  285.         PlayButton := "Play_Button"
  286.        
  287.         ;MsgBox % Gui_Base_CheckBox_Normal_Name_Array[a_index] . "`n" . StaticNum
  288.        
  289.         cVar := "GUI_Base_PlayButton_VControl_Array"
  290.        
  291.         ;MsgBox % GUI_Base_SliderBar_StaticID[a_index] . " - " . a_index
  292.         Statid_ID := GUI_Base_PlayButton_StaticID[1]
  293.         ;MsgBox % Statid_ID
  294.         OccupyGrids("UI_PlayButton_Normal",Statid_ID , 1, cVar, SliderBarName)
  295.        
  296. }
  297.  
  298.  
  299. GUI_Base_Create_Preview_Button()
  300. {
  301.     global
  302.    
  303.     GUI_Base_PlayButton_Normal := "\GUI_Resources\Controls\UI_PlayButton_Normal.png"
  304.     GUI_Base_PlayButton_Highlighted := "\GUI_Resources\Controls\UI_PlayButton_Highlighted.png"
  305.     GUI_Base_PlayButton_Playing := "\GUI_Resources\Controls\UI_PlayButton_Playing.png"
  306.     Gui, Add , Picture, x650 y20 vGUI_Base_PlayButton_VControl_Array Hidden, %A_WorkingDir%%GUI_Base_PlayButton_Normal%
  307.     Gui, Add , Picture, x650 y20 vGUI_Base_PlayButton_Highlighted_VControl_Array Hidden, %A_WorkingDir%%GUI_Base_PlayButton_Highlighted%
  308.     Gui, Add , Picture, x650 y20 vGUI_Base_PlayButton_Playing_VControl_Array Hidden, %A_WorkingDir%%GUI_Base_PlayButton_Playing%
  309. }
  310.  
  311. Setup_SliderBar_Grids()
  312. {
  313.     Loop, %Gui_Base_SliderBar_Count%
  314.     {
  315.  
  316.         SliderBarName := Gui_Base_SliderBar_Name[a_index]
  317.        
  318.         ;MsgBox % Gui_Base_CheckBox_Normal_Name_Array[a_index] . "`n" . StaticNum
  319.        
  320.         cVar := "GUI_Base_SliderBar_VControl_Array" . a_index
  321.        
  322.         ;MsgBox % GUI_Base_SliderBar_StaticID[a_index] . " - " . a_index
  323.        
  324.         OccupyGrids(SliderBarName, GUI_Base_SliderBar_StaticID[a_index], a_index, cVar, "Volume_Slider")
  325.        
  326.     }
  327. }
  328.  
  329.  
  330.  
  331. Setup_Sliders_Default()
  332. {
  333.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGUIHWND%
  334.  
  335.     SizeX := floor( Width / GUI_Base_Grid )
  336.     SizeY := floor( Height / GUI_Base_Grid )
  337.     ;MsgBox, %MyGUIHWND% %SizeX% %SizeY%
  338.     Loop %SizeX%
  339.     {
  340.         X_Index := a_index
  341.         Loop %SizeY%
  342.         {
  343.             Y_Index := a_index
  344.  
  345.             if  GUI_Icon_Default_Location[X_Index,Y_Index]
  346.             {
  347.                 Loop %Gui_Base_SliderBar_Count%
  348.                 {
  349.                     ;MsgBox % Gui_Base_SliderBar_Name[a_index] . " -===- " . GUI_Icon_Default_Location[X_Index,Y_Index]
  350.                     if ( Gui_Base_SliderBar_Name[a_index] = GUI_Icon_Default_Location[X_Index,Y_Index] )
  351.                     {
  352.                         Place_SliderBar_Single(GUI_Icon_Default_Location[X_Index,Y_Index],a_index, X_Index, Y_Index)
  353.                     }
  354.                 }
  355.             }
  356.         }
  357.     }
  358.     ;MsgBox % c
  359. }
  360. Place_SliderBar_Single(SliderBar, SliderBarIndex, X_Index, Y_Index)
  361. {
  362.     global
  363.     ;Msgbox, Placing SliderBar %SliderBar% index: %SliderBarIndex% in grid %X_Index% %Y_Index%
  364.  
  365.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  366.  
  367.     ;MsgBox % GUI_Base_GridX[X_Index,Y_Index]
  368.     MoveToX := GUI_Base_GridX[X_Index,Y_Index] - 10
  369.     MoveToY := GUI_Base_GridY[X_Index,Y_Index]
  370.    
  371.     ;MsgBox, %MoveToX% %MoveToY%
  372.  
  373.     Coordmode, mouse, screen
  374.     Coordmode, Pixel, screen
  375.  
  376.  
  377.     GUI_ActualSliderBarControlName := "GUI_Base_SliderBar_VControl_Array" . SliderBarIndex
  378.     GUIControl, MoveDraw, %GUI_ActualSliderBarControlName%, x%MoveToX% y%MoveToY%
  379.     GUI_ActualSliderBarIndControlName := "GUI_Base_SliderBar_Indicator_VControl_Array" . SliderBarIndex
  380.     MoveToY := ( MoveToY - 3 )
  381.     GUIControl, MoveDraw, %GUI_ActualSliderBarIndControlName%, x%MoveToX% y%MoveToY%
  382.     GUI_ActualSliderBarIndPressedControlName := "GUI_Base_SliderBar_Indicator_Pressed_VControl_Array" . SliderBarIndex
  383.     GUIControl, MoveDraw, %GUI_ActualSliderBarIndPressedControlName%, x%MoveToX% y%MoveToY%
  384.  
  385.     ;this is the first state so declare it last so we can decide to show it or now
  386.  
  387.     if ( X_Index < 32 )
  388.     {
  389.        
  390.         GUIControl, Show, %GUI_ActualSliderBarControlName%
  391.         GUIControl, Show, %GUI_ActualSliderBarIndControlName%
  392.         ;GUI_Base_SliderBar_Show()
  393.     }
  394.            
  395.         ;GUI_Base_CheckBox_Normal_StaticID
  396.  
  397. }
  398. GUI_Base_AddSlider(Gui_Art, Label)
  399. {
  400.     global
  401.     ;Debug_ToolTip := "Initializing Gui_Base_AddCheckBox " . Gui_Art . " Name " . Name . " index " . CheckBoxIndex
  402.     ;Debug_ToolTip := "Initializing Gui_Base_AddCheckBox " . Name . " index " . CheckBoxIndex . "`n UI_CheckBox_Art_Normal: " . A_WorkingDir . UI_CheckBox_Art_Normal
  403.     Gui_Base_SliderBar_Count := Gui_Base_SliderBar_Count + 1
  404.    
  405.    
  406.     UI_SliderBar_Art_SliderBar                      :=  Gui_Base_SliderBar_Prefix . Gui_Art .                       Gui_Base_SliderBar_Suffix
  407.     UI_SliderBar_Art_SliderBar_Indicator            :=  Gui_Base_SliderBar_Prefix . Gui_Art . "_Indicator" .        Gui_Base_SliderBar_Suffix
  408.     UI_SliderBar_Art_SliderBar_Indicator_Pressed    :=  Gui_Base_SliderBar_Prefix . Gui_Art . "_Indicator_Pressed" . Gui_Base_SliderBar_Suffix
  409.  
  410.     GUI_Base_SliderBar_VControl_Array[Gui_Base_SliderBar_Count]                     := "GUI_Base_SliderBar_VControl_Array" . Gui_Base_SliderBar_Count
  411.     GUI_Base_SliderBar_Indicator_VControl_Array[Gui_Base_SliderBar_Count]           := "GUI_Base_SliderBar_Indicator_VControl_Array" . Gui_Base_SliderBar_Count
  412.     GUI_Base_SliderBar_Indicator_Pressed_VControl_Array[Gui_Base_SliderBar_Count]   := "GUI_Base_SliderBar_Indicator_Pressed_VControl_Array" . Gui_Base_SliderBar_Count
  413.    
  414.     Gui_Base_SliderBar_Name[Gui_Base_SliderBar_Count] := Label
  415.  
  416.     Debug_ToolTip := "Initializing GUI_Base_AddSlider `nName: " . Name . "`nGUI_Base_SliderBar_VControl_Array" . Gui_Base_SliderBar_Count . "`n" . A_WorkingDir . UI_SliderBar_Art_SliderBar
  417.     Debug_ToolTip(Debug_ToolTip, 500)
  418.     Xpos := 50
  419.     Ypos := 50
  420.    
  421.     Gui, Add , Picture, x%Xpos% y%Ypos% vGUI_Base_SliderBar_VControl_Array%Gui_Base_SliderBar_Count% Hidden, %A_WorkingDir%%UI_SliderBar_Art_SliderBar%
  422.     Gui, Add , Picture, x%Xpos% y%Ypos% vGUI_Base_SliderBar_Indicator_VControl_Array%Gui_Base_SliderBar_Count% Hidden, %A_WorkingDir%%UI_SliderBar_Art_SliderBar_Indicator%
  423.     Gui, Add , Picture, x%Xpos% y%Ypos% vGUI_Base_SliderBar_Indicator_Pressed_VControl_Array%Gui_Base_SliderBar_Count% Hidden, %A_WorkingDir%%UI_SliderBar_Art_SliderBar_Indicator_Pressed%
  424.    
  425. }
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433. CreateLabels()
  434. {
  435.  
  436.     global
  437.    
  438.     gui, font,, Arial
  439.     ;gui, font,s8, qtypesquare-Light
  440.     Loop, %Gui_Base_Label_Count%
  441.     {
  442.        
  443.        
  444.         Width := Gui_Base_Label_Width[a_index]
  445.         Height := Gui_Base_Label_Height[a_index]
  446.         Text := Gui_Base_Label_Text[a_index]
  447.         ;MsgBox, %Width% %Height% %Text%
  448.         Gui, Add, Text, BackgroundTrans x0 y0 w%Width% h%Height% c0xF58C46 vGui_Base_Label_VControl_Array%a_index% Hidden, %Text%
  449.     }
  450.  
  451. }
  452. GUI_Base_SaveData_Icons()
  453. {
  454. }
  455. GUI_Base_LoadData_Icons()
  456. {
  457. }
  458.  
  459. Testerr()
  460. {
  461.     global
  462.     Loop %GUI_Base_Icon_Count%
  463.     {
  464.         if !GUI_Base_Icon[a_index]
  465.         {
  466.             ;MsgBox, Breaking out of Root index, no more icons! %a_index%
  467.             break
  468.         }
  469.         Root_index := a_index
  470.         Loop, % GUI_Base_Icon_Frame_Count * 2 + 1
  471.         {
  472.             if !GUI_Base_Icon_ControlList[root_index,a_index]
  473.             {
  474.                 MsgBox, Breaking out of GUI_Base_Icon_ControlList, no more controls! root: %Root_index% current: %a_index%
  475.                 break
  476.             }
  477.             Value := GUI_Base_Icon_ControlList[root_index,a_index]
  478.             ToolTip, Value at: %Root_index% and %a_index% `n %Value%
  479.             Sleep, 1000
  480.  
  481.         }
  482.     }
  483. }
  484.  
  485. Setup_Icons_Default()
  486. {
  487.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGUIHWND%
  488.  
  489.     SizeX := floor( Width / GUI_Base_Grid )
  490.     SizeY := floor( Height / GUI_Base_Grid )
  491.     ;MsgBox, %MyGUIHWND% %SizeX% %SizeY%
  492.     Loop %SizeX%
  493.     {
  494.         X_Index := a_index
  495.         Loop %SizeY%
  496.         {
  497.             Y_Index := a_index
  498.             ;MsgBox % UI_GridDefaultIcon[X_Index,Y_Index]
  499.             if  GUI_Icon_Default_Location[X_Index,Y_Index]
  500.             {
  501.                 ;ToolTip, X: %X_Index% Y: %Y_Index%
  502.             ;   Sleep, 500
  503.  
  504.                 ;ToolTip, Almost.............`n %GBI% `n %UIGDI% `n %GUI_Base_Icon_Count%
  505.                 ;Sleep, 100
  506.                 Loop %GUI_Base_Icon_Count%
  507.                 {
  508.                         GBI := GUI_Base_Icon[a_index]
  509.                         UIGDI := GUI_Icon_Default_Location[X_Index,Y_Index]
  510.                    
  511.                    
  512.                     ;ToolTip, Almost.............`n %GBI% `n %UIGDI% `n %GUI_Base_Icon_Count%
  513.                     ;Sleep, 100
  514.                     ;Sleep 700
  515.                     if ( GUI_Base_Icon[a_index] = GUI_Icon_Default_Location[X_Index,Y_Index] )
  516.                     {
  517.                         ;MsgBox % UI_IconList[a_index] . UI_GridDefaultIcon[X_Index,Y_Index]
  518.                         ;c := c + 1
  519.                         ;ToolTip, Got one!!!!!!
  520.                         ;Sleep, 400
  521.                         PlaceIcon_Single(GUI_Icon_Default_Location[X_Index,Y_Index],a_index, X_Index, Y_Index)
  522.                     }
  523.                 }
  524.             }
  525.         }
  526.     }
  527.     ;MsgBox % c
  528. }
  529.  
  530. PlaceIcon_Single(Icon, IconIndex, X_Index, Y_Index)
  531. {
  532.     global
  533.     ;Msgbox, Placing icon %Icon% index: %IconIndex% in grid %X_Index% %Y_Index%
  534.  
  535.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  536.  
  537.     ;MsgBox % GUI_Base_GridX[X_Index,Y_Index]
  538.  
  539.     MoveToX := GUI_Base_GridX[X_Index,Y_Index] - 40
  540.     MoveToY := GUI_Base_GridY[X_Index,Y_Index] - 40
  541.    
  542.     ;MsgBox, %MoveToX% %MoveToY%
  543.  
  544.     Coordmode, mouse, screen
  545.     Coordmode, Pixel, screen
  546.    
  547.     ;GUI_RelativeX := UI_X + MoveToX
  548.     ;GUI_RelativeY := UI_Y + MoveToY
  549.     ;MouseMove, GUI_RelativeX, GUI_RelativeY
  550.     ;ToolTip % X_Index
  551.  
  552.  
  553.         Loop, % GUI_Base_Icon_Frame_Count
  554.         {
  555.             ;MsgBox % GUI_Base_Icon_Current_Frame[IconIndex] . " compared with looped: " . GUI_Base_Icon_Frame[a_index]
  556.            
  557.             if ( GUI_Base_Icon_Current_Frame[IconIndex] = GUI_Base_Icon_Frame[a_index] )
  558.             {
  559.  
  560.  
  561.                 GUI_ActualIconControlName := "GUI_Base_Main_Icon_ControlVLabel" . IconIndex
  562.                 ;MsgBox % GUI_ActualIconControlName
  563.                 GUIControl, MoveDraw, %GUI_ActualIconControlName%, x%MoveToX% y%MoveToY%
  564.                
  565.                 GUI_ActualFrameName := GUI_Base_Icon_ControlVLabel[IconIndex,a_index]
  566.                 if ( X_Index < 32 )
  567.                 {
  568.                     GUIControl, Show, %GUI_ActualIconControlName%
  569.                     GUIControl, Show, %GUI_ActualFrameName%
  570.                 }
  571.                 GUIControl, MoveDraw, %GUI_ActualFrameName%, x%MoveToX% y%MoveToY%
  572.                 Extra_index := a_index + GUI_Base_Icon_Frame_Count
  573.                 GUI_ActualControlName := GUI_Base_Icon_ControlVLabel[IconIndex,Extra_index]
  574.                 GUIControl, Hide, %GUI_ActualControlName%
  575.             }
  576.             else
  577.             {
  578.                 GUI_ActualControlName := GUI_Base_Icon_ControlVLabel[IconIndex,a_index]
  579.                 GUIControl, Hide, %GUI_ActualControlName%
  580.                 Extra_index := a_index + GUI_Base_Icon_Frame_Count
  581.                 GUI_ActualControlName := GUI_Base_Icon_ControlVLabel[IconIndex,Extra_index]
  582.                 GUIControl, Hide, %GUI_ActualControlName%
  583.             }
  584.         }
  585.  
  586.     StaticId := Gui_Get_StaticID(IconIndex)
  587.     ;MsgBox % Icon
  588.     ;MsgBox % GUI_Base_Icon_StaticID[IconIndex]
  589.     cVar := "GUI_Base_Main_Icon_ControlVLabel" . IconIndex
  590.     OccupyGrids(Icon, StaticId, IconIndex, cVar, "Default_Icon")
  591. }
  592.  
  593. ;Static3    C:\SC2 MiniMap Test\Fresh_Gui\GUI_Resources\Controls\UI_CheckBox_Normal_50.png
  594.  
  595. GUI_Base_Create_Static_DB()
  596. {
  597.     WinGet, ActiveControlList, ControlList, ahk_id %MyGUIHWND%
  598.     Loop, Parse, ActiveControlList, `n
  599.     {
  600.         ControlGetText, theText, %A_LoopField%, ahk_id %MyGUIHWND%
  601.        
  602.         Main_Windows := "\GUI_Resources\Windows\"
  603.         Main_Windows_Suffix := ".png"
  604.        
  605.         StringReplace, Text_Minus_Nonsense, theText, %A_WorkingDir%,,All
  606.        
  607.         GUI_Base_Graphic_StaticID_Database_Path[A_Index] := Text_Minus_Nonsense
  608.         ;MsgBox, %Text_Minus_Nonsense%
  609.        
  610.         StringReplace, Text_Minus_Nonsense, Text_Minus_Nonsense, %GUI_Base_Icon_Suffix%,,All
  611.         StringReplace, Text_Minus_Nonsense, Text_Minus_Nonsense, %GUI_Base_Icon_Prefix%,,All
  612.         StringReplace, Text_Minus_Nonsense, Text_Minus_Nonsense, %GUI_Base_Icon_Frame_Prefix%,,All
  613.         StringReplace, Text_Minus_Nonsense, Text_Minus_Nonsense, %GUI_Base_Icon_Frame_Suffix%,,All
  614.         StringReplace, Text_Minus_Nonsense, Text_Minus_Nonsense, %GUI_Base_CheckBox_Prefix%,,All
  615.         StringReplace, Text_Minus_Nonsense, Text_Minus_Nonsense, %GUI_Base_CheckBox_Suffix%,,All
  616.        
  617.         StringReplace, Text_Minus_Nonsense, Text_Minus_Nonsense, %Main_Windows%,,All
  618.         StringReplace, Text_Minus_Nonsense, Text_Minus_Nonsense, %Main_Windows_Suffix%,,All
  619.        
  620.         ;MsgBox % A_LoopField
  621.         GUI_Base_Graphic_StaticID_Database_Name[A_Index] := Text_Minus_Nonsense
  622.         GUI_Base_Graphic_StaticID_Database_Loopfield[A_Index] := A_LoopField
  623.        
  624.         GUI_Base_Graphic_StaticID_Database_Count := A_Index
  625.        
  626.         ToolTip, A_LoopField: %A_LoopField% `nMyEdit: %Text_Minus_Nonsense%
  627.         ;Sleep, 500
  628.        
  629.         if ( Text_Minus_Nonsense = "UI_PlayButton_Normal" OR Text_Minus_Nonsense = "UI_PlayButton_Highlighted" OR Text_Minus_Nonsense = "UI_PlayButton_Playing" )
  630.         {
  631.             Add_To_Play_Button_DB(A_LoopField, Text_Minus_Nonsense, GUI_Base_Graphic_StaticID_Database_Path[A_Index])
  632.         }
  633.        
  634.         if ( Text_Minus_Nonsense = "Sliderbar_1" OR Text_Minus_Nonsense = "Sliderbar_1_Indicator" OR Text_Minus_Nonsense = "Sliderbar_1_Indicator_Pressed" )
  635.         {
  636.             Add_To_SliderBar_DB(A_LoopField, Text_Minus_Nonsense, GUI_Base_Graphic_StaticID_Database_Path[A_Index])
  637.         }
  638.            
  639.        
  640.         if ( Text_Minus_Nonsense = "UI_CheckBox_Normal" OR Text_Minus_Nonsense = "UI_CheckBox_Normal_Over" OR Text_Minus_Nonsense = "UI_CheckBox_Pressed" OR Text_Minus_Nonsense = "UI_CheckBox_Pressed_Over" OR Text_Minus_Nonsense = "UI_CheckBox_Pressed_Checked" OR  Text_Minus_Nonsense = "UI_CheckBox_Pressed_Over_Checked" OR )
  641.         {
  642.             Add_To_Checkbox_DB(A_LoopField, Text_Minus_Nonsense, GUI_Base_Graphic_StaticID_Database_Path[A_Index])
  643.             continue
  644.         }
  645.        
  646.         root_index := a_index
  647.         Loop %Gui_Base_Label_Count%
  648.         {
  649.             if ( Gui_Base_Label_Text[a_index] = Text_Minus_Nonsense )
  650.             {
  651.                 Add_To_Label_DB(A_LoopField, Text_Minus_Nonsense, GUI_Base_Graphic_StaticID_Database_Path[A_Index])
  652.                 continue
  653.             }
  654.            
  655.         }
  656.         root_index := a_index
  657.         Loop %GUI_Base_Icon_Count%
  658.         {
  659.             if (  GUI_Base_Icon[a_index] = Text_Minus_Nonsense )
  660.             {
  661.                 ;MsgBox % GUI_BaseIcon_Count . " " . GUI_Base_Icon[a_index]
  662.                 GUI_Base_Icon_StaticID[a_index] := A_LoopField
  663.                 GUI_Base_Icon_StaticID_Path[a_index] := GUI_Base_Graphic_StaticID_Database_Path[root_index]
  664.                 break
  665.             }
  666.            
  667.             ;ToolTip % GUI_Base_Icon[a_index] . "  vs  " . Text_Minus_Nonsense
  668.             ;Sleep, 100
  669.         }
  670.  
  671.  
  672.            
  673.         ;GUI_Base_Label_StaticID := []
  674.     }
  675.     ToolTip, Done!
  676. }
  677.  
  678. Add_To_Play_Button_DB(StaticID, PlayButton_Name, Path)
  679. {
  680.         ;ToolTip % StaticID . SliderBar_Name . "`n " . Path . "`n" . GUI_Base_SliderBar_StaticID_Database_Count
  681.         ;Sleep, 2000
  682.        
  683.     if ( PlayButton_Name = "UI_PlayButton_Normal" )
  684.     {
  685.         GUI_Base_PlayButton_StaticID_Database_Count := GUI_Base_PlayButton_StaticID_Database_Count + 1
  686.         GUI_Base_PlayButton_StaticID[GUI_Base_PlayButton_StaticID_Database_Count] := StaticID
  687.         GUI_Base_PlayButton_StaticID_Path[GUI_Base_PlayButton_StaticID_Database_Count] := Path
  688.  
  689.     }
  690.    
  691.     if ( PlayButton_Name = "UI_PlayButton_Highlighted" )
  692.     {
  693.         GUI_Base_PlayButton_Highlighted_StaticID[GUI_Base_PlayButton_StaticID_Database_Count] := StaticID
  694.         GUI_Base_PlayButton_Highlighted_StaticID_Path[GUI_Base_PlayButton_StaticID_Database_Count] := Path
  695.     }
  696.    
  697.     if ( PlayButton_Name = "UI_PlayButton_Playing" )
  698.     {
  699.         GUI_Base_PlayButton_Playing_StaticID[GUI_Base_PlayButton_StaticID_Database_Count] := StaticID
  700.         GUI_Base_PlayButton_Playing_StaticID_Path[GUI_Base_PlayButton_StaticID_Database_Count] := Path
  701.     }
  702.    
  703. }
  704.  
  705. GUI_Base_Hide_Icon()
  706. {
  707. }
  708. GUI_Base_Show_Icon(IconIndex)
  709. {
  710.    
  711. }
  712. New_Show_Options()
  713. {
  714.     global
  715.     GUI_Base_Window_Frame_Size := 30
  716.     ControlGetPos, UI_X, UI_Y, UI_Width, UI_Height, Static2, ahk_id %MyGuiHWND%, , ,
  717.     ;MsgBox, %UI_X% %UI_Y% %UI_Width% %UI_Height%
  718.    
  719.  
  720.     Loop %GUI_Base_Icon_Count%
  721.     {
  722.         control := GUI_Base_Icon_StaticID[a_index]
  723.         controlPath := GUI_Base_Icon_StaticID_Path[a_index]
  724.         ;StringReplace, StaticNum, control, Static,,All
  725.         ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %control%, ,%controlPath% , ,
  726.         ;
  727.        
  728.         if ( Icon_X > ( UI_X + UI_Width - GUI_Base_Window_Frame_Size ) )
  729.         {
  730.             ;MsgBox % "Icon outside small frame " . GUI_Base_Icon[a_index] . "`n" . control . "`ncontrolPath: " . controlPath . "`n" . StaticNum . "`nIcon: " . Icon_X . " " . Icon_Y . " " . Icon_Width . " " . Icon_Height . "`nWindow: " . UI_X . " " . UI_Y . " " . UI_Width . " " . UI_Height
  731.             GUI_ActualIconControlName := "GUI_Base_Main_Icon_ControlVLabel" . a_index
  732.             msgbox % GUI_ActualIconControlName
  733.             GUI_Base_Icon_StaticID[a_index]
  734.             GUIControl, Show, %GUI_ActualIconControlName%
  735.             GUIControl, MoveDraw, %GUI_ActualIconControlName%, x%Icon_X% y%Icon_Y%
  736.         }
  737.     }
  738. }
  739. New_Hide_Options()
  740. {
  741.         GUI_Base_Window_Frame_Size := 30
  742.         ControlGetPos, UI_X, UI_Y, UI_Width, UI_Height, Static2, ahk_id %MyGuiHWND%, , ,
  743.         ;MsgBox, %UI_X% %UI_Y% %UI_Width% %UI_Height%
  744.        
  745.    
  746.         Loop %GUI_Base_Icon_Count%
  747.         {
  748.             control := GUI_Base_Icon_StaticID[a_index]
  749.             controlPath := GUI_Base_Icon_StaticID_Path[a_index]
  750.             ;StringReplace, StaticNum, control, Static,,All
  751.             ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %control%, ,%controlPath% , ,
  752.             ;MsgBox % GUI_Base_Icon[a_index] . "`n" . control . "`ncontrolPath: " . controlPath . "`n" . StaticNum . "`nIcon: " . Icon_X . " " . Icon_Y . " " . Icon_Width . " " . Icon_Height . "`nWindow: " . UI_X . " " . UI_Y . " " . UI_Width . " " . UI_Height
  753.            
  754.             if ( Icon_X > ( UI_X + UI_Width - GUI_Base_Window_Frame_Size ) )
  755.             {
  756.                 ;MsgBox % GUI_Base_Main_Icon_ControlVLabel[a_index]
  757.                 ;Gui_To_Hide := GUI_Base_Main_Icon_ControlVLabel[a_index]
  758.                 ;GuiControl Hide, %Gui_To_Hide%
  759.                 ;GUI_Base_Hide_Icon_Frame(IconIndex,Static)
  760.                
  761.                
  762.                 GUI_ActualIconControlName := "GUI_Base_Main_Icon_ControlVLabel" . a_index
  763.                 MsgBox % GUI_ActualIconControlName
  764.                 GUIControl, Hide, %GUI_ActualIconControlName%
  765.                 GUIControl, MoveDraw, %GUI_ActualIconControlName%, x0 y0
  766.  
  767.                
  768.             }
  769.        
  770.        
  771.  
  772.         }
  773. }
  774.  
  775. Pass_It(Icon, StaticId, IconIndex, ByRef Output)
  776. {
  777.     ;StaticId := "Static" . StaticId
  778.     ;MsgBox, Occupy Time %Icon% Static: %StaticId%
  779.    
  780.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  781.     GuiControlGet, MyEdit,, %StaticId%
  782.     ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %StaticId%
  783.     Output := Icon_X
  784. }
  785.  
  786.  
  787. Add_To_Icon_DB(StaticIndex, Label)
  788. {
  789.     Current_Label := 1
  790.     GUI_Base_Label_StaticID[Current_Label] := StaticIndex
  791.     Loop %Gui_Base_Label_Count%
  792.     {
  793.         Current_Label := Current_Label + 1
  794.         Current_Static := ( StaticIndex + a_index )
  795.         GUI_Base_Icon_StaticID[Current_Label] := Current_Static
  796.         ;ToolTip % "GUI_Base_Label_StaticID[ " . Current_Label . " ] = " . GUI_Base_Label_StaticID[Current_Label]
  797.     }
  798.     Loop %GUI_Base_Icon_Count%
  799.     {
  800.         ControlGetPos, UI_X, UI_Y, Width, Height, Static1, , , ,
  801.             GuiControlGet, Clicked_Control_Path,, %control%
  802.             ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %control%, ,%Clicked_Control_Path% , ,
  803.        
  804.         GUI_Base_Hide_Icon_Frame(IconIndex,Static)
  805.     }
  806.     Loop %Gui_Base_CheckBox_Count%
  807.     {
  808.         ControlGetPos, UI_X, UI_Y, Width, Height, Static1, , , ,
  809.     }
  810.  
  811.  
  812.  
  813. }
  814. Add_To_Label_DB(StaticID, Label_Name, Path)
  815. {
  816.     GUI_Base_Label_StaticID_Database_Count := GUI_Base_Label_StaticID_Database_Count + 1
  817.     GUI_Base_Label_StaticID[GUI_Base_Label_StaticID_Database_Count] := StaticID
  818.     GUI_Base_Label_StaticID_Path[GUI_Base_Label_StaticID_Database_Count] := Path
  819.  
  820.     ;ToolTip % GUI_Base_Label_StaticID_Database_Count . Label_Name . "`n " . GUI_Base_Label_StaticID[GUI_Base_Label_StaticID_Database_Count] . "`n" . GUI_Base_Label_StaticID_Path[GUI_Base_Label_StaticID_Database_Count]
  821.     ;Sleep, 1000
  822. }
  823.  
  824. Add_To_SliderBar_DB(StaticID, SliderBar_Name, Path)
  825. {
  826.         ;ToolTip % StaticID . SliderBar_Name . "`n " . Path . "`n" . GUI_Base_SliderBar_StaticID_Database_Count
  827.         ;Sleep, 1000
  828.     if ( SliderBar_Name = "SliderBar_1" )
  829.     {
  830.         GUI_Base_SliderBar_StaticID_Database_Count := GUI_Base_SliderBar_StaticID_Database_Count + 1
  831.         GUI_Base_SliderBar_StaticID[GUI_Base_SliderBar_StaticID_Database_Count] := StaticID
  832.         GUI_Base_SliderBar_StaticID_Path[GUI_Base_SliderBar_StaticID_Database_Count] := Path
  833.  
  834.     }
  835.    
  836.     if ( SliderBar_Name = "Sliderbar_1_Indicator" )
  837.     {
  838.         GUI_Base_SliderBar_Indicator_StaticID[GUI_Base_SliderBar_StaticID_Database_Count] := StaticID
  839.         GUI_Base_SliderBar_Indicator_StaticID_Path[GUI_Base_SliderBar_StaticID_Database_Count] := Path
  840.     }
  841.    
  842.     if ( SliderBar_Name = "Sliderbar_1_Indicator_Pressed" )
  843.     {
  844.         GUI_Base_SliderBar_Indicator_Pressed_StaticID[GUI_Base_SliderBar_StaticID_Database_Count] := StaticID
  845.         GUI_Base_SliderBar_Indicator_Pressed_StaticID_Path[GUI_Base_SliderBar_StaticID_Database_Count] := Path
  846.     }
  847.    
  848. }
  849.  
  850. Add_To_Checkbox_DB(StaticID, CheckBox_Name, Path)
  851. {
  852.    
  853.     if ( CheckBox_Name = "UI_CheckBox_Normal" )
  854.     {
  855.         GUI_Base_CheckBox_StaticID_Database_Count := GUI_Base_CheckBox_StaticID_Database_Count + 1
  856.         GUI_Base_CheckBox_Normal_StaticID[GUI_Base_CheckBox_StaticID_Database_Count] := StaticID
  857.         GUI_Base_CheckBox_Normal_StaticID_Path[GUI_Base_CheckBox_StaticID_Database_Count] := Path
  858.         ;ToolTip % GUI_Base_CheckBox_StaticID_Database_Count . CheckBox_Name . "`n " . GUI_Base_CheckBox_Normal_StaticID[GUI_Base_CheckBox_StaticID_Database_Count] . "`n" . GUI_Base_CheckBox_Normal_StaticID_Path[GUI_Base_CheckBox_StaticID_Database_Count]
  859.         ;Sleep, 1000
  860.     }
  861.    
  862.     if ( CheckBox_Name = "UI_CheckBox_Normal_Over" )
  863.     {
  864.         GUI_Base_CheckBox_Normal_Over_StaticID[GUI_Base_CheckBox_StaticID_Database_Count] := StaticID
  865.         GUI_Base_CheckBox_Normal_Over_StaticID_Path[GUI_Base_CheckBox_StaticID_Database_Count] := Path
  866.     }
  867.    
  868.     if ( CheckBox_Name = "UI_CheckBox_Pressed" )
  869.     {
  870.         GUI_Base_CheckBox_Pressed_StaticID[GUI_Base_CheckBox_StaticID_Database_Count] := StaticID
  871.         GUI_Base_CheckBox_Pressed_StaticID_Path[GUI_Base_CheckBox_StaticID_Database_Count] := Path
  872.     }
  873.  
  874.     if ( CheckBox_Name = "UI_CheckBox_Pressed_Checked" )
  875.     {
  876.         GUI_Base_CheckBox_Pressed_Checked_StaticID[GUI_Base_CheckBox_StaticID_Database_Count] := StaticID
  877.         GUI_Base_CheckBox_Pressed_Checked_StaticID_Path[GUI_Base_CheckBox_StaticID_Database_Count] := Path
  878.     }
  879.  
  880.     if ( CheckBox_Name = "UI_CheckBox_Pressed_Over" )
  881.     {
  882.         GUI_Base_CheckBox_Pressed_Over_StaticID[GUI_Base_CheckBox_StaticID_Database_Count] := StaticID
  883.         GUI_Base_CheckBox_Pressed_Over_StaticID_Path[GUI_Base_CheckBox_StaticID_Database_Count] := Path
  884.     }
  885.    
  886.     if ( CheckBox_Name = "UI_CheckBox_Pressed_Over_Checked" )
  887.     {
  888.         GUI_Base_CheckBox_Pressed_Over_Checked_StaticID[GUI_Base_CheckBox_StaticID_Database_Count] := StaticID
  889.         GUI_Base_CheckBox_Pressed_Over_Checked_StaticID_Path[GUI_Base_CheckBox_StaticID_Database_Count] := Path
  890.     }
  891.    
  892. }
  893.  
  894.  
  895. ;global GUI_Base_Graphic_StaticID_Database_Name := []
  896. ;GUI_Base_Graphic_StaticID_Database_Name := []
  897. ;GUI_Base_Graphic_StaticID_Database_Path := []
  898. ;global GUI_Base_Graphic_IndexByStaticID := []
  899. Gui_Get_StaticID_Last()
  900. {
  901.     WinGet, ActiveControlList, ControlList, ahk_id %MyGUIHWND%
  902.     Loop, Parse, ActiveControlList, `n
  903.     {
  904.         Last := a_index
  905.     }
  906.     return Last
  907. }
  908. Gui_Get_StaticID(IconIndex)
  909. {
  910.     VLabel := "GUI_Base_Main_Icon_ControlVLabel" . IconIndex
  911.     GuiControlGet, VLabel_Path,,%VLabel%,,,
  912.     ;MsgBox, Looking for %VLabel_Path%
  913.    
  914.     WinGet, ActiveControlList, ControlList, ahk_id %MyGUIHWND%
  915.     Loop, Parse, ActiveControlList, `n
  916.     {
  917.        
  918.         GuiControlGet, MyEdit,,%A_LoopField%,,,
  919.         ControlGetText, theText, %A_LoopField%, ahk_id %MyGUIHWND%
  920.         if ( theText = VLabel_Path )
  921.         {
  922.             return A_LoopField
  923.         }
  924.     }
  925. }
  926. GUI_Initialize_Icons()
  927. {
  928.     global
  929.  
  930.     XOffset := 40
  931.     YOffset := 30
  932.     Xpos := 0
  933.     Ypos := 0
  934.     Loop
  935.     {
  936.         root_index := a_index
  937.        
  938.         if !GUI_Base_Icon_ControlVLabel[root_index]
  939.         {
  940.                 ;MsgBox % "Breaking out of ROOT Initialize_Icons loop, no control label! " . root_index
  941.                 break
  942.         }
  943.        
  944.         frame_counter := 0
  945.         Loop, % GUI_Base_Icon_Frame_Count
  946.         {
  947.             if !GUI_Base_Icon_ControlName[root_index,a_index]
  948.             {
  949.                 MsgBox, "Breaking out of 1st Frame loop, no control name! Root: " . root_index . "Current: " . a_index
  950.                 break
  951.             }
  952.  
  953.                 Debug_ToolTip := "Creating Icon Frame: " . GUI_Base_Icon_ControlVLabel[root_index,a_index] . " in location " . root_index . ", " . a_index
  954.                 Debug_ToolTip(Debug_ToolTip, 10)
  955.                 GUI_Graphic := GUI_Base_Icon_Frame_Prefix . GUI_Base_Icon_Frame[a_index] . "_normal" . GUI_Base_Icon_Frame_Suffix
  956.                 ;MsgBox, %GUI_Graphic%
  957.                 MyLabel := GUI_Base_Icon_ControlVLabel[root_index,a_index]
  958.                 ;MsgBox, %A_WorkingDir%%GUI_Graphic% `n`n %MyLabel%
  959.                 ;MsgBox, %MyLabel%
  960.                 GUI, Add , Picture, x%Xpos% y%Ypos% v%MyLabel% AltSubmit BackgroundTrans Hidden, %A_WorkingDir%%GUI_Graphic%
  961.         }
  962.         Loop, % GUI_Base_Icon_Frame_Count
  963.         {
  964.             if !GUI_Base_Icon_ControlName[root_index,a_index]
  965.             {
  966.                 MsgBox, "Breaking out of 2nd Frame loop, no control name! Root: " . root_index . "Current: " . a_index
  967.                 break
  968.             }
  969.            
  970.             frame_counter := ( a_index + GUI_Base_Icon_Frame_Count )
  971.            
  972.             Debug_ToolTip := "Creating Icon Frame: " . GUI_Base_Icon_ControlName[root_index,frame_counter] . " in location " . root_index . ", " . frame_counter
  973.             Debug_ToolTip(Debug_ToolTip, 10)
  974.             GUI_Graphic := GUI_Base_Icon_Frame_Prefix . GUI_Base_Icon_Frame[a_index] . "_highlighted" . GUI_Base_Icon_Frame_Suffix
  975.            
  976.             MyLabel := GUI_Base_Icon_ControlVLabel[root_index,frame_counter]
  977.             ;MsgBox, %A_WorkingDir%%GUI_Graphic% `n`n %MyLabel%
  978.             GUI, Add , Picture,  x%Xpos% y%Ypos% v%MyLabel%  AltSubmit BackgroundTrans Hidden, %A_WorkingDir%%GUI_Graphic%
  979.         }
  980.        
  981.     }
  982.    
  983.     Loop
  984.     {
  985.         ;MsgBox % "looping icons" . a_index . GUI_Base_Icon[a_index]
  986.         if !GUI_Base_Icon[a_index]
  987.             break
  988.        
  989.  
  990.             Xpos := ( ( a_index * XOffset ) )
  991.             Ypos := ( ( 1 * YOffset ) + ( ( 1 * YOffset ) / 4 ) )
  992.             Debug_ToolTip := "Creating Icon: " . GUI_Base_Icon[a_index] . " in location " . root_index . ", " . a_index
  993.             Debug_ToolTip(Debug_ToolTip, 10)
  994.             GUI_Graphic := GUI_Base_Icon_Prefix . GUI_Base_Icon[a_index] . GUI_Base_Icon_Suffix
  995.             ;MyLabel := GUI_Base_Main_Icon_ControlVLabel[a_index]
  996.             ;MsgBox, %GUI_Graphic% `n`n %MyLabel%
  997.             GUI, Add , Picture,  x%Xpos% y%Ypos% vGUI_Base_Main_Icon_ControlVLabel%a_index% AltSubmit BackgroundTrans Hidden, %A_WorkingDir%%GUI_Graphic%
  998.     }
  999.  
  1000.    
  1001. }
  1002.  
  1003. UI_MainWindowClicked()
  1004. {
  1005.     if !GUI_Options_Lock_Window
  1006.     {
  1007.     CoordMode, Pixel, Screen
  1008.     Coordmode, mouse, screen
  1009.     MouseGetPos, , , id, control
  1010.    
  1011.         TC := A_TickCount
  1012.         Loop,
  1013.         {
  1014.             ;WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %id%
  1015.             ;ToolTip, Clicking on main window!
  1016.             MouseDown := GetKeyState("LButton","P")
  1017.             If (!MouseDown)
  1018.             {
  1019.                  Break
  1020.             }
  1021.             MouseGetPos, xpos, ypos
  1022.             if a_index > 1
  1023.             {
  1024.                 ;ToolTip, %a_index% PREVIOUS X FOUND
  1025.                 ;Sleep, 1000
  1026.                 MouseMovedX := xpos - PreviousX
  1027.                 MouseMovedY := ypos - PreviousY
  1028.  
  1029.                 ;ToolTip, X: %MouseMovedX% Y: %MouseMovedY%
  1030.                 WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %id%
  1031.  
  1032.                 offsetX := UI_X - PreviousX
  1033.                 offsetY := UI_Y - PreviousY
  1034.                 if ( MouseMovedX OR MouseMovedY )
  1035.                 {
  1036.                     if (xpos != PreviousX OR ypos != PreviousY )
  1037.                     {
  1038.                         ;ToolTip the mouse moved!
  1039.                         NewX := UI_X + MouseMovedX
  1040.                         NewY := UI_Y + MouseMovedY
  1041.                         GUI, Show,x%NewX% y%NewY%
  1042.                     }
  1043.                 }
  1044.             }
  1045.             PreviousX := xpos
  1046.             PreviousY := ypos
  1047.  
  1048.             ;ToolTip, %x% %y% %width% %height% `nOfffsets: %offsetX% and %offsetY% `nPrevious X&Y: %PreviousX% %PreviousY%
  1049.             ;Sleep, 10
  1050.  
  1051.             ;MouseGetPos, , , WhichWindow, WhichControl
  1052.             ;ControlGetPos, x, y, w, h, %WhichControl%, ahk_id %WhichWindow%
  1053.  
  1054.             ;ToolTip, %WhichControl%`nX%X%`tY%Y%`nW%W%`t%H%
  1055.             ;WinGetPos, X, Y, Width, Height, ahk_id %id%
  1056.  
  1057.  
  1058.         }
  1059.     }
  1060. }
  1061. GUI_Base_Create_Main_Window(X,Y)
  1062. {
  1063.     GUI,  New, +Sysmenu +LastFound -Caption +AlwaysOnTop +ToolWindow -Border HwndMyGUIHWND
  1064.     GUI, Margin , 0, 0
  1065.     GUI, Color, 0x000000
  1066.     ;MsgBox % OutputVar
  1067.  
  1068.     Small_Window_Frame := "\GUI_Resources\Windows\UI_Small_Window.png"
  1069.    
  1070.     Big_Window_Frame := "\GUI_Resources\Windows\UI_OptionsWindow.png"
  1071.     GUI, Add , Picture, x0 y0 vBig_Window_Frame gGUI_Big_Window_Frame_Clicked AltSubmit BackgroundTrans Hidden, %A_WorkingDir%%Big_Window_Frame%
  1072.     GUI, Add , Picture, x0 y0 vSmall_Window_Frame gGUI_Big_Window_Frame_Clicked AltSubmit BackgroundTrans, %A_WorkingDir%%Small_Window_Frame%
  1073.    
  1074.     ;GUI, Add , Picture, x0 y0 vBig_Window gGUI_Big_Window_Fill_Clicked AltSubmit BackgroundTrans, %A_WorkingDir%%Big_Window_Fill%
  1075.     ;GUI, Show
  1076.     ;WinSet, TransColor, 0x000000
  1077.    
  1078.     ;MyGUIHWND := WinExist()
  1079.     ;MsgBox, MyGUIHWND %MyGUIHWND%
  1080. }
  1081.  
  1082. GUI_Base_Create_Main_Window_Border()
  1083. {
  1084.     global
  1085.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  1086.    
  1087.    
  1088. }
  1089.  
  1090. ;not ussing this
  1091. ;GUI_Base_Icon_ControlName[root_index,frame_counter] :=  GUI_Base_Icon_Frame[a_index] . "_normal"
  1092.  
  1093. Gui_Base_AddCheckBox(Gui_Art, Name, Label, Width, Height)
  1094. {
  1095.     global
  1096.     ;Debug_ToolTip := "Initializing Gui_Base_AddCheckBox " . Gui_Art . " Name " . Name . " index " . CheckBoxIndex
  1097.     ;Debug_ToolTip := "Initializing Gui_Base_AddCheckBox " . Name . " index " . CheckBoxIndex . "`n UI_CheckBox_Art_Normal: " . A_WorkingDir . UI_CheckBox_Art_Normal
  1098.     Gui_Base_CheckBox_Count := Gui_Base_CheckBox_Count + 1
  1099.    
  1100.    
  1101.     UI_CheckBox_Art_Normal               := Gui_Base_CheckBox_Prefix . Gui_Art . "_Normal" .                Gui_Base_CheckBox_Suffix
  1102.     UI_CheckBox_Art_Normal_Over          := Gui_Base_CheckBox_Prefix . Gui_Art . "_Normal_Over" .           Gui_Base_CheckBox_Suffix
  1103.     UI_CheckBox_Art_Pressed              := Gui_Base_CheckBox_Prefix . Gui_Art . "_Pressed" .               Gui_Base_CheckBox_Suffix
  1104.     UI_CheckBox_Art_Pressed_Over         := Gui_Base_CheckBox_Prefix . Gui_Art . "_Pressed_Over" .          Gui_Base_CheckBox_Suffix
  1105.     UI_CheckBox_Art_Pressed_Checked      := Gui_Base_CheckBox_Prefix . Gui_Art . "_Pressed_Checked" .       Gui_Base_CheckBox_Suffix
  1106.     UI_CheckBox_Art_Pressed_Over_Checked := Gui_Base_CheckBox_Prefix . Gui_Art . "_Pressed_Over_Checked" .  Gui_Base_CheckBox_Suffix
  1107.  
  1108.     Gui_Base_CheckBox_Normal_Name_Array[Gui_Base_CheckBox_Count]            := Name
  1109.     Gui_Base_CheckBox_Normal_Array[Gui_Base_CheckBox_Count]                 := UI_CheckBox_Art_Normal
  1110.     Gui_Base_CheckBox_Normal_Over_Array[Gui_Base_CheckBox_Count]            := UI_CheckBox_Art_Normal_Over
  1111.     Gui_Base_CheckBox_Pressed_Array[Gui_Base_CheckBox_Count]                := UI_CheckBox_Art_Pressed
  1112.     Gui_Base_CheckBox_Pressed_Over_Array[Gui_Base_CheckBox_Count]           := UI_CheckBox_Art_Pressed_Over
  1113.     Gui_Base_CheckBox_Pressed_Checked_Array[Gui_Base_CheckBox_Count]        := UI_CheckBox_Art_Pressed_Checked
  1114.     Gui_Base_CheckBox_Pressed_Over_Checked_Array[Gui_Base_CheckBox_Count]   := UI_CheckBox_Art_Pressed_Over_Checked
  1115.    
  1116.    
  1117.     Gui_Base_Label_Count := Gui_Base_Label_Count + 1
  1118.     Gui_Base_Label_Text[Gui_Base_CheckBox_Count] := Label
  1119.     Gui_Base_Label_Width[Gui_Base_CheckBox_Count] := Width
  1120.     Gui_Base_Label_Height[Gui_Base_CheckBox_Count] := Height
  1121.     Gui_Base_Label_VControl_Array[Gui_Base_CheckBox_Count] := "Gui_Base_Label_VControl_Array" . Gui_Base_CheckBox_Count
  1122.  
  1123.     Debug_ToolTip := "Initializing Gui_Base_AddCheckBox `nName: " . Name . "`nGui_Base_CheckBox_Normal_Array" . Gui_Base_CheckBox_Count . "`n" . A_WorkingDir . UI_CheckBox_Art_Normal
  1124.     Debug_ToolTip(Debug_ToolTip, 500)
  1125.     Xpos := 0
  1126.     Ypos := 0
  1127.    
  1128.     Gui, Add , Picture, x%Xpos% y%Ypos% vGui_Base_CheckBox_Normal_Array%Gui_Base_CheckBox_Count% Hidden, %A_WorkingDir%%UI_CheckBox_Art_Normal%
  1129.     Gui, Add , Picture, x%Xpos% y%Ypos% vGui_Base_CheckBox_Normal_Over_Array%Gui_Base_CheckBox_Count% Hidden, %A_WorkingDir%%UI_CheckBox_Art_Normal_Over%
  1130.     Gui, Add , Picture, x%Xpos% y%Ypos% vGui_Base_CheckBox_Pressed_Array%Gui_Base_CheckBox_Count% Hidden, %A_WorkingDir%%UI_CheckBox_Art_Pressed%
  1131.     Gui, Add , Picture, x%Xpos% y%Ypos% vGui_Base_CheckBox_Pressed_Over_Array%Gui_Base_CheckBox_Count% Hidden, %A_WorkingDir%%UI_CheckBox_Art_Pressed_Over%
  1132.     Gui, Add , Picture, x%Xpos% y%Ypos% vGui_Base_CheckBox_Pressed_Checked_Array%Gui_Base_CheckBox_Count% Hidden, %A_WorkingDir%%UI_CheckBox_Art_Pressed_Checked%
  1133.     Gui, Add , Picture, x%Xpos% y%Ypos% vGui_Base_CheckBox_Pressed_Over_Checked_Array%Gui_Base_CheckBox_Count% Hidden, %A_WorkingDir%%UI_CheckBox_Art_Pressed_Over_Checked%
  1134.    
  1135. }
  1136.  
  1137. Setup_CheckBoxes_Default()
  1138. {
  1139.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGUIHWND%
  1140.  
  1141.     SizeX := floor( Width / GUI_Base_Grid )
  1142.     SizeY := floor( Height / GUI_Base_Grid )
  1143.     ;MsgBox, %MyGUIHWND% %SizeX% %SizeY%
  1144.     Loop %SizeX%
  1145.     {
  1146.         X_Index := a_index
  1147.         Loop %SizeY%
  1148.         {
  1149.             Y_Index := a_index
  1150.             ;MsgBox % UI_GridDefaultIcon[X_Index,Y_Index]
  1151.             if  GUI_Icon_Default_Location[X_Index,Y_Index]
  1152.             {
  1153.                 ;ToolTip, X: %X_Index% Y: %Y_Index%
  1154.             ;   Sleep, 500
  1155.  
  1156.                 ;ToolTip, Almost.............`n %GBI% `n %UIGDI% `n %GUI_Base_Icon_Count%
  1157.                 ;Sleep, 100
  1158.                 Loop %Gui_Base_CheckBox_Count%
  1159.                 {
  1160.                         GBI := GUI_Base_Icon[a_index]
  1161.                         UIGDI := GUI_Icon_Default_Location[X_Index,Y_Index]
  1162.                    
  1163.                    
  1164.                     ;ToolTip, Almost.............`n %GBI% `n %UIGDI% `n %GUI_Base_Icon_Count%
  1165.                     ;Sleep, 100
  1166.                     ;Sleep 700
  1167.                     if ( Gui_Base_CheckBox_Normal_Name_Array[a_index] = GUI_Icon_Default_Location[X_Index,Y_Index] )
  1168.                     {
  1169.                         ;MsgBox % Gui_Base_CheckBox_Normal_Name_Array[a_index] . GUI_Icon_Default_Location[X_Index,Y_Index]
  1170.                         ;c := c + 1
  1171.                         ;ToolTip, Got one!!!!!!
  1172.                         ;Sleep, 400
  1173.                         PlaceCheckBox_Single(GUI_Icon_Default_Location[X_Index,Y_Index],a_index, X_Index, Y_Index)
  1174.                     }
  1175.                 }
  1176.             }
  1177.         }
  1178.     }
  1179.     ;MsgBox % c
  1180. }
  1181. PlaceCheckBox_Single(CheckBox, CheckBoxIndex, X_Index, Y_Index)
  1182. {
  1183.     global
  1184.     ;Msgbox, Placing CheckBox %CheckBox% index: %CheckBoxIndex% in grid %X_Index% %Y_Index%
  1185.  
  1186.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  1187.  
  1188.     ;MsgBox % GUI_Base_GridX[X_Index,Y_Index]
  1189.     MoveToX := GUI_Base_GridX[X_Index,Y_Index] - 10
  1190.     MoveToY := GUI_Base_GridY[X_Index,Y_Index]
  1191.    
  1192.     ;MsgBox, %MoveToX% %MoveToY%
  1193.  
  1194.     Coordmode, mouse, screen
  1195.     Coordmode, Pixel, screen
  1196.    
  1197.     ;GUI_RelativeX := UI_X + MoveToX
  1198.     ;GUI_RelativeY := UI_Y + MoveToY
  1199.     ;MouseMove, GUI_RelativeX, GUI_RelativeY
  1200.     ;ToolTip % X_Index
  1201.  
  1202.  
  1203.  
  1204.             ;MsgBox % GUI_Base_Icon_Current_Frame[IconIndex] . " compared with looped: " . GUI_Base_Icon_Frame[a_index]
  1205.  
  1206.  
  1207.                 GUI_ActualCheckBoxControlName := "Gui_Base_CheckBox_Normal_Over_Array" . CheckBoxIndex
  1208.                 GUIControl, MoveDraw, %GUI_ActualCheckBoxControlName%, x%MoveToX% y%MoveToY%
  1209.                 GUI_ActualCheckBoxControlName := "Gui_Base_CheckBox_Pressed_Array" . CheckBoxIndex
  1210.                 GUIControl, MoveDraw, %GUI_ActualCheckBoxControlName%, x%MoveToX% y%MoveToY%
  1211.  
  1212.                 GUI_ActualCheckBoxControlName := "Gui_Base_CheckBox_Pressed_Over_Array" . CheckBoxIndex
  1213.                 GUIControl, MoveDraw, %GUI_ActualCheckBoxControlName%, x%MoveToX% y%MoveToY%
  1214.                 GUI_ActualCheckBoxControlName := "Gui_Base_CheckBox_Pressed_Checked_Array" . CheckBoxIndex
  1215.                 GUIControl, MoveDraw, %GUI_ActualCheckBoxControlName%, x%MoveToX% y%MoveToY%
  1216.                 GUI_ActualCheckBoxControlName := "Gui_Base_CheckBox_Pressed_Over_Checked_Array" . CheckBoxIndex
  1217.                 GUIControl, MoveDraw, %GUI_ActualCheckBoxControlName%, x%MoveToX% y%MoveToY%
  1218.            
  1219.            
  1220.                 ;this is the first state so declare it last so we can decide to show it or not
  1221.                 GUI_ActualCheckBoxControlName := "Gui_Base_CheckBox_Normal_Array" . CheckBoxIndex
  1222.                 GUIControl, MoveDraw, %GUI_ActualCheckBoxControlName%, x%MoveToX% y%MoveToY%
  1223.                
  1224.                
  1225.                 GUI_ActualCheckBoxLabelName := "Gui_Base_Label_VControl_Array" . CheckBoxIndex
  1226.                
  1227.                 X_Index := X_Index + 1
  1228.                 MoveToX := GUI_Base_GridX[X_Index,Y_Index]
  1229.                 GUIControl, MoveDraw, %GUI_ActualCheckBoxLabelName%, x%MoveToX% y%MoveToY%
  1230.  
  1231.                 if ( X_Index < 32 )
  1232.                 {
  1233.                    
  1234.                     GUIControl, Show, %GUI_ActualCheckBoxControlName%
  1235.                     GUIControl, Show, %GUI_ActualCheckBoxLabelName%
  1236.                     GUI_Base_CheckBox_Show()
  1237.                 }
  1238.            
  1239.         ;GUI_Base_CheckBox_Normal_StaticID
  1240.  
  1241. }
  1242. GUI_Base_CheckBox_Show()
  1243. {
  1244.    
  1245. }
  1246.  
  1247. Setup_CheckBoxes_Grids()
  1248. {
  1249.     Loop, %Gui_Base_CheckBox_Count%
  1250.     {
  1251.  
  1252.         CheckBoxName := Gui_Base_CheckBox_Normal_Name_Array[a_index]
  1253.        
  1254.         ;MsgBox % Gui_Base_CheckBox_Normal_Name_Array[a_index] . "`n" . StaticNum
  1255.        
  1256.         cVar := "Gui_Base_CheckBox_Normal_Array" . a_index
  1257.        
  1258.         OccupyGrids(CheckBoxName, GUI_Base_CheckBox_Normal_StaticID[a_index], a_index, cVar, "Default_Checkbox")
  1259.        
  1260.        
  1261.         Label_Name := Gui_Base_Label_Text[a_index]
  1262.         Label_StaticId := GUI_Base_Label_StaticID[a_index]
  1263.         ;StringReplace, Label_StaticId, Label_StaticId, Static,,All
  1264.         ;MsgBox %Label_StaticId%
  1265.         cVar := "Gui_Base_Label_VControl_Array" . a_index
  1266.         OccupyGrids(Label_Name, Label_StaticId, a_index, cVar, "Default_Label")
  1267.     }
  1268. }
  1269. GUI_Base_AddIcon_Frame(Name)
  1270. {
  1271.     Loop
  1272.     {
  1273.         if !GUI_Base_Icon_Frame[a_index]
  1274.         {
  1275.             Debug_ToolTip := "Initializing GUI_Base_Icon_Frame: " . Name . " in location: " . a_index
  1276.             Debug_ToolTip(Debug_ToolTip, 10)
  1277.             GUI_Base_Icon_Frame_Count := GUI_Base_Icon_Frame_Count + 1
  1278.             GUI_Base_Icon_Frame[a_index] := Name
  1279.             break
  1280.         }
  1281.     }
  1282. }
  1283. GUI_Base_AddIcon(Name,Race,Frame)
  1284. {
  1285.     Loop
  1286.     {
  1287.         if !GUI_Base_Icon[a_index]
  1288.         {
  1289.             Debug_ToolTip := "Initializing GUI_Base_Icon: " . Name . " in location: " . a_index
  1290.             Debug_ToolTip(Debug_ToolTip, 10)
  1291.             GUI_Base_Icon[a_index] := Name
  1292.             GUI_Base_Icon_Belongs_To_Race[a_index] := Race
  1293.             GUI_Base_Icon_Current_Frame[a_index] := Frame
  1294.             GUI_Base_Icon_Count := a_index
  1295.            
  1296.             ;GUI_Base_Main_Icon_ControlVLabel[a_index] := "IconLabel" . a_index
  1297.  
  1298.            
  1299.             root_index := a_index
  1300.             frame_counter := 0
  1301.             Loop, % GUI_Base_Icon_Frame_Count
  1302.             {
  1303.  
  1304.                     ;GUI_Base_Icon_ControlName[root_index,1] := GUI_Base_Icon[root_index]
  1305.  
  1306.                     GUI_Base_Icon_ControlName[root_index,a_index] :=  GUI_Base_Icon_Frame[a_index] . "_normal"
  1307.                     GUI_Base_Icon_ControlVLabel[root_index,a_index] := "FrameLabel" . root_index . a_index
  1308.                     ;MsgBox % GUI_Base_Icon_ControlName[root_index,a_index] . "`n" . GUI_Base_Icon_ControlVLabel[root_index,a_index]
  1309.  
  1310.  
  1311.                    
  1312.             }
  1313.             Loop, % GUI_Base_Icon_Frame_Count
  1314.             {
  1315.                     frame_counter := ( a_index + GUI_Base_Icon_Frame_Count )
  1316.                     GUI_Base_Icon_ControlName[root_index,frame_counter] :=  GUI_Base_Icon_Frame[a_index] . "_highlighted"
  1317.                     GUI_Base_Icon_ControlVLabel[root_index,frame_counter] := "FrameLabel" . root_index . frame_counter
  1318.                     ;MsgBox % GUI_Base_Icon_ControlName[root_index,frame_counter] . "`n" . GUI_Base_Icon_ControlVLabel[root_index,frame_counter]
  1319.             }
  1320.             break
  1321.  
  1322.         }
  1323.     }
  1324.    
  1325. }
  1326. GridLoop()
  1327. {
  1328.     Checking := "Static9"
  1329.     SplashCounter := 0
  1330.     SplashCounterX := 0
  1331.  
  1332.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGUIHWND%
  1333.  
  1334.     ImageFile = %A_WorkingDir%\GUI\MiniMap\4x4.bmp
  1335.     ImageFileX = %A_WorkingDir%\GUI\MiniMap\4x4R.bmp
  1336.     ;SplashImageGUI(ImageFile, GUI_GridX[X_Index,Y_Index]+UI_X, GUI_GridY[X_Index,Y_Index]+UI_Y, SplashCounter, "TempEnemy")
  1337.     ;WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  1338.     ;ControlGetPos, UI_X, UI_Y, Width, Height, Static1, , , ,
  1339.     SizeX := floor( Width / GUI_Base_Grid )
  1340.     SizeY := floor( Height / GUI_Base_Grid )
  1341.     MsgBox, %SizeX% %SizeY%
  1342.     Loop %SizeX%
  1343.     {
  1344.         X_Index := a_index
  1345.         Loop %SizeY%
  1346.         {
  1347.             SplashCounter := SplashCounter + 1
  1348.             SplashCounterX := SplashCounterX + 1
  1349.             Y_Index := a_index
  1350.            
  1351.             TestA := GUI_Base_GridX[X_Index,Y_Index]
  1352.             TestB := GUI_Base_GridY[X_Index,Y_Index]
  1353.             ToolTip, %X_Index% %Y_Index% `nCurrent coords: %TestA% %TestB%
  1354.            
  1355.            
  1356.            
  1357.            
  1358.             GUI_RelativeX := GUI_Base_GridX[X_Index,Y_Index]
  1359.             GUI_RelativeY := GUI_Base_GridY[X_Index,Y_Index]
  1360.             ;MouseMove, GUI_RelativeX, GUI_RelativeY
  1361.            
  1362.            
  1363.            
  1364.            
  1365.            
  1366.            
  1367.             ;MouseMove, GUI_Base_GridX[X_Index,Y_Index], GUI_Base_GridX[X_Index,Y_Index]
  1368.             ;Sleep, 100
  1369.             ;OccuPie := GUI_GridOccupied[X_Index,Y_Index]
  1370.             ;Name := GUI_GridOccupiedName[X_Index,Y_Index] := Icon
  1371.             ;GUI_GridOccupiedStatic[X_Index,Y_Index] := StaticId
  1372.             if ( GUI_GridHasCreep[X_Index,Y_Index] )
  1373.             {
  1374.                 ToolTip, creepin!
  1375.                 ;if ( GUI_GridOccupiedStatic[X_Index,Y_Index] = Checking )
  1376.                     ;SplashImageGUI(ImageFile, GUI_GridX[X_Index,Y_Index]+UI_X, GUI_GridY[X_Index,Y_Index]+UI_Y, SplashCounter, "TempEnemy")
  1377.                 ;else
  1378.                 ;   SplashImageGUI(ImageFileX, GUI_GridX[X_Index,Y_Index]+UI_X, GUI_GridY[X_Index,Y_Index]+UI_Y, SplashCounterX, "TempEnemyX")
  1379.             }
  1380.                
  1381.            
  1382.             ;ToolTip % "Occupied? " . GUI_GridOccupied[X_Index,Y_Index] . "Static: " . GUI_GridOccupiedStatic[X_Index,Y_Index] . " Name: " . GUI_GridOccupiedName[X_Index,Y_Index]
  1383.             ;Sleep, 75
  1384.         }
  1385.     }
  1386. }
  1387. GUI_Base_Create_Icon_Grid()
  1388. {
  1389.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGUIHWND%
  1390.     WinGetClass, class, ahk_id %MyGUIHWND%
  1391.    
  1392.     Coordmode, mouse, screen
  1393.     CoordMode, Pixel, Screen
  1394.     ;MouseMove, UI_X, UI_Y
  1395.     ;Sleep, 5000
  1396.     ;MsgBox, %MyGUIHWND% %UI_X% %UI_Y%
  1397.  
  1398.     FrameX := 25
  1399.     FrameY := 20
  1400.  
  1401.  
  1402.     StartX := 20
  1403.     StartY := 20
  1404.  
  1405.     IndexA := 0
  1406.     IndexB := 0
  1407.  
  1408.     SizeX := floor( ( Width - FrameX ) / GUI_Base_Grid )
  1409.     SizeY := floor( ( Height - FrameY ) / GUI_Base_Grid )
  1410.    
  1411.     ;MsgBox, %SizeX% %SizeY% %UI_Y%
  1412.     Loop %SizeX%
  1413.     {
  1414.         IndexB := 1
  1415.         IndexA := IndexA + 1
  1416.  
  1417.         GUI_Base_GridX[IndexA,IndexB] := ( ( StartX + (GUI_Base_Grid * IndexA) + FrameX ) )
  1418.         GUI_Base_GridY[IndexA,IndexB] := ( StartY - FrameY )
  1419.         ;MouseMove, GUI_RelativeX, GUI_RelativeY
  1420.         ;ToolTip, Creating %IndexA% %IndexB%
  1421.         ;Sleep, 200
  1422.         Loop %SizeY%
  1423.         {
  1424.            
  1425.             ;ToolTip, "IndexA " %IndexA% " IndexB " %IndexB%
  1426.             GUI_Base_GridX[IndexA,IndexB] := ( StartX + (GUI_Base_Grid * IndexA) )
  1427.             GUI_Base_GridY[IndexA,IndexB] := ( StartY + (GUI_Base_Grid * IndexB) )
  1428.             GUI_Base_GridOccupied[IndexA,IndexB] := false
  1429.             GUI_Base_GridOccupiedName[IndexA,IndexB] := ""
  1430.             GUI_Base_GridOccupiedStatic[IndexA,IndexB] := ""
  1431.             GUI_Base_GridOccupiedHasCreep[IndexA,IndexB] := ""
  1432.            
  1433.            
  1434.             ;MsgBox % "k " . GUI_Base_GridX[Root_index,a_index]
  1435.            
  1436.             GUI_RelativeX := UI_X + GUI_Base_GridX[IndexA,IndexB]
  1437.             GUI_RelativeY := UI_Y + GUI_Base_GridY[IndexA,IndexB]
  1438.             ;MouseMove, GUI_RelativeX, GUI_RelativeY
  1439.             ;Sleep, 100
  1440.             ;ToolTip, Creating %IndexA% %IndexB%
  1441.             IndexB := IndexB + 1
  1442.             ;Sleep, 100
  1443.         }
  1444.     }
  1445. }
  1446. MoveIcon(Icon, IconIndex, StaticId, MoveX, MoveY, HasLabel = "",Label_StaticId = "")
  1447. {
  1448.  
  1449.  
  1450.     ;MsgBox, Icon: %Icon% StaticID: %StaticID% HWND: %MyGUIHWND%
  1451.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGUIHWND%
  1452.     SizeX := floor( Width / GUI_Base_Grid )
  1453.     SizeY := floor( Height / GUI_Base_Grid )
  1454.     ;MsgBox, %Width% %Height% %GUI_Base_Grid%
  1455.    
  1456.     GuiControlGet, MyEdit,, %StaticId%
  1457.     ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %StaticId%, ,%MyEdit% , ,
  1458.    
  1459.     if ( HasLabel )
  1460.     {
  1461.         GuiControlGet, MyEdit2,, %Label_StaticId%
  1462.         ControlGetPos, Label_X, Label_Y, Label_Width, Label_Height, %Label_StaticId%, ,%MyEdit2% , ,
  1463.        
  1464.         ;MsgBox, IT HAS A LAEBL static: %Label_StaticId% %Label_X% %Label_Y% %Label_Width% %Label_Height%
  1465.        
  1466.         Icon_Width := Icon_Width + Label_Width - GUI_Base_Grid
  1467.        
  1468.     }
  1469.     Loop %SizeX%
  1470.     {
  1471.         ;ToolTip % GUI_Base_GridOccupiedName[a_index,1]
  1472.         ;sleep, 100
  1473.         if ( (a_index * GUI_Base_Grid) < Icon_X OR (a_index * GUI_Base_Grid) > Icon_X+Icon_Width-1 )
  1474.         {
  1475.             continue
  1476.         }
  1477.         ;ToolTip, Continuing through X: %a_index% IconX: %Icon_X% W: %Icon_Width%
  1478.          
  1479.         if ( GUI_Base_GridOccupiedStatic[X_Index,Y_Index] = StaticId )
  1480.         {
  1481.             ;ToolTip, This is our boy!
  1482.             ;sleep, 1000
  1483.         }
  1484.        
  1485.         X_Index := a_index
  1486.         break
  1487.     }
  1488.     Loop %SizeY%
  1489.     {
  1490.         ;ToolTip % GUI_Base_GridOccupiedName[X_Index,a_index]
  1491.         ;sleep, 1000
  1492.         if ( (a_index * GUI_Base_Grid) < Icon_Y OR (a_index * GUI_Base_Grid) > Icon_Y+Icon_Height-1 )
  1493.         {
  1494.             continue
  1495.         }
  1496.         Y_Index := a_index
  1497.         break
  1498.     }
  1499.    
  1500.  
  1501.    
  1502.     ;~ ZIcon        :=  GUI_Base_GridOccupiedName[X_Index,Y_Index]     
  1503.     ;~ ZStaticId    :=  GUI_Base_GridOccupiedStatic[X_Index,Y_Index]    
  1504.     ;~ ZIconIndex   :=  GUI_Base_GridOccupiedIconIndex[X_Index,Y_Index]
  1505.     ;~ ZcVar        :=  GUI_Base_GridOccupiedIconcVar[X_Index,Y_Index]     
  1506.     ;~ ZType        :=  GUI_Base_GridOccupiedIconType[X_Index,Y_Index]     
  1507.     ;~ MsgBox ZIcon: %ZIcon% `nZStaticId: %ZStaticId% `nZIconIndex: %ZIconIndex% `nZcVar: %ZcVar% `nZType: %ZType%
  1508.  
  1509.     WidthIncrement := floor( Icon_Width / GUI_Base_Grid )
  1510.     ;if ( WidthIncrement < 3 )
  1511.     ;   WidthIncrement := 3
  1512.     HeightIncrement := floor( Icon_Height / GUI_Base_Grid )
  1513.     if ( HeightIncrement < 3 )
  1514.         HeightIncrement := 3
  1515.        
  1516.     if ( Movey < 0 )
  1517.     {
  1518.         SetGridRange(Icon, StaticId, IconIndex, X_Index, Y_Index-1, X_Index+WidthIncrement, Y_Index-1, X_Index, Y_Index)
  1519.         SetGridRange("DELETE", "DELETE", "DELETE", X_Index, (Y_Index+HeightIncrement)-1, X_Index+WidthIncrement, (Y_Index+HeightIncrement)-1)
  1520.        
  1521.     }
  1522.  
  1523.     if ( Movey > 0 )
  1524.     {
  1525.         SetGridRange(Icon, StaticId, IconIndex, X_Index, Y_Index+HeightIncrement, X_Index+WidthIncrement, Y_Index+HeightIncrement, X_Index, Y_Index)
  1526.         SetGridRange("DELETE", "DELETE", "DELETE", X_Index, Y_Index, X_Index+WidthIncrement, Y_Index)
  1527.     }
  1528.     if ( MoveX < 0 )
  1529.     {
  1530.         SetGridRange(Icon, StaticId, IconIndex, X_Index-1, Y_Index, X_Index-1, Y_Index+HeightIncrement, X_Index, Y_Index)
  1531.         SetGridRange("DELETE", "DELETE", "DELETE", (X_Index+WidthIncrement)-1, Y_Index, (X_Index+HeightIncrement)-1, Y_Index+HeightIncrement)
  1532.     }
  1533.  
  1534.     if ( MoveX > 0 )
  1535.     {
  1536.         SetGridRange(Icon, StaticId, IconIndex, X_Index+WidthIncrement, Y_Index, X_Index+WidthIncrement, Y_Index+HeightIncrement, X_Index, Y_Index)
  1537.         SetGridRange("DELETE", "DELETE", "DELETE", X_Index, Y_Index, X_Index, Y_Index+HeightIncrement)
  1538.     }
  1539.    
  1540.     NowMoveX := Icon_X+(MoveX*GUI_Base_Grid)
  1541.     NowMoveY := Icon_Y+(MoveY*GUI_Base_Grid)
  1542.     ;MsgBox, Attempting to move  %StaticId% by %NowMoveX% %NowMoveY%
  1543.     GuiControl, Move, %StaticId%, x%NowMoveX% y%NowMoveY% ;<-original
  1544.    
  1545.     if HasLabel
  1546.     {
  1547.         GUI_ActualCheckBoxLabelName := Gui_Base_Label_VControl_Array[IconIndex]
  1548.        
  1549.         NowMoveX := NowMoveX + 15
  1550.         GuiControl, MoveDraw, %Label_StaticId%, x%NowMoveX% y%NowMoveY% ;<-original
  1551.         ;GUIControl, MoveDraw, %GUI_ActualCheckBoxLabelName%, x%MoveToX% y%MoveToY%
  1552.     }
  1553.    
  1554.     ;GUI_Base_Move_Frame_To_Icon(IconIndex, StaticID)
  1555.    
  1556.    
  1557. }
  1558. GUI_Base_Move_Frame_To_Icon(IconIndex, StaticID)
  1559. {
  1560.     Loop, % GUI_Base_Icon_Frame_Count
  1561.     {
  1562.         ;MsgBox % GUI_Base_Icon_Current_Frame[IconIndex] . " compared with looped: " . GUI_Base_Icon_Frame[a_index]
  1563.  
  1564.         if ( GUI_Base_Icon_Current_Frame[IconIndex] = GUI_Base_Icon_Frame[a_index] )
  1565.         {
  1566.             GuiControlGet, Icon_Control_Path,, %StaticID%
  1567.             ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %StaticID%, ,%Icon_Control_Path% , ,
  1568.            
  1569.             Extra_index := a_index + GUI_Base_Icon_Frame_Count
  1570.             GUI_ActualFrameName := GUI_Base_Icon_ControlVLabel[IconIndex,Extra_index]
  1571.             GUIControl, Move, %GUI_ActualFrameName%, x%Icon_X% y%Icon_Y%
  1572.    
  1573.         }
  1574.     }
  1575. }
  1576. SetGridRange(Icon, StaticId, IconIndex, FromX, FromY, ToX, ToY, Previous_X = "", Previous_Y = "")
  1577. {
  1578.     SplashCounter := 0
  1579.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  1580.    
  1581.     ;MsgBox, Icon: %Icon% SetGridRange to move x %FromX% y %FromY% by %ToX% %ToY%
  1582.  
  1583.     SizeX := ToX - FromX
  1584.     SizeY := ToY - FromY
  1585.    
  1586.     if ( SizeX < 1 )
  1587.         SizeX := 1
  1588.        
  1589.     if ( SizeY < 1 )
  1590.         SizeY := 1
  1591.  
  1592.     ;MsgBox,  %FromX% %FromY% %ToX% %ToY% SizeX: %SizeX% SizeY: %SizeY%
  1593.  
  1594.     Loop %SizeX%
  1595.     {
  1596.         X_index := a_index - 1 + FromX
  1597.         ;ToolTip, %X_index%
  1598.         Loop %SizeY%
  1599.         {
  1600.             Y_index := a_index - 1 + FromY
  1601.  
  1602.             if ( Icon = "DELETE" )
  1603.             {
  1604.                 SplashCounter := SplashCounter + 1
  1605.                 ;ToolTip, Deleting! %X_index% %Y_index%
  1606.                 ;ImageFile = %A_WorkingDir%\GUI\MiniMap\4x4R.bmp
  1607.                 ;SplashImageGUI(ImageFile, GUI_Base_GridX[X_Index,Y_Index]+UI_X, GUI_Base_GridY[X_Index,Y_Index]+UI_Y, SplashCounter, "TempEnemy")
  1608.                 ;Sleep, 200
  1609.                 GUI_Base_GridOccupied[X_index,Y_index] := ""
  1610.                 GUI_Base_GridOccupiedName[X_index,Y_index] := ""
  1611.                 GUI_Base_GridOccupiedStatic[X_index,Y_index] := ""
  1612.                 GUI_Base_GridOccupiedIconIndex[X_index,Y_index] := ""
  1613.                 GUI_Base_GridOccupiedIconType[X_index,Y_index] := ""
  1614.                 GUI_Base_GridOccupiedIconcVar[X_index,Y_index] := ""
  1615.                
  1616.                
  1617.             }
  1618.             else
  1619.             {
  1620.                 SplashCounter := SplashCounter + 1
  1621.                
  1622.                 ImageFile = %A_WorkingDir%\GUI\MiniMap\4x4.bmp
  1623.                 SplashX := ( GUI_Base_GridX[X_Index,Y_Index] + UI_X )
  1624.                 SplashY := ( GUI_Base_GridY[X_Index,Y_Index] + UI_Y )
  1625.                 ;MsgBox, %SplashX% %SplashY%
  1626.                 ;SplashImageGUI(ImageFile, SplashX, SplashY, SplashCounter, "Temp")
  1627.                 ;Sleep, 200
  1628.                 GUI_Base_GridOccupied[X_Index,Y_Index] := true
  1629.                
  1630.                
  1631.                 GUI_Base_GridOccupiedName[X_Index,Y_Index] := GUI_Base_GridOccupiedName[Previous_X,Previous_Y]
  1632.                 GUI_Base_GridOccupiedStatic[X_Index,Y_Index] := GUI_Base_GridOccupiedStatic[Previous_X,Previous_Y]
  1633.                 GUI_Base_GridOccupiedIconIndex[X_index,Y_index] := GUI_Base_GridOccupiedIconIndex[Previous_X,Previous_Y]
  1634.                 GUI_Base_GridOccupiedIconcVar[X_Index,Y_Index] := GUI_Base_GridOccupiedIconcVar[Previous_X,Previous_Y]
  1635.                 GUI_Base_GridOccupiedIconType[X_Index,Y_Index] := GUI_Base_GridOccupiedIconType[Previous_X,Previous_Y]
  1636.                
  1637.                
  1638.                
  1639.                
  1640.                
  1641.                
  1642.                 ToolTip
  1643.                
  1644.                 ;ToolTip, Setting ownership! %X_index% %Y_index% to name: %Icon%
  1645.             }
  1646.         }
  1647.     }
  1648. }
  1649. OccupyGrids(Icon, StaticId, IconIndex, cVar, Type)
  1650. {
  1651.     ;StaticId := "Static" . StaticId
  1652.     ;MsgBox, Occupy Time %Icon% Static: %StaticId% index: %IconIndex% cVar: %cVar%
  1653.    
  1654.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  1655.     GuiControlGet, MyEdit,, %StaticId%
  1656.     ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %StaticId%
  1657.     ;MouseMove, Icon_X + UI_X, Icon_Y + UI_Y
  1658.     ;Sleep, 3000
  1659.     ;MsgBox, ControlGetPos X: %Icon_X% Y: %Icon_Y% W: %Icon_Width% H: %Icon_Height%
  1660.    
  1661.     SizeX := floor( Width / GUI_Base_Grid )
  1662.     SizeY := floor( Height / GUI_Base_Grid )
  1663.     ;MsgBox, Occupy %SizeX% %SizeY% X: %UI_X% Y: %UI_Y% W: %Width% H: %Height%
  1664.     ;Closest := 1000
  1665.     Loop %SizeX%
  1666.     {
  1667.         if ( (a_index * GUI_Base_Grid) < Icon_X OR (a_index * GUI_Base_Grid) > Icon_X+Icon_Width-1)
  1668.         {
  1669.             ;ToolTip, Continuing through X: %a_index% IconX: %Icon_X% W: %Icon_Width%
  1670.             ;Sleep, 100
  1671.             continue
  1672.         }
  1673.        
  1674.         X_Index := a_index
  1675.         Loop %SizeY%
  1676.         {
  1677.             if ( (a_index * GUI_Base_Grid) < Icon_Y OR (a_index * GUI_Base_Grid) > Icon_Y+Icon_Height-1 )
  1678.             {
  1679.                 ;ToolTip, Continuing through Y: %a_index%
  1680.                 ;Sleep, 100
  1681.                 continue
  1682.             }
  1683.            
  1684.             Y_Index := a_index
  1685.            
  1686.             if ( ( Icon = "UI_Creep_Small" ) OR  ( Icon = "UI_Creep_Large" ) )
  1687.             {
  1688.                 ;MsgBox, setting creep
  1689.                 GUI_Base_GridHasCreep[X_Index,Y_Index] := true
  1690.                 ToolTip, Setting creep to grid: %X_Index% %Y_Index%
  1691.             }
  1692.             else
  1693.             {
  1694.  
  1695.                 GUI_Base_GridOccupied[X_Index,Y_Index] := true
  1696.                 GUI_Base_GridOccupiedName[X_Index,Y_Index] := Icon
  1697.                 GUI_Base_GridOccupiedStatic[X_Index,Y_Index] := StaticId
  1698.                 GUI_Base_GridOccupiedIconIndex[X_Index,Y_Index] := IconIndex
  1699.                 GUI_Base_GridOccupiedIconcVar[X_Index,Y_Index] := cVar
  1700.                 GUI_Base_GridOccupiedIconType[X_Index,Y_Index] := Type
  1701.                
  1702.             }
  1703.         }
  1704.     }
  1705. }
  1706. GUI_Base_Get_ControlName_By_Icon(Icon)
  1707. {
  1708.     Loop %GUI_Base_Icon_Count%
  1709.     {
  1710.         if !GUI_Base_Icon[a_index]
  1711.         {
  1712.             ;MsgBox, Breaking out of Root index, no more icons! %a_index%
  1713.             break
  1714.         }
  1715.         if ( GUI_Base_Icon[a_index] = Icon )
  1716.         {
  1717.             Control_Name := "GUI_Base_Main_Icon_ControlVLabel" . a_index
  1718.             return Control_Name
  1719.         }
  1720.     }
  1721. }
  1722.  
  1723. CheckGridSidesIcon(ByRef Cleared, ByRef HasCreep, StaticId, Direction, HasLabel = "", Label_StaticId = "")
  1724. {
  1725.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  1726.     SizeX := floor( Width / GUI_Base_Grid )
  1727.     SizeY := floor( Height / GUI_Base_Grid )
  1728.    
  1729.    
  1730.     GuiControlGet, MyEdit,, %StaticId%
  1731.     ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %StaticId%, ,%MyEdit% , ,
  1732.    
  1733.     ;MsgBox, %Icon_X% %Icon_Y%
  1734.     if ( HasLabel AND Direction > 0 )
  1735.     {
  1736.         GuiControlGet, MyEdit2,, %Label_StaticId%
  1737.         ControlGetPos, Label_X, Label_Y, Label_Width, Label_Height, %Label_StaticId%, ,%MyEdit2% , ,
  1738.        
  1739.         ;MsgBox, IT HAS A LAEBL static: %Label_StaticId% %Label_X% %Label_Y% %Label_Width% %Label_Height%
  1740.         Icon_X := Icon_X + 1
  1741.         Icon_Width := ( Icon_Width + Label_Width - GUI_Base_Grid )
  1742.        
  1743.     }
  1744.     ;SplashCounter := 0
  1745.    
  1746.     Loop %SizeX%
  1747.     {
  1748.         ;ToolTip % GUI_Base_GridOccupiedName[a_index,1]
  1749.         ;sleep, 100
  1750.         if ( (a_index * GUI_Base_Grid) < Icon_X OR (a_index * GUI_Base_Grid) > Icon_X+Icon_Width-1 )
  1751.         {
  1752.             continue
  1753.         }
  1754.         ;ToolTip, Continuing through X: %a_index% IconX: %Icon_X% W: %Icon_Width%
  1755.          
  1756.         ;if ( GUI_Base_GridOccupiedStatic[X_Index,Y_Index] = StaticId )
  1757.         ;{
  1758.         ;   ToolTip, This is our boy!
  1759.         ;   ;sleep, 1000
  1760.         ;}
  1761.        
  1762.         X_Index := a_index
  1763.         break
  1764.     }
  1765.     Loop %SizeY%
  1766.     {
  1767.         ;ToolTip % GUI_Base_GridOccupiedName[X_Index,a_index]
  1768.         ;sleep, 1000
  1769.         if ( (a_index * GUI_Base_Grid) < Icon_Y OR (a_index * GUI_Base_Grid) > Icon_Y+Icon_Height-1 )
  1770.         {
  1771.             continue
  1772.         }
  1773.         Y_Index := a_index
  1774.         break
  1775.     }
  1776.    
  1777.     WidthIncrement := floor( Icon_Width / GUI_Base_Grid )
  1778.     ;if ( WidthIncrement < 3 )
  1779.     ;   WidthIncrement := 3
  1780.     HeightIncrement := floor( Icon_Height / GUI_Base_Grid )
  1781.     if ( HeightIncrement < 3 )
  1782.         HeightIncrement := 3
  1783.    
  1784.     if ( Direction < 0 )
  1785.         CheckGridRange(Cleared, HasCreep, StaticId, X_Index-1, Y_Index, X_Index-1, Y_Index+HeightIncrement)
  1786.     else
  1787.         CheckGridRange(Cleared, HasCreep, StaticId, X_Index+WidthIncrement, Y_Index, X_Index+WidthIncrement, Y_Index+HeightIncrement)
  1788. }
  1789.  
  1790. CheckGridAboveBelowIcon(ByRef Cleared, ByRef HasCreep, StaticId, Direction, HasLabel = "", Label_StaticId = "")
  1791. {
  1792.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  1793.     SizeX := floor( Width / GUI_Base_Grid )
  1794.     SizeY := floor( Height / GUI_Base_Grid )
  1795.     ;MsgBox, %SizeX% %SizeY%
  1796.    
  1797.     GuiControlGet, MyEdit,, %StaticId%
  1798.     ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %StaticId%, ,%MyEdit% , ,
  1799.    
  1800.    
  1801.     if HasLabel
  1802.     {
  1803.         GuiControlGet, MyEdit2,, %Label_StaticId%
  1804.         ControlGetPos, Label_X, Label_Y, Label_Width, Label_Height, %Label_StaticId%, ,%MyEdit2% , ,
  1805.        
  1806.         ;MsgBox, IT HAS A LAEBL static: %Label_StaticId% %Label_X% %Label_Y% %Label_Width% %Label_Height%
  1807.         Icon_X := Icon_X + 1
  1808.         Icon_Width := ( Icon_Width + ( Label_Width - GUI_Base_Grid ) - 20 )
  1809.        
  1810.     }
  1811.    
  1812.    
  1813.     ;SplashCounter := 0
  1814.    
  1815.     Loop %SizeX%
  1816.     {
  1817.         ;ToolTip % GUI_Base_GridOccupiedName[a_index,1]
  1818.         ;sleep, 100
  1819.         if ( (a_index * GUI_Base_Grid) < Icon_X OR (a_index * GUI_Base_Grid) > Icon_X+Icon_Width-1 )
  1820.         {
  1821.             continue
  1822.         }
  1823.         ;ToolTip, Continuing through X: %a_index% IconX: %Icon_X% W: %Icon_Width%
  1824.          
  1825.         ;if ( GUI_Base_GridOccupiedStatic[X_Index,Y_Index] = StaticId )
  1826.         ;{
  1827.         ;   ToolTip, This is our boy!
  1828.         ;   ;sleep, 1000
  1829.         ;}
  1830.        
  1831.         X_Index := a_index
  1832.         break
  1833.     }
  1834.     Loop %SizeY%
  1835.     {
  1836.         ;ToolTip % GUI_Base_GridOccupiedName[X_Index,a_index]
  1837.         ;sleep, 1000
  1838.         if ( (a_index * GUI_Base_Grid) < Icon_Y OR (a_index * GUI_Base_Grid) > Icon_Y+Icon_Height-1 )
  1839.         {
  1840.             continue
  1841.         }
  1842.         Y_Index := a_index
  1843.         break
  1844.     }
  1845.    
  1846.     WidthIncrement := floor( Icon_Width / GUI_Base_Grid )
  1847.     ;if ( WidthIncrement < 3 )
  1848.     ;   WidthIncrement := 3
  1849.     HeightIncrement := floor( Icon_Height / GUI_Base_Grid )
  1850.     if ( HeightIncrement < 3 )
  1851.         HeightIncrement := 3
  1852.    
  1853.     if ( Direction < 0 )
  1854.         CheckGridRange(Cleared, HasCreep, StaticId, X_Index, Y_Index-1, X_Index+WidthIncrement, Y_Index-1)
  1855.     else
  1856.         CheckGridRange(Cleared, HasCreep, StaticId, X_Index, Y_Index+HeightIncrement, X_Index+WidthIncrement, Y_Index+HeightIncrement)
  1857.    
  1858. }
  1859.  
  1860.  
  1861. SplashImageGUI(Picture, X, Y, ID, Label)
  1862. {
  1863.     ;MsgBox, %Label% X %X% Y %Y% %Picture%
  1864.     Gui, %Label%%ID%:Margin , 0, 0
  1865.     Gui, %Label%%ID%:Add, Picture,, %Picture%
  1866.     ;Gui, %Label%%ID%:Color, ECE9D8
  1867.     Gui, %Label%%ID%:+LastFound -Caption +AlwaysOnTop +ToolWindow -Border
  1868.     ;Winset, TransColor, ECE9D8
  1869.  
  1870.     Gui, %Label%%ID%:Show, x%X% y%Y% NoActivate, %Label%%ID%
  1871. }
  1872.  
  1873.  
  1874.  
  1875. CheckGridRange(ByRef Cleared,ByRef HasCreep, StaticId, FromX, FromY, ToX, ToY)
  1876. {
  1877.  
  1878.  
  1879. ;ToolTip, %FromX% %FromY% %ToX% %ToY%
  1880. ;SplashCounter := 0
  1881.  
  1882. ;SplashCounter := SplashCounter + 1
  1883.  
  1884. SplashCounter := SplashCounter 0
  1885.  
  1886. ;SplashImageGUI(ImageFile, GUI_Base_GridX[X_Index,Y_Index]+UI_X, GUI_Base_GridY[X_Index,Y_Index]+UI_Y, SplashCounter, "TempEnemy")
  1887.  
  1888.  
  1889.     ;Frame top := UIX
  1890.  
  1891.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGUIHWND%
  1892.     UI_X := UI_X - 20
  1893.     UI_Y := UI_Y - 20
  1894.     ;if ( FromX < UI_X ) OR ( ToX < UI_X ) OR ( FromX > UI_X+Width ) OR ( ToX > UI_X+Width )
  1895.  
  1896.     ;ToolTip, Checking GridRange
  1897.     Cleared := true
  1898.     HasCreep := false
  1899.  
  1900.     SizeX := ToX - FromX
  1901.     SizeY := ToY - FromY
  1902.    
  1903.     if ( SizeX < 1 )
  1904.         SizeX := 1
  1905.        
  1906.     if ( SizeY < 1 )
  1907.         SizeY := 1
  1908.  
  1909.     ;MsgBox,  %FromX% %FromY% %ToX% %ToY% SizeX: %SizeX% SizeY: %SizeY%
  1910.  
  1911.     Loop %SizeX%
  1912.     {
  1913.         X_index := a_index - 1 + FromX
  1914.         ;ToolTip % GUI_Base_GridOccupied[X_index,Y_index]
  1915.         Loop %SizeY%
  1916.         {
  1917.             Y_index := a_index - 1 + FromY
  1918.            
  1919.             ;SplashCounter := SplashCounter + 1
  1920.             ;ImageFile = %A_WorkingDir%\GUI_Resources\MiniMap\4x4.bmp
  1921.             ;SplashImageGUI(ImageFile, GUI_Base_GridX[X_Index,Y_Index]+UI_X, GUI_Base_GridY[X_Index,Y_Index]+UI_Y, SplashCounter, "TempEnemy")
  1922.             ;ToolTip % GUI_Base_GridOccupied[X_index,Y_index]
  1923.             ;sleep, 200
  1924.  
  1925.            
  1926.             if ( X_index < ( GUI_Base_Grid_FrameX / GUI_Base_Grid ) AND GUI_Options_Lock_Icons_TO_Window )
  1927.                 Cleared := false
  1928.            
  1929.             if ( Y_index < ( GUI_Base_Grid_FrameY / GUI_Base_Grid ) + 1  AND GUI_Options_Lock_Icons_TO_Window )
  1930.                 Cleared := false
  1931.            
  1932.             ;ToolTip, %X_index% %Y_index%
  1933.              
  1934.             if GUI_Base_GridOccupied[X_index,Y_index]
  1935.             {
  1936.                 if ( GUI_Base_GridOccupiedStatic[X_Index,Y_Index] != StaticId )
  1937.                 {
  1938.                     Cleared := false
  1939.                 }
  1940.             }
  1941.            
  1942.             if GUI_Base_GridHasCreep[X_index,Y_index]
  1943.                 HasCreep := true
  1944.            
  1945.             if ( !GUI_Base_GridX[X_index,Y_index] AND GUI_Options_Lock_Icons_TO_Window )
  1946.                 Cleared := false
  1947.            
  1948.             ;if !Cleared
  1949.             ;   break
  1950.         }
  1951.     }
  1952. }
  1953. GUI_Base_Hide_Icon_Frame(IconIndex,control)
  1954. {
  1955.     Loop, % GUI_Base_Icon_Frame_Count
  1956.     {
  1957.         ;MsgBox % GUI_Base_Icon_Current_Frame[IconIndex] . " compared with looped: " . GUI_Base_Icon_Frame[a_index]
  1958.  
  1959.         if ( GUI_Base_Icon_Current_Frame[IconIndex] = GUI_Base_Icon_Frame[a_index] )
  1960.         {
  1961.             GuiControlGet, Clicked_Control_Path,, %control%
  1962.             ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %control%, ,%Clicked_Control_Path% , ,
  1963.            
  1964.             Extra_index := a_index + GUI_Base_Icon_Frame_Count
  1965.             GUI_ActualFrameName := GUI_Base_Icon_ControlVLabel[IconIndex,Extra_index]
  1966.  
  1967.             GUIControl, Hide, %GUI_ActualFrameName%
  1968.            
  1969.             GUI_ActualFrameName := GUI_Base_Icon_ControlVLabel[IconIndex,a_index]
  1970.             GUIControl, Hide, %GUI_ActualFrameName%
  1971.         }
  1972.     }
  1973. }
  1974.  
  1975. GUI_Base_Highlight_Icon(IconIndex,control)
  1976. {
  1977.     ;MsgBox % IconIndex
  1978.     Loop, % GUI_Base_Icon_Frame_Count
  1979.     {
  1980.         ;MsgBox % GUI_Base_Icon_Current_Frame[IconIndex] . " compared with looped: " . GUI_Base_Icon_Frame[a_index]
  1981.  
  1982.         if ( GUI_Base_Icon_Current_Frame[IconIndex] = GUI_Base_Icon_Frame[a_index] )
  1983.         {
  1984.             GuiControlGet, Clicked_Control_Path,, %control%
  1985.             ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %control%, ,%Clicked_Control_Path% , ,
  1986.            
  1987.             Extra_index := a_index + GUI_Base_Icon_Frame_Count
  1988.             GUI_ActualFrameName := GUI_Base_Icon_ControlVLabel[IconIndex,Extra_index]
  1989.             GUIControl, MoveDraw, %GUI_ActualFrameName%, x%Icon_X% y%Icon_Y%
  1990.             GUIControl, Show, %GUI_ActualFrameName%
  1991.            
  1992.             GUI_ActualFrameName := GUI_Base_Icon_ControlVLabel[IconIndex,a_index]
  1993.             GUIControl, Hide, %GUI_ActualFrameName%
  1994.         }
  1995.     }
  1996. }
  1997. GUI_Base_Un_Highlight_Icon(IconIndex,control)
  1998. {
  1999.     Loop, % GUI_Base_Icon_Frame_Count
  2000.     {
  2001.         ;MsgBox % GUI_Base_Icon_Current_Frame[IconIndex] . " compared with looped: " . GUI_Base_Icon_Frame[a_index]
  2002.  
  2003.         if ( GUI_Base_Icon_Current_Frame[IconIndex] = GUI_Base_Icon_Frame[a_index] )
  2004.         {
  2005.             GuiControlGet, Clicked_Control_Path,, %control%
  2006.             ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %control%, ,%Clicked_Control_Path% , ,
  2007.            
  2008.             GUI_ActualFrameName := GUI_Base_Icon_ControlVLabel[IconIndex,a_index]
  2009.             GUIControl, Move, %GUI_ActualFrameName%, x%Icon_X% y%Icon_Y%
  2010.             GUIControl, Show, %GUI_ActualFrameName%
  2011.            
  2012.            
  2013.             Extra_index := a_index + GUI_Base_Icon_Frame_Count
  2014.             GUI_ActualFrameName := GUI_Base_Icon_ControlVLabel[IconIndex,Extra_index]
  2015.             GUIControl, Hide, %GUI_ActualFrameName%
  2016.         }
  2017.     }
  2018. }
  2019. GUI_Base_Icon_Clicked(Control_Name, IconIndex,control)
  2020. {
  2021.     ;
  2022.     if ( GUI_Base_User_In_Options AND Control_Name != "visitthelab" AND !GUI_Options_Lock_Icons )
  2023.     {
  2024.         GUI_Base_Hide_Icon_Frame(IconIndex,control)
  2025.         VControl := "GUI_Base_Main_Icon_ControlVLabel" . IconIndex
  2026.         GUI_Base_Icon_Grab(IconIndex,control,VControl)
  2027.         return
  2028.     }
  2029.     else
  2030.     {
  2031.         ;
  2032.         GUI_Base_User_Last_Clicked := control
  2033.         GUI_Base_User_Last_Clicked_Index := IconIndex
  2034.         GUI_Base_Highlight_Icon(IconIndex,control)
  2035.     }
  2036.    
  2037.  
  2038.     Sleep, 100
  2039.     Loop,
  2040.     {
  2041.         Sleep, 10
  2042.         MouseDown:=GetKeyState("LButton","P")
  2043.         if !MouseDown
  2044.            Break
  2045.  
  2046.         ;MsgBox % GUI_Base_User_Last_Clicked
  2047.  
  2048.        ; LastControl := control
  2049.         MouseGetPos, , , id, control
  2050.        ; Uncomment to have box go back to normal once you leave the box instead of when you let go of click
  2051.         if (control != GUI_Base_User_Last_Clicked)
  2052.         {
  2053.             GUI_Base_Un_Highlight_Icon(GUI_Base_User_Last_Clicked_Index,GUI_Base_User_Last_Clicked)
  2054.             break
  2055.         }
  2056.     }
  2057.      GUI_Base_Icon_Click_LetGo(Control_Name,IconIndex,control)
  2058. }
  2059. GUI_Base_Icon_Click_LetGo(Clicked_Control_Name,IconIndex,StaticID)
  2060. {
  2061.     ;controlgetpos,x,y,width,height,,ahk_id %id%
  2062.     ;Sleep, 1000
  2063.     MouseGetPos, , , id, control
  2064.     ;ToolTip, GUI_Base_Icon_Click_LetGo New control: %control% `nOld id %GUI_Base_User_Last_Clicked%
  2065.  
  2066.     if ( control = GUI_Base_User_Last_Clicked )
  2067.     {
  2068.         GUI_Base_Process_Icon_Click(Clicked_Control_Name,IconIndex,StaticID)
  2069.         GUI_Base_Un_Highlight_Icon(IconIndex,StaticID)
  2070.     }
  2071.     else
  2072.         GUI_Base_Un_Highlight_Icon(GUI_Base_User_Last_Clicked_Index,GUI_Base_User_Last_Clicked)
  2073. }
  2074. GUI_Base_CheckBox_Click_LetGo(Clicked_Control_Name,CheckBoxIndex,StaticID)
  2075. {
  2076.     ;controlgetpos,x,y,width,height,,ahk_id %id%
  2077.     ;Sleep, 1000
  2078.     MouseGetPos, , , id, control
  2079.     ;ToolTip, New control: %control% `nOld id %GUI_Base_User_Last_Clicked%
  2080.     ;Sleep, 3000
  2081.     if ( control = GUI_Base_User_Last_Clicked )
  2082.     {
  2083.         if ( Clicked_Control_Name = "UI_CheckBox_Normal" )
  2084.         {
  2085.             GuiControl Hide, GUI_Base_CheckBox_Pressed_Array%CheckBoxIndex%
  2086.             GuiControl Show, Gui_Base_CheckBox_Pressed_Checked_Array%CheckBoxIndex%
  2087.             GUI_Base_ProcessCheckBox(true,Clicked_Control_Name,CheckBoxIndex,StaticID)
  2088.             ;turn shit on
  2089.         }
  2090.         else
  2091.         {
  2092.             if ( Clicked_Control_Name = "UI_CheckBox_Pressed_Checked" )
  2093.             {
  2094.                 ;turn shit off
  2095.                 GuiControl Hide, Gui_Base_CheckBox_Pressed_Over_Checked_Array%CheckBoxIndex%
  2096.                 GuiControl Show, Gui_Base_CheckBox_Normal_Array%CheckBoxIndex%
  2097.                 GUI_Base_ProcessCheckBox(false,Clicked_Control_Name,CheckBoxIndex,StaticID)
  2098.                
  2099.                
  2100.             }
  2101.         }
  2102.     }
  2103. }
  2104. GUI_Base_CheckBox_Clicked(Clicked_Control_Name,CheckBoxIndex,StaticID)
  2105. {
  2106.     ;MsgBox, %Clicked_Control_Name%`t%CheckBoxIndex%`t%StaticID%
  2107.    
  2108.         Coordmode, mouse, screen
  2109.  
  2110.         if ( GUI_Base_User_In_Options AND !GUI_Options_Lock_Icons AND Gui_Base_Label_Text[CheckBoxIndex] != "Lock Icons" )
  2111.         {
  2112.             if ( Clicked_Control_Name = "UI_CheckBox_Normal" )
  2113.                 VControl := "Gui_Base_CheckBox_Normal_Array" . CheckBoxIndex
  2114.             else
  2115.                 VControl := "Gui_Base_CheckBox_Pressed_Checked_Array" . CheckBoxIndex
  2116.            
  2117.             ;MsgBox % VControl
  2118.             GUI_Base_Icon_Grab(A_Index,StaticID,VControl)
  2119.             return
  2120.         }
  2121.  
  2122.         if ( Clicked_Control_Name = "UI_CheckBox_Normal" )
  2123.         {
  2124.             GuiControl Show, GUI_Base_CheckBox_Pressed_Array%CheckBoxIndex%
  2125.             GuiControl Hide, Gui_Base_CheckBox_Normal_Array%CheckBoxIndex%
  2126.             GUI_Base_User_Last_Clicked := GUI_Base_CheckBox_Pressed_StaticID[CheckBoxIndex]
  2127.             GUI_Base_User_Last_Clicked_Index := CheckBoxIndex
  2128.         }
  2129.         else
  2130.         {
  2131.             if ( Clicked_Control_Name = "UI_CheckBox_Pressed_Checked" )
  2132.             {
  2133.                     GuiControl Show, Gui_Base_CheckBox_Pressed_Over_Checked_Array%CheckBoxIndex%
  2134.                     GuiControl Hide, Gui_Base_CheckBox_Pressed_Checked_Array%CheckBoxIndex%
  2135.                     GUI_Base_User_Last_Clicked := Gui_Base_CheckBox_Pressed_Over_Checked_StaticID[CheckBoxIndex]
  2136.                     GUI_Base_User_Last_Clicked_Index := CheckBoxIndex
  2137.             }
  2138.         }
  2139.  
  2140.         Sleep, 100
  2141.     Loop,
  2142.     {
  2143.         Sleep, 10
  2144.         MouseDown:=GetKeyState("LButton","P")
  2145.         if !MouseDown
  2146.            Break
  2147.  
  2148.         ;MsgBox % GUI_Base_User_Last_Clicked
  2149.  
  2150.        ; LastControl := control
  2151.         MouseGetPos, , , id, control
  2152.        ; Uncomment to have box go back to normal once you leave the box instead of when you let go of click
  2153.         if (control != GUI_Base_User_Last_Clicked)
  2154.         {
  2155.             if ( Clicked_Control_Name = "UI_CheckBox_Normal" )
  2156.             {
  2157.                 GuiControl Hide, GUI_Base_CheckBox_Pressed_Array%CheckBoxIndex%
  2158.                 GuiControl Show, Gui_Base_CheckBox_Normal_Array%CheckBoxIndex%
  2159.             }
  2160.             else
  2161.             {
  2162.                 if ( Clicked_Control_Name = "UI_CheckBox_Pressed_Checked" )
  2163.                 {
  2164.                     GuiControl Hide, Gui_Base_CheckBox_Pressed_Over_Checked_Array%CheckBoxIndex%
  2165.                     GuiControl Show, Gui_Base_CheckBox_Pressed_Checked_Array%CheckBoxIndex%
  2166.                 }
  2167.             }
  2168.             break
  2169.         }
  2170.     }
  2171.      GUI_Base_CheckBox_Click_LetGo(Clicked_Control_Name,CheckBoxIndex,StaticID)
  2172.  
  2173. }
  2174. ;GUI_Base_SetCheckBox_State_Defaults()
  2175.  
  2176.  
  2177.  
  2178. GUI_Base_Icon_Let_Go(IconIndex,control,VControl)
  2179. {
  2180.     ;MsgBox % VControl
  2181.     IfInString, VControl, CheckBox
  2182.     {
  2183.        
  2184.        
  2185.         GuiControlGet, Clicked_Control_Path,, %control%
  2186.         ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %control%, ,%Clicked_Control_Path% , ,
  2187.         ;let go of checkbox
  2188.  
  2189.         GUIControl, Move, Gui_Base_CheckBox_Normal_Array%IconIndex%, x%Icon_X% y%Icon_Y%
  2190.         GUIControl, Move, Gui_Base_CheckBox_Normal_Over_Array%IconIndex%, x%Icon_X% y%Icon_Y%
  2191.         GUIControl, Move, Gui_Base_CheckBox_Pressed_Array%IconIndex%, x%Icon_X% y%Icon_Y%
  2192.         GUIControl, Move, Gui_Base_CheckBox_Pressed_Over_Array%IconIndex%, x%Icon_X% y%Icon_Y%
  2193.         GUIControl, Move, Gui_Base_CheckBox_Pressed_Checked_Array%IconIndex%, x%Icon_X% y%Icon_Y%
  2194.         GUIControl, Move, Gui_Base_CheckBox_Pressed_Over_Checked_Array%IconIndex%, x%Icon_X% y%Icon_Y%
  2195.        
  2196.     }
  2197.     else
  2198.     {
  2199.         IfInString, VControl, PlayButton
  2200.         {
  2201.             GuiControlGet, Clicked_Control_Path,, %control%
  2202.             ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %control%, ,%Clicked_Control_Path% , ,
  2203.            
  2204.            
  2205.             GUIControl, Move, GUI_Base_PlayButton_VControl_Array, x%Icon_X% y%Icon_Y%
  2206.             GUIControl, Move, GUI_Base_PlayButton_Highlighted_VControl_Array, x%Icon_X% y%Icon_Y%
  2207.             GUIControl, Move, GUI_Base_PlayButton_Playing_VControl_Array, x%Icon_X% y%Icon_Y%
  2208.         }
  2209.         else
  2210.         {
  2211.             Loop, % GUI_Base_Icon_Frame_Count
  2212.             {
  2213.                 ;MsgBox % GUI_Base_Icon_Current_Frame[IconIndex] . " compared with looped: " . GUI_Base_Icon_Frame[a_index]
  2214.  
  2215.                 if ( GUI_Base_Icon_Current_Frame[IconIndex] = GUI_Base_Icon_Frame[a_index] )
  2216.                 {
  2217.                     GuiControlGet, Clicked_Control_Path,, %control%
  2218.                     ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %control%, ,%Clicked_Control_Path% , ,
  2219.                    
  2220.                     GUI_ActualFrameName := GUI_Base_Icon_ControlVLabel[IconIndex,a_index]
  2221.                     GUIControl, Move, %GUI_ActualFrameName%, x%Icon_X% y%Icon_Y%
  2222.                     GUIControl, Show, %GUI_ActualFrameName%
  2223.                    
  2224.                    
  2225.                     Extra_index := a_index + GUI_Base_Icon_Frame_Count
  2226.                     GUI_ActualFrameName := GUI_Base_Icon_ControlVLabel[IconIndex,Extra_index]
  2227.                     GUIControl, Hide, %GUI_ActualFrameName%
  2228.                 }
  2229.             }
  2230.         }
  2231.     }
  2232.     ;IfInString, VControl, CheckBox
  2233.     ;{
  2234.        
  2235.     ;   OccupyGrids(Gui_Base_CheckBox_Normal_Name_Array[IconIndex], GUI_Base_CheckBox_Normal_StaticID[IconIndex], IconIndex, cVar, "Default_Checkbox")
  2236.     ;}
  2237.     ;IfInString, VControl, CheckBox
  2238.     ;{
  2239.     ;}
  2240.    
  2241.     ;MsgBox % VControl
  2242.     ;OccupyGrids(Label_Name, control, IconIndex, VControl, "Default_Label")
  2243. }
  2244.  
  2245. GUI_Base_Process_Icon_Click(Control_Name,IconIndex,control)
  2246. {
  2247.     ;GUI_Base_Highlight_Icon(IconIndex,control)
  2248.     if ( Control_Name = "visitthelab" )
  2249.     {
  2250.         GUI_Base_Options_Clicked()
  2251.     }
  2252.     else if ( Control_Name = "tutorial" )
  2253.         {
  2254.             InputBox, GUI_Options_Input_Box, ?, ?,, 200, 200, X, Y, , ,
  2255.             if ErrorLevel
  2256.                 MsgBox, CANCEL was pressed.
  2257.             else
  2258.             {
  2259.                 if ( GUI_Options_Input_Box = "ListVars" )
  2260.                     ListVars
  2261.                 else
  2262.                 {
  2263.                     ;MyVar = %GUI_Options_Input_Box%
  2264.                     ;RefToMyVar = %MyVar%
  2265.                     GUI_Options_Input_Box_String = %GUI_Options_Input_Box%
  2266.                     GUI_Options_Input_Box := %GUI_Options_Input_Box%
  2267.                     ;RetunVariable(GUI_Options_Input_Box)
  2268.                     ;StringTrimLeft, MyVarContents, %RefToMyVar%, 0
  2269.                     MsgBox % GUI_Options_Input_Box_String . " = " . GUI_Options_Input_Box
  2270.                 }
  2271.             }
  2272.                
  2273.         }
  2274.     else if ( Control_Name = "starmap" )
  2275.     {
  2276.         ToggleWatchGrids()
  2277.     }
  2278.     ;MsgBox, %Control_Name% %IconIndex% %control%
  2279.     ;Sleep, 100
  2280.    
  2281. }
  2282.  
  2283.  
  2284. GUI_Base_Options_Clicked()
  2285. {
  2286.     ;MsgBox, options clicked!!!!
  2287.     if GUI_Base_User_In_Options
  2288.     {
  2289.         GUI_Base_Hide_Options()
  2290.         GuiControl Show, Small_Window_Frame
  2291.         GuiControl Hide, Big_Window_Frame
  2292.  
  2293.         GUI_Base_User_In_Options := false
  2294.        
  2295.     }
  2296.     else
  2297.     {
  2298.        
  2299.     ;   GuiControl Hide, Small_Window_Frame
  2300.     ;   GuiControl Show, Big_Window_Frame
  2301.        
  2302.         GUI_Base_User_In_Options := true
  2303.         GUI_Base_Show_Options()
  2304.         if GUI_Base_User_Opened_Options_First_Time
  2305.             GUI_Base_Create_Static_DB()
  2306.     }
  2307. }
  2308.  
  2309. Gui_Base_Hide_CheckBox(Name,CheckBoxIndex,cVar)
  2310. {
  2311.     ;MsgBox % Name . "," . IconIndex . "," . cVar
  2312.     GuiControl Hide, Gui_Base_CheckBox_Normal_Array%CheckBoxIndex%
  2313.     GuiControl Hide, Gui_Base_CheckBox_Normal_Over_Array%CheckBoxIndex%
  2314.     GuiControl Hide, Gui_Base_CheckBox_Pressed_Array%CheckBoxIndex%
  2315.     GuiControl Hide, Gui_Base_CheckBox_Pressed_Over_Array%CheckBoxIndex%
  2316.     GuiControl Hide, Gui_Base_CheckBox_Pressed_Checked_Array%CheckBoxIndex%
  2317.     GuiControl Hide, Gui_Base_CheckBox_Pressed_Over_Checked_Array%CheckBoxIndex%
  2318.     GuiControl Hide, Gui_Base_Label_VControl_Array%CheckBoxIndex%
  2319. }
  2320. Gui_Base_Show_CheckBox(Name,CheckBoxIndex,cVar)
  2321. {
  2322.     ;MsgBox % Name . "," . IconIndex . "," . cVar
  2323.     if ( Name = "Lock_UI_CheckBox" )
  2324.     {
  2325.         if GUI_Options_Lock_Window
  2326.         {
  2327.             ;it's locked
  2328.             GuiControl Show, Gui_Base_CheckBox_Pressed_Checked_Array%CheckBoxIndex%
  2329.             GuiControl Show, Gui_Base_Label_VControl_Array%CheckBoxIndex%
  2330.         }
  2331.         else
  2332.         {
  2333.             GuiControl Show, Gui_Base_CheckBox_Normal_Array%CheckBoxIndex%
  2334.             GuiControl Show, Gui_Base_Label_VControl_Array%CheckBoxIndex%
  2335.         }
  2336.     }
  2337.     if ( Name = "Lock_Icons_CheckBox" )
  2338.     {
  2339.         if GUI_Options_Lock_Icons
  2340.         {
  2341.             GuiControl Show, Gui_Base_CheckBox_Pressed_Checked_Array%CheckBoxIndex%
  2342.             GuiControl Show, Gui_Base_Label_VControl_Array%CheckBoxIndex%
  2343.         }
  2344.         else
  2345.         {
  2346.             GuiControl Show, Gui_Base_CheckBox_Normal_Array%CheckBoxIndex%
  2347.             GuiControl Show, Gui_Base_Label_VControl_Array%CheckBoxIndex%
  2348.         }
  2349.     }
  2350.     if ( Name = "Lock_Confine_Icons" )
  2351.     {
  2352.         if GUI_Options_Lock_Icons_TO_Window
  2353.         {
  2354.             GuiControl Show, Gui_Base_CheckBox_Pressed_Checked_Array%CheckBoxIndex%
  2355.             GuiControl Show, Gui_Base_Label_VControl_Array%CheckBoxIndex%
  2356.         }
  2357.         else
  2358.         {
  2359.             GuiControl Show, Gui_Base_CheckBox_Normal_Array%CheckBoxIndex%
  2360.             GuiControl Show, Gui_Base_Label_VControl_Array%CheckBoxIndex%
  2361.         }
  2362.     }
  2363. }
  2364. GUI_Base_Show_Options()
  2365. {
  2366.     GuiControl Hide, Small_Window_Frame
  2367.     GuiControl Show, Big_Window_Frame
  2368.     ;GuiControlGet, Static_Control_Path,, Static2
  2369.     ControlGetPos, SmallUI_X, SmallUI_Y, SmallUI_Width, SmallUI_Height, Static2, , ,
  2370.     ControlGetPos, UI_X, UI_Y, UI_Width, UI_Height, Static1,ahk_id %MyGuiHWND% , , ,
  2371.     ;MsgBox 1 %UI_Width% %Static2_Control_Path%
  2372.    
  2373.    
  2374.     ;WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  2375.     SizeX := floor( UI_Width / GUI_Base_Grid )
  2376.     SizeY := floor( UI_Height / GUI_Base_Grid )
  2377.     ;MsgBox % SizeX . " - " . SizeY
  2378.    
  2379.     GUI_Base_Window_Frame_Size := 20 ;make this a global!
  2380.     Loop %SizeX%
  2381.     {
  2382.         if ( a_index < ( SmallUI_X + SmallUI_Width ) / GUI_Base_Grid )
  2383.         {
  2384.             ;
  2385.             ;Sleep, 300
  2386.             ;continue
  2387.         }
  2388.        
  2389.         MultiplyerX := floor(( SmallUI_Width / GUI_Base_Grid ) + ( a_index * 3 ) - (GUI_Base_Window_Frame_Size / GUI_Base_Grid) )
  2390.  
  2391.         if ( MultiplyerX > SizeX )
  2392.             break
  2393.    
  2394.         X_Index := MultiplyerX
  2395.         Loop %SizeY%
  2396.         {
  2397.             MultiplyerY := ( a_index * 3 )
  2398.            
  2399.             ;ToolTip % "X: " . MultiplyerX . "Y: " . MultiplyerY . "`nGrid Coords: " . GUI_Base_GridX[MultiplyerX,MultiplyerY] . " " . GUI_Base_GridY[MultiplyerX,MultiplyerY] . "`nOccupied? " . GUI_Base_GridOccupiedName[MultiplyerX,MultiplyerY]
  2400.             ;Sleep, 100
  2401.            
  2402.             if ( MultiplyerY > SizeY )
  2403.                 break
  2404.  
  2405.             if ( GUI_Base_GridOccupiedName[MultiplyerX,MultiplyerY] != "" )
  2406.             {
  2407.                 ;MsgBox % GUI_Base_GridOccupiedIconType[MultiplyerX,MultiplyerY]
  2408.                 Type        := GUI_Base_GridOccupiedIconType[MultiplyerX,MultiplyerY]
  2409.                
  2410.                 Static_ID   := GUI_Base_GridOccupiedStatic[MultiplyerX,MultiplyerY]
  2411.                 IconIndex   := GUI_Base_GridOccupiedIconIndex[MultiplyerX,MultiplyerY]
  2412.                 Name        := GUI_Base_GridOccupiedName[MultiplyerX,MultiplyerY]
  2413.                 cVar        := GUI_Base_GridOccupiedIconcVar[MultiplyerX,MultiplyerY]
  2414.                 ToolTip, %Name% - %Type% Index: %IconIndex% `nStatic ID: %Static_ID%`cVar: %cVar%
  2415.                 ;Sleep, 500
  2416.                
  2417.                 if ( Type = "Default_Label" )
  2418.                     continue
  2419.  
  2420.                 if ( Type = "Default_Icon" )
  2421.                 {
  2422.                     GUI_To_Show := "GUI_Base_GridOccupiedIconcVar" . IconIndex
  2423.                     GuiControl Show, %cVar%
  2424.                     GUI_Base_Un_Highlight_Icon(IconIndex,Static_ID)
  2425.                     continue
  2426.                 }
  2427.                 if ( Type = "Default_Checkbox" OR Type = "Default_Label")
  2428.                 {
  2429.                     Gui_Base_Show_CheckBox(Name,IconIndex,cVar)
  2430.                     continue
  2431.                    
  2432.                 }
  2433.                 if ( Type = "Volume_Slider")
  2434.                 {
  2435.                     GUI_To_Show := "GUI_Base_SliderBar_VControl_Array" . IconIndex
  2436.                     GuiControl Show, %GUI_To_Show%
  2437.                     GUI_To_Show := "GUI_Base_SliderBar_Indicator_VControl_Array" . IconIndex
  2438.                     GuiControl Show, %GUI_To_Show%
  2439.                     continue
  2440.                 }
  2441.                 if ( Name = "UI_PlayButton_Normal")
  2442.                 {
  2443.                     GUI_To_Show := "GUI_Base_PlayButton_VControl_Array"
  2444.                     GuiControl Show, %GUI_To_Show%
  2445.                     continue
  2446.                 }
  2447.                
  2448.                
  2449.                
  2450.                
  2451.                 MsgBox, trying to show.... %Name% `n %Type%
  2452.             }
  2453.         }
  2454.     }
  2455. }
  2456. GUI_Base_Hide_Options()
  2457. {
  2458.     GuiControl Hide, Small_Window_Frame
  2459.     GuiControl Show, Big_Window_Frame
  2460.     ;GuiControlGet, Static_Control_Path,, Static2
  2461.     ControlGetPos, SmallUI_X, SmallUI_Y, SmallUI_Width, SmallUI_Height, Static2, , ,
  2462.     ControlGetPos, UI_X, UI_Y, UI_Width, UI_Height, Static1,ahk_id %MyGuiHWND% , , ,
  2463.     ;MsgBox 1 %UI_Width% %Static2_Control_Path%
  2464.    
  2465.    
  2466.     ;WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  2467.     SizeX := floor( UI_Width / GUI_Base_Grid )
  2468.     SizeY := floor( UI_Height / GUI_Base_Grid )
  2469.     ;MsgBox % SizeX . " - " . SizeY
  2470.    
  2471.     GUI_Base_Window_Frame_Size := 20 ;make this a global!
  2472.     Loop %SizeX%
  2473.     {
  2474.         if ( a_index < ( SmallUI_X + SmallUI_Width ) / GUI_Base_Grid )
  2475.         {
  2476.             ;
  2477.             ;Sleep, 300
  2478.             ;continue
  2479.         }
  2480.        
  2481.         MultiplyerX := floor(( SmallUI_Width / GUI_Base_Grid ) + ( a_index * 3 ) - (GUI_Base_Window_Frame_Size / GUI_Base_Grid) )
  2482.  
  2483.         if ( MultiplyerX > SizeX )
  2484.             break
  2485.    
  2486.         X_Index := MultiplyerX
  2487.         Loop %SizeY%
  2488.         {
  2489.             MultiplyerY := ( a_index * 3 )
  2490.            
  2491.             ;ToolTip % "X: " . MultiplyerX . "Y: " . MultiplyerY . "`nGrid Coords: " . GUI_Base_GridX[MultiplyerX,MultiplyerY] . " " . GUI_Base_GridY[MultiplyerX,MultiplyerY] . "`nOccupied? " . GUI_Base_GridOccupiedName[MultiplyerX,MultiplyerY]
  2492.             ;Sleep, 100
  2493.            
  2494.             if ( MultiplyerY > SizeY )
  2495.                 break
  2496.  
  2497.             if ( GUI_Base_GridOccupiedName[MultiplyerX,MultiplyerY] != "" )
  2498.             {
  2499.                 ;MsgBox % GUI_Base_GridOccupiedIconType[MultiplyerX,MultiplyerY]
  2500.                 Type        := GUI_Base_GridOccupiedIconType[MultiplyerX,MultiplyerY]
  2501.                
  2502.                 Static_ID   := GUI_Base_GridOccupiedStatic[MultiplyerX,MultiplyerY]
  2503.                 IconIndex   := GUI_Base_GridOccupiedIconIndex[MultiplyerX,MultiplyerY]
  2504.                 Name        := GUI_Base_GridOccupiedName[MultiplyerX,MultiplyerY]
  2505.                 cVar        := GUI_Base_GridOccupiedIconcVar[MultiplyerX,MultiplyerY]
  2506.                 ;ToolTip, %Name% - %Type% Index: %IconIndex% `nStatic ID: %Static_ID%`cVar: %cVar%
  2507.                 ;Sleep, 100
  2508.                 if ( Type = "Default_Label" )
  2509.                     continue
  2510.                
  2511.                
  2512.                 if ( Type = "Default_Icon" )
  2513.                 {
  2514.                     GUI_To_Show := "GUI_Base_GridOccupiedIconcVar" . IconIndex
  2515.                     GuiControl Hide, %cVar%
  2516.                     GUI_Base_Hide_Icon_Frame(IconIndex,Static_ID)
  2517.                     ;GUI_ActualFrameName := GUI_Base_Icon_ControlVLabel[IconIndex,a_index]
  2518.                     ;GUI_Base_Un_Highlight_Icon(IconIndex,Static_ID)
  2519.                    
  2520.                     continue
  2521.                 }
  2522.                 if ( Type = "Default_Checkbox" )
  2523.                 {
  2524.                     Gui_Base_Hide_CheckBox(Name,IconIndex,cVar)
  2525.                     continue
  2526.                    
  2527.                 }
  2528.                 if ( Type = "Volume_Slider")
  2529.                 {
  2530.                     GUI_To_Hide := "GUI_Base_SliderBar_VControl_Array" . IconIndex
  2531.                     GuiControl Hide, %GUI_To_Hide%
  2532.                     GUI_To_Hide := "GUI_Base_SliderBar_Indicator_VControl_Array" . IconIndex
  2533.                     GuiControl Hide, %GUI_To_Hide%
  2534.                     continue
  2535.                 }
  2536.                 if ( Name = "UI_PlayButton_Normal")
  2537.                 {
  2538.                     ;MsgBox, Found it
  2539.  
  2540.                     GuiControl Hide, GUI_Base_PlayButton_VControl_Array
  2541.                     continue
  2542.                 }
  2543.                
  2544.                 MsgBox, trying to hide.... %Name%
  2545.             }
  2546.         }
  2547.     }
  2548. }
  2549.  
  2550. GUI_Base_Icon_Grab(IconIndex,StaticId,VControl)
  2551. {
  2552.     HasCreep := false
  2553.     HasLabel := false
  2554.  
  2555.     Coordmode, mouse, screen
  2556.     ;ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %StaticId%, , , ,
  2557.     ;MsgBox, %IconIndex% %StaticId% %VControl%
  2558.     WinGetPos, Main_Window_X, Main_Window_Y, Main_Window_Width, Main_Window_Height, ahk_id %MyGuiHWND%
  2559.    
  2560.     ;ToolTip % UI_IconListLabel[Icon_Index] . Icon_Index
  2561.  
  2562.     ;MouseGetPos, , , id, control
  2563.     ;ClickedID := id
  2564.     ;MouseGetPos, , , , OutputVarControl
  2565.     MouseGetPos, InitialClick_xpos, InitialClick_ypos
  2566.     ;TC := A_TickCount
  2567.  
  2568.  
  2569. ;MsgBox % GUI_Base_Icon_Current_Frame[IconIndex]
  2570.     Loop,
  2571.     {
  2572.         if ( GUI_Base_Icon[IconIndex] = "queen" AND !HasCreep ) ;OR  GUI_Base_Icon[IconIndex] = "overlord" AND !HasCreep)
  2573.             Sleep, 200
  2574.         ;else
  2575.             ;if ( GUI_Base_Icon_Current_Frame[IconIndex] = "zergframe" AND !HasCreep)
  2576.             ;Sleep, 50
  2577.         ;ToolTip % HasCreep
  2578.         ;Msgbox %IconName%
  2579.        
  2580.        
  2581.         ;MouseGetPos, , , id, control
  2582.         ;if ( id != ClickedID)
  2583.         ;{
  2584.             ;if ( ( xpos >  Main_Window_X + Main_Window_Width ) OR  ( xpos <  Main_Window_X ) OR ( ypos > Main_Window_Y + Main_Window_Height ) OR  ( ypos <  Main_Window_Y ) )
  2585.                 ;break
  2586.         ;}
  2587.         ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %StaticId%, ahk_id %MyGuiHWND%, , ,
  2588.         ;MsgBox, %StaticId% %Icon_X% %Icon_Y%
  2589.         MousePositionRelative_MainWindowX := ( InitialClick_xpos - Main_Window_X  )  ;* -1
  2590.         MousePositionRelative_MainWindowY := ( InitialClick_ypos - Main_Window_Y  )  ;* -1
  2591.        
  2592.         MousePositionRelative_IconX := ( MousePositionRelative_MainWindowX - Icon_X )
  2593.         MousePositionRelative_IconY := ( MousePositionRelative_MainWindowY - Icon_Y )
  2594.        
  2595.         ;Icon_CenterX := Icon_X + ( Icon_Width / 2 )
  2596.         ;Icon_CenterY := Icon_Y + ( Icon_Height / 2 )
  2597.        
  2598.         ;DistanceX := ( MousePositionRelative_IconX - Icon_CenterX )
  2599.         ;DistanceY := ( MousePositionRelative_IconY - Icon_CenterY )
  2600.        
  2601.         ;DistanceX := ( xpos - Icon_CenterX )
  2602.         ;DistanceY := ( ypos - Icon_CenterY )
  2603.        
  2604.         ;Distance_Icon_Mouse := MouseCoords_GetDistance(DistancjgheX, DistghjghanceY, MousePositionRelativeX, MousePositionRelativeY, Icon_CenterX, Icon_CenterY)
  2605.         ;ToolTip % Distance_Icon_Mouse . " X: " . MousePositionRelative_IconX . " Y: " . MousePositionRelative_IconY . " PrevX " . PreviousDistanceX . "PrevY "  . PreviousDistanceY
  2606.         ;Sleep, 100
  2607.        
  2608.        
  2609.         ;ControlGetPos, UI_X, UI_Y, Width, Height, %StaticId%, , , ,
  2610.         ;MsgBox, %UI_X%
  2611.         MouseDown := GetKeyState("LButton","P")
  2612.        
  2613.        
  2614.         ;MouseMovedX := MousePositionRelative_IconX ;(xpos - PreviousX) ;+ PreviousMouseMovedX
  2615.         ;MouseMovedY := MousePositionRelative_IconY ;(ypos - PreviousY) ;+ PreviousMouseMovedY
  2616.  
  2617.         MouseGetPos, xpos, ypos
  2618.         If (!MouseDown)
  2619.         {
  2620.             GUI_Base_Icon_Let_Go(IconIndex,StaticId,VControl)
  2621.             Break
  2622.         }
  2623.         ;ToolTip
  2624.         if a_index > 1
  2625.         {
  2626.            
  2627.             MouseMovedX := (xpos - InitialClick_xpos)
  2628.             MouseMovedY := (ypos - InitialClick_ypos)
  2629.             ;ToolTip, Moved %MouseMovedX% %MouseMovedY%
  2630.             IfInString, VControl, CheckBox
  2631.             {
  2632.                 HasLabel     := true
  2633.                 Label_StaticID  := GUI_Base_Label_StaticID[IconIndex]
  2634.                 Label_Name      := GUI_Base_Label_Text[IconIndex]
  2635.                 ;MsgBox, Before check grid %HasLabel% %Label_StaticID% %Label_Name%
  2636.             }
  2637.             ClearedX := false
  2638.             Icon := VControl
  2639.             if ( ( MouseMovedX > GUI_Base_Grid ) OR ( MouseMovedX < GUI_Base_Grid * -1 ) )
  2640.             {
  2641.  
  2642.                
  2643.                 CheckGridSidesIcon(ClearedX, HasCreep, StaticId, MouseMovedX,HasLabel,Label_StaticID)
  2644.                
  2645.                
  2646.                 ;UI_Icon_StaticIDByIndex[IconIndex] := SearchPath
  2647.                 ;UI_Icon_IndexByStaticID[StaticNum] := IconIndex
  2648.                 ;UI_Icon_IndexByStaticID[StaticNum]
  2649.                
  2650.                
  2651.  
  2652.                 ;MsgBox, %ClearedX%
  2653.                 if ClearedX
  2654.                 {
  2655.                    
  2656.                     if ( MouseMovedX > 0  )
  2657.                     {
  2658.                         InitialClick_xpos := ( InitialClick_xpos + GUI_Base_Grid )
  2659.                         MoveIcon(Icon, IconIndex, StaticId, 1, 0, HasLabel, Label_StaticID)
  2660.  
  2661.                     }
  2662.                     else
  2663.                     {
  2664.                         InitialClick_xpos := ( InitialClick_xpos - GUI_Base_Grid )
  2665.                         MoveIcon(Icon, IconIndex, StaticId, -1, 0, HasLabel, Label_StaticID)
  2666.  
  2667.                     }
  2668.                 }
  2669.             }
  2670.  
  2671.                 ClearedY := false
  2672.            
  2673.             if ( MouseMovedY > GUI_Base_Grid ) OR  MouseMovedY < (GUI_Base_Grid * -1)
  2674.             {
  2675.                 CheckGridAboveBelowIcon(ClearedY, HasCreep, StaticId, MouseMovedY, HasLabel, Label_StaticID)
  2676.                
  2677.                 ;MsgBox, %ClearedY%
  2678.                 if ClearedY
  2679.                 {
  2680.                    
  2681.                     if ( MouseMovedY > 0  )
  2682.                     {
  2683.                         InitialClick_ypos := ( InitialClick_ypos + GUI_Base_Grid )
  2684.                         MoveIcon(Icon, IconIndex, StaticId, 0, 1, HasLabel, Label_StaticID)
  2685.                     }
  2686.                     else
  2687.                     {
  2688.                         InitialClick_ypos := ( InitialClick_ypos - GUI_Base_Grid )
  2689.                         MoveIcon(Icon, IconIndex, StaticId, 0, -1, HasLabel, Label_StaticID)
  2690.                        
  2691.                     }
  2692.                 }
  2693.             }
  2694.         ;PreviousDistanceX := DistanceX
  2695.         ;PreviousDistanceY := DistanceY
  2696.         }
  2697.     }
  2698. }
  2699. GUI_Base_Control_Clicked(control)
  2700. {
  2701.     GuiControlGet, Clicked_Control_Path,, %control%
  2702.    
  2703.     ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %control%, ,%MyEdit% , ,
  2704.     ;MsgBox % "GUI_Base_Control_Clicked " . control
  2705.  
  2706.    
  2707.     StringReplace, Clicked_Control_Path, Clicked_Control_Path, %A_WorkingDir%,,All
  2708.     IfInString, Clicked_Control_Path, Icons
  2709.     {
  2710.         StringReplace, Clicked_Control_Path, Clicked_Control_Path, %GUI_Base_Icon_Prefix%,,All
  2711.         StringReplace, Clicked_Control_Path, Clicked_Control_Path, %GUI_Base_Icon_Suffix%,,All
  2712.     }
  2713.     else
  2714.     {
  2715.         IfInString, Clicked_Control_Path, Controls
  2716.         {
  2717.            
  2718.             StringReplace, Clicked_Control_Path, Clicked_Control_Path, %GUI_Base_CheckBox_Prefix%,,All
  2719.             StringReplace, Clicked_Control_Path, Clicked_Control_Path, %GUI_Base_CheckBox_Suffix%,,All
  2720.         }
  2721.     }
  2722.    
  2723.  
  2724.    
  2725.     ToolTip, You clicked on: %control% `n %Clicked_Control_Path%
  2726.     Loop
  2727.     {
  2728.         if !GUI_Base_Icon[A_Index] AND !Gui_Base_CheckBox_Normal_Name_Array[A_Index]
  2729.             break
  2730.        
  2731.         ;MsgBox % Gui_Base_CheckBox_Normal_Name_Array[A_Index]
  2732.        
  2733.         if ( GUI_Base_Icon[A_Index] = Clicked_Control_Path )
  2734.         {
  2735.             ;MsgBox, got it at %a_index%
  2736.             GUI_Base_Icon_Clicked(Clicked_Control_Path, A_Index,control)
  2737.         }
  2738.         else
  2739.         {
  2740.             ;MsgBox % GUI_Base_CheckBox_Normal_StaticID[A_Index] . " " . A_Index
  2741.             if (GUI_Base_CheckBox_Normal_StaticID[A_Index] = control OR  Gui_Base_CheckBox_Pressed_Checked_StaticID[A_Index] = control )
  2742.             {
  2743.                     GUI_Base_CheckBox_Clicked(Clicked_Control_Path, A_Index,control)
  2744.             }
  2745.             else
  2746.             {
  2747.                 if (GUI_Base_SliderBar_StaticID[A_Index] = control OR  GUI_Base_SliderBar_Indicator_StaticID[A_Index] = control )
  2748.                 {
  2749.                     UI_SliderBar_AlertVolume_Clicked(control, Clicked_Control_Path, A_Index)
  2750.                    
  2751.                         ;GUI_Base_CheckBox_Clicked(Clicked_Control_Path, A_Index,control)
  2752.                 }
  2753.                 else
  2754.                 {
  2755.                     if (GUI_Base_PlayButton_StaticID[A_Index] = control )
  2756.                     {
  2757.                         ;UI_SliderBar_AlertVolume_Clicked(control, Clicked_Control_Path, A_Index)
  2758.                         UI_AnnouncementPreview_Clicked(control, Clicked_Control_Path, A_Index)
  2759.                             ;GUI_Base_CheckBox_Clicked(Clicked_Control_Path, A_Index,control)
  2760.                     }
  2761.                 }
  2762.  
  2763.             }
  2764.         }
  2765.     }
  2766. }
  2767.  
  2768.  
  2769. GUI_Base_ProcessCheckBox(Switch,Clicked_Control_Name,CheckBoxIndex,StaticID)
  2770. {
  2771.     ;MsgBox, %Switch%,%Clicked_Control_Name%,%CheckBoxIndex%,%StaticID%
  2772.     ;MsgBox % Gui_Base_Label_Text[CheckBoxIndex]
  2773.     if ( Gui_Base_Label_Text[CheckBoxIndex] = "Auto Inject" )
  2774.         Game_Scripts_Auto_Inject_Toggle(Switch)
  2775.     else if ( Gui_Base_Label_Text[CheckBoxIndex] = "Auto Ping" )
  2776.         Game_Scripts_Auto_Ping_Toggle(Switch)
  2777.     else if ( Gui_Base_Label_Text[CheckBoxIndex] = "Lock Icons" )
  2778.     {
  2779.         GUI_Options_Lock_Icons := Switch
  2780.     }
  2781.     else if ( Gui_Base_Label_Text[CheckBoxIndex] = "Lock Window" )
  2782.     {
  2783.         GUI_Options_Lock_Window := Switch
  2784.     }
  2785.     else if ( Gui_Base_Label_Text[CheckBoxIndex] = "Confine Icons" )
  2786.     {
  2787.         GUI_Options_Lock_Icons_TO_Window := Switch
  2788.     }
  2789. }
  2790. Game_Scripts_Auto_Inject_Toggle(Switch)
  2791. {
  2792.     MsgBox, Game_Scripts_Auto_Inject_Toggle %Switch%
  2793. }
  2794. Game_Scripts_Auto_Ping_Toggle(Switch)
  2795. {
  2796.     MsgBox, Game_Scripts_Auto_Ping_Toggle %Switch%
  2797. }
  2798. ;~ global Gui_Base_CheckBox_Normal_Name_Array := []
  2799. ;~ global Gui_Base_CheckBox_Count := 0
  2800. ;~ global Gui_Base_CheckBox_Normal_Array := []
  2801. ;~ global Gui_Base_CheckBox_Normal_Over_Array := []
  2802. ;~ global Gui_Base_CheckBox_Pressed_Array := []
  2803. ;~ global Gui_Base_CheckBox_Pressed_Over_Array := []
  2804. ;~ global Gui_Base_CheckBox_Pressed_Checked_Array := []
  2805. ;~ global Gui_Base_CheckBox_Pressed_Over_Checked_Array := []
  2806.  
  2807. InstallFont(font)
  2808. {
  2809.     ;ToolTip, installing font: %font%
  2810.     ;sleep, 500
  2811.     DllCall( "AddFontResource", Str,font )
  2812.     SendMessage,  0x1D,,,, ahk_id 0xFFFF ; Broadcast the change
  2813. }
  2814.  
  2815. IsFont(FontName)
  2816. {
  2817.     ;MsgBox, % IsFont("qtypesquare-Light")
  2818.     Loop, HKLM, SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
  2819.     {
  2820.        
  2821.         If (RegExMatch(A_LoopRegName, "^" . FontName . " \(") > 0)
  2822.         {
  2823.             Return 1
  2824.         }
  2825.     }
  2826.    
  2827.     Return 0
  2828.    
  2829. }
  2830.  
  2831. GUI_Base_Check_Install_Fonts()
  2832. {
  2833.     if !IsFont("QTypeSquare-Bold")
  2834.         InstallFont(ToolTipFontBold)
  2835.        
  2836.     if !IsFont("QTypeSquare-Light")
  2837.         InstallFont(ToolTipFontLight)
  2838.        
  2839.     if !IsFont("QTypeSquare-Medium")
  2840.         InstallFont(ToolTipFontMedium)
  2841. }
  2842. Debug_ToolTip(tip, sleep = 0)
  2843. {
  2844.     if Debug_ToolTips
  2845.     {
  2846.         ToolTip, %tip%
  2847.         Sleep, %sleep%
  2848.     }  
  2849.    
  2850. }
  2851. GetClosestGrid(ToX, ToY, ByRef ClosestX, ByRef ClosestY, ByRef Closest)
  2852. {
  2853.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %MyGuiHWND%
  2854.  
  2855.     SizeX := floor( Width / GUI_Base_Grid )
  2856.     SizeY := floor( Height / GUI_Base_Grid )
  2857.     Closest := 1000
  2858.     Loop %SizeX%
  2859.     {
  2860.         X_Index := a_index + 1
  2861.         Loop %SizeY%
  2862.         {
  2863.             Y_Index := a_index + 1
  2864.            
  2865.            
  2866.             blahx := GUI_Base_GridX[X_Index,Y_Index]
  2867.             blahy := GUI_Base_GridY[X_Index,Y_Index]
  2868.             ;MsgBox % GUI_GridX[X_Index,Y_Index] . " X: " . X_Index . " Y: " Y_Index
  2869.             Distance := MouseCoords_GetDistance(blahx, blahy, ToX, ToY)
  2870.            
  2871.             ;Sleep, 1000
  2872.             if ( Distance < Closest AND Distance > 1 )
  2873.             {
  2874.  
  2875.                 Closest := Distance
  2876.                 ClosestX := X_Index
  2877.                 ClosestY := Y_Index
  2878.                 ;ToolTip, Distance: %Distance%  Closest %Closest%
  2879.                 ;Sleep, 100
  2880.                
  2881.             }
  2882.         }
  2883.            
  2884.     }
  2885. }
  2886.  
  2887. MouseCoords_GetDistance(fromX, fromY, toX, toY)
  2888. {
  2889.     if fromX > toX
  2890.         distanceX := fromX - toX
  2891.     else
  2892.         distanceX := toX - fromX
  2893.        
  2894.     if distanceX < 0
  2895.         distanceX := distanceX * -1
  2896.        
  2897.     if fromY > toY
  2898.         distanceY := fromY - toY
  2899.     else
  2900.         distanceY := toY - fromY
  2901.                
  2902.     if distanceY < 0
  2903.         distanceY := distanceY * -1
  2904.        
  2905.     return (distanceX + distanceY)
  2906. }
  2907.  
  2908.  
  2909. ToggleWatchGrids()
  2910. {
  2911.     if GUI_Base_Grid_Watching
  2912.         SetTimer WatchGrids, OFF
  2913.     else
  2914.         SetTimer WatchGrids, 100
  2915.    
  2916.    
  2917.     GUI_Base_Grid_Watching := !GUI_Base_Grid_Watching
  2918.     Sleep, -1
  2919.     ToolTip
  2920. }
  2921.  
  2922. GUI_Big_Window_Frame_Clicked:
  2923.     MouseGetPos, , , id, control
  2924.    
  2925.    
  2926.    
  2927.  
  2928.    
  2929.     StrSplit(StaticNum, %control%, "Static")
  2930.     StringReplace, StaticNum, control, Static,,All
  2931.    
  2932.     ToolTip, GUI_Big_Window_Frame_Clicked Window Static %control%
  2933.     if ( StaticNum > 2 )
  2934.         GUI_Base_Control_Clicked(control)
  2935.     else
  2936.         UI_MainWindowClicked()
  2937.    
  2938.    
  2939. return
  2940. GUI_Big_Window_Fill_Clicked:
  2941.     MouseGetPos, , , id, control
  2942.     ToolTip, GUI_Big_Window_Frame_Clicked Window Static %control%
  2943.  
  2944.         UI_MainWindowClicked()
  2945. return
  2946.  
  2947.  
  2948.  
  2949.  
  2950. WatchGrids:
  2951.     if !GUI_Base_Grid_Watching
  2952.     {
  2953.         ToolTip
  2954.         return
  2955.     }
  2956.     CoordMode, Pixel, Screen
  2957.     Coordmode, mouse, relative
  2958.    
  2959.     MouseGetPos, , , id, control
  2960.     GuiControlGet, control, Pos
  2961.     WinGetTitle, title, ahk_id %id%
  2962.     WinGetClass, class, ahk_id %id%
  2963.     ControlGetPos, CUI_X, CUI_Y, CWidth, CHeight, ahk_class %control%, , , ,
  2964.     WinGetPos, UI_X, UI_Y, Width, Height, ahk_id %id%
  2965.    
  2966.     MouseGetPos, xpos, ypos
  2967.     RelX := (UI_X - xpos) * -1
  2968.     RelY := (UI_Y - ypos) * -1
  2969.     xpos := xpos + 20
  2970.     ypos := ypos + 20
  2971.     GetClosestGrid(xpos, ypos, X_Index, Y_Index, Distance)
  2972.     ;ToolTip, Closest Grid is: %X_Index% %X_Index% %Distance% %RelY%
  2973.  
  2974. s := "Relative Mouse Pos:`t`t`t[" . RelX . ", " . RelY . "]`nClosest Grid:`t`t`t[" . X_Index . "," . Y_Index . "]`nGUI_Base_GridOccupied:`t`t" . GUI_Base_GridOccupied[X_Index,Y_Index] . "`nGUI_Base_GridOccupiedName:`t`t" . GUI_Base_GridOccupiedName[X_Index,Y_Index] . "`nGUI_Base_GridOccupiedStatic:`t`t" . GUI_Base_GridOccupiedStatic[X_Index,Y_Index] . "`nGUI_Base_GridOccupiedIconIndex:`t" . GUI_Base_GridOccupiedIconIndex[X_Index,Y_Index] . "`nGUI_Base_GridOccupiedIconcVar:`t" . GUI_Base_GridOccupiedIconcVar[X_Index,Y_Index] . "`nGUI_Base_GridOccupiedIconType:`t" . GUI_Base_GridOccupiedIconType[X_Index,Y_Index]
  2975.  
  2976. ToolTip, %s%
  2977. return
  2978.  
  2979.  
  2980.  
  2981.  
  2982.  
  2983.  
  2984.  
  2985.  
  2986.  
  2987.  
  2988.  
  2989.  
  2990.  
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006. UI_AnnouncementPreview_Clicked(control, Clicked_Control_Path, Control_Index)
  3007. {
  3008.     ;MsgBox, %control% kk %Clicked_Control_Path% kk %Control_Index%
  3009.     if ( GUI_Base_User_In_Options AND Control_Name != "visitthelab" AND !GUI_Options_Lock_Icons )
  3010.     {
  3011.         GUI_Base_Hide_Icon_Frame(IconIndex,control)
  3012.         VControl := "GUI_Base_PlayButton_VControl_Array"
  3013.         GUI_Base_Icon_Grab(Control_Index,control,VControl)
  3014.         return
  3015.     }
  3016.     else
  3017.     {
  3018.         ;
  3019.        
  3020.         GUI_Base_User_Last_Clicked_Index := Control_Index
  3021.         GuiControl Hide, GUI_Base_PlayButton_VControl_Array
  3022.         GuiControl Show, GUI_Base_PlayButton_Highlighted_VControl_Array
  3023.     }
  3024.    
  3025.    
  3026.     Sleep, 100
  3027.     MouseGetPos, , , id, control
  3028.     GUI_Base_User_Last_Clicked := control
  3029.     Loop,
  3030.     {
  3031.         Sleep, 10
  3032.         MouseDown:=GetKeyState("LButton","P")
  3033.         if !MouseDown
  3034.            Break
  3035.  
  3036.         ;MsgBox % GUI_Base_User_Last_Clicked
  3037.  
  3038.        ; LastControl := control
  3039.         MouseGetPos, , , id, control
  3040.        ; Uncomment to have box go back to normal once you leave the box instead of when you let go of click
  3041.         if (control != GUI_Base_User_Last_Clicked)
  3042.         {
  3043.             GuiControl Show, GUI_Base_PlayButton_VControl_Array
  3044.             GuiControl Hide, GUI_Base_PlayButton_Highlighted_VControl_Array
  3045.             break
  3046.         }
  3047.     }
  3048.      UI_AnnouncementPreview_Clicked_LetGo(Control_Name,IconIndex,control)
  3049. }
  3050.  
  3051. UI_Run_Timer()
  3052. {
  3053.     SetTimer, ResetPreviewButton, 3000
  3054. }
  3055.  
  3056. Nice_UI_AnnouncementPreview_Clicked_LetGo(Clicked_Control_Name,IconIndex,StaticID)
  3057. {
  3058.     global
  3059.    
  3060.    
  3061.     MouseGetPos, , , id, control
  3062.     ;ToolTip, GUI_Base_Icon_Click_LetGo New control: %control% `nOld id %GUI_Base_User_Last_Clicked%
  3063.  
  3064.     if ( control = GUI_Base_User_Last_Clicked )
  3065.     {
  3066.         PlaySoundEffect("BeepBoop", 5000)
  3067.        
  3068.         GuiControl Hide, GUI_Base_PlayButton_Highlighted_VControl_Array
  3069.         GuiControl Show, GUI_Base_PlayButton_Playing_VControl_Array
  3070.        
  3071.         SetTimer, ResetPreviewButton, 3000
  3072.         GUI_Options_Preview_Playing := true
  3073.     }
  3074.     else
  3075.     {
  3076.         GuiControl Hide, GUI_Base_PlayButton_Highlighted_VControl_Array
  3077.         GuiControl Show, GUI_Base_PlayButton_VControl_Array
  3078.     }
  3079.    
  3080.     Timer_First_Run := true
  3081.    
  3082.     ResetPreviewButton:
  3083.         if !Timer_First_Run
  3084.         {
  3085.             MsgBox, Reset!
  3086.             GuiControl Hide, GUI_Base_PlayButton_Playing_VControl_Array
  3087.             GuiControl Show, GUI_Base_PlayButton_VControl_Array
  3088.             GUI_Options_Preview_Playing := false
  3089.             Timer_First_Run := true ;prevent it running twice
  3090.             SetTimer, ResetPreviewButton, OFF
  3091.         }
  3092.         else
  3093.             Timer_First_Run := false
  3094.     Return
  3095. }
  3096. UI_ResetPreviewButton()
  3097. {
  3098.     MsgBox, Reset!
  3099.     GuiControl Hide, GUI_Base_PlayButton_Playing_VControl_Array
  3100.     GuiControl Show, GUI_Base_PlayButton_VControl_Array
  3101.     GUI_Options_Preview_Playing := false
  3102.     SetTimer, ResetPreviewButton, OFF
  3103. }
  3104. UI_Temp_ResetPreviewButton_Timer(Time_To_Run)
  3105. {
  3106.     Timer_Started := A_TickCount
  3107.     ToolTip, starting fake timer
  3108.     Sleep, 100
  3109.     Loop,
  3110.     {
  3111.         ElapsedTime := A_TickCount - Timer_Started
  3112.         ToolTip, ElapsedTime: %ElapsedTime%
  3113.         if ( ElapsedTime > Time_To_Run )
  3114.         {
  3115.             UI_ResetPreviewButton()
  3116.             break
  3117.         }
  3118.         Sleep, 10
  3119.     }
  3120. }
  3121.  
  3122.  
  3123.  
  3124. PlaySoundEffect(Sound, timer)
  3125. {
  3126.     ;MsgBox % Sound
  3127.     if MuteMusic
  3128.         return
  3129.  
  3130.  
  3131.     Path := "\GUI_Resources\Audio\"
  3132.     SoundFile := A_WorkingDir . Path . Sound ".mp3"
  3133.  
  3134.     ;mciSendString("open " """" SoundFile """" " type mpegvideo Alias " CurrentName)
  3135.    
  3136.     ;MsgBox, %Sound% `nfile: %SoundFile% `nVolume: %GUI_Options_MasterVolume%
  3137.     mciSendString("close " GUI_Options_LastSoundEffectUsed)
  3138.     mciSendString("close " """" SoundFile """" " type mpegvideo Alias " Sound)
  3139.     mciSendString("open " """" SoundFile """" " type mpegvideo Alias " Sound)
  3140.     mciSendString("setaudio " Sound " volume to " GUI_Options_MasterVolume)
  3141.     mciSendString("play " Sound)
  3142.    
  3143.    
  3144.    
  3145.    
  3146.    
  3147.     GUI_Options_LastSoundEffectUsed := Sound
  3148.     ;MsgBox, LSEU %GUI_Options_LastSoundEffectUsed%
  3149.     ;Sleep, %timer%
  3150.     ;mciSendString("close " Sound)
  3151.     ;mciSendString("open " """" SoundFile """" " type mpegvideo Alias Sound")
  3152.    
  3153.     ;PreLoadAudioFiles()
  3154.  
  3155.     ;SetTimer, ResetSoundEffect, %timer%
  3156. }
  3157.  
  3158. UI_SliderBar_AlertVolume_Clicked(StaticId, Clicked_Control_Path, SliderIndex)
  3159. {
  3160.     MouseGetPos, , , id, control
  3161.  
  3162.     Coordmode, mouse, screen
  3163.  
  3164.     ;PressedcVar :=
  3165.     Gui_To_Show := "GUI_Base_SliderBar_Indicator_Pressed_VControl_Array" . SliderIndex
  3166.     GuiControl Show, %Gui_To_Show%
  3167.     Gui_To_Hide := "GUI_Base_SliderBar_Indicator_VControl_Array" . SliderIndex
  3168.     GuiControl Hide, %Gui_To_Hide%
  3169.  
  3170.     Main_Window := "Static1"
  3171.     SliderBar_Bar := GUI_Base_SliderBar_StaticID[SliderIndex]
  3172.     ControlGetPos, SliderBar_Bar_UI_X, SliderBar_Bar_UI_Y, SliderBar_Bar_Width, SliderBar_Bar_Height, %SliderBar_Bar%, , , ,
  3173.    
  3174.  
  3175.     WinGetPos, Main_Window_X, Main_Window_Y, Main_Window_Width, Main_Window_Height, ahk_id %id%
  3176.     SliderBar_Normal := GUI_Base_SliderBar_Indicator_StaticID[SliderIndex]
  3177.     SliderBar_Pushed := GUI_Base_SliderBar_Indicator_Pressed_StaticID[SliderIndex]
  3178.  
  3179.     ControlGetPos, Indicator_UI_X, Indicator_UI_Y, Indicator_UI_XWidth, Indicator_UI_XHeight, %SliderBar_Normal%, , , ,
  3180.     ;MsgBox % Indicator_UI_X
  3181.  
  3182.     ;ControlGetPos, Main_Window_X, Main_Window_Y, Main_Window_Width, Main_Window_Height, %Main_Window%, , , ,
  3183.     ;Msgbox, X%Main_Window_X% Y%Main_Window_Y% W%Main_Window_Width% H%Main_Window_Height%
  3184.  
  3185.     MouseGetPos, , , id, control
  3186.     MouseGetPos, , , , OutputVarControl
  3187.     TC := A_TickCount
  3188.     Loop,
  3189.     {
  3190.         ControlGetPos, UI_X, UI_Y, Width, Height, Static%StaticId%, , , ,
  3191.         MouseDown := GetKeyState("LButton","P")
  3192.         MouseGetPos, xpos, ypos
  3193.  
  3194.         MousePositionRelative := ( xpos - Main_Window_X  ) - 5 ;* -1
  3195.  
  3196.         ;MsgBox, MW %Main_Window_X% Mouse %xpos% Test: %TestOffset%
  3197.         ;ToolTip, MouseX: %xpos% controlpos: %UI_X% TestX: %TestOffset% TestX2: %TestOffset2%
  3198.         If (!MouseDown)
  3199.         {
  3200.             LongClick=0
  3201.             Break
  3202.         }
  3203.         ;Msgbox, X%SliderBar_Bar_UI_X% Y%SliderBar_Bar_UI_Y% W%SliderBar_Bar_Width% H%SliderBar_Bar_Height%
  3204.  
  3205.         NewX := MousePositionRelative
  3206.         if ( NewX > SliderBar_Bar_UI_X + SliderBar_Bar_Width )
  3207.             NewX := SliderBar_Bar_UI_X + SliderBar_Bar_Width
  3208.         else
  3209.         if ( NewX < SliderBar_Bar_UI_X )
  3210.             NewX := SliderBar_Bar_UI_X
  3211.  
  3212.         ;Percent := ( ( NewX - SliderBar_Bar_UI_X ) / SliderBar_Bar_Width ) * 100
  3213.         GUI_Options_MasterVolume := floor( ( ( NewX - SliderBar_Bar_UI_X ) / SliderBar_Bar_Width ) * 1000)
  3214.         ToolTip, Adjusting slider: %GUI_Options_MasterVolume%
  3215.  
  3216.         GuiControl, Move, %SliderBar_Normal%, x%NewX% y%Indicator_UI_Y% ;<-original
  3217.         ;;Gui, Show, x%NewX% y%NewY% , %UI_SliderBar_Indicator%
  3218.         ;GuiControl Show, UI_SliderBar_Indicator_Pressed
  3219.         GuiControl, Move, %SliderBar_Pushed%, x%NewX% y%Indicator_UI_Y% ;<-original
  3220.        
  3221.         if GUI_Options_Preview_Playing
  3222.         {
  3223.             ;MsgBox, slider moved while playing effect: %GUI_Options_LastSoundEffectUsed% setting Volume to: %GUI_Options_MasterVolume%
  3224.             mciSendString("setaudio " GUI_Options_LastSoundEffectUsed " volume to " GUI_Options_MasterVolume)
  3225.         }
  3226.            
  3227.     }
  3228.      UI_SliderBar_AlertVolume_ClickedLetGo(SliderIndex)
  3229. ;}
  3230. return
  3231. }
  3232.  
  3233. UI_SliderBar_AlertVolume_ClickedLetGo(SliderIndex)
  3234. {
  3235.     ;controlgetpos,x,y,width,height,,ahk_id %id%
  3236.     ;Sleep, 1000
  3237.     ;MouseGetPos, , , id, control
  3238.     ;ToolTip, New control: %control% `nOld id %UI_LastClicked%
  3239.     ;Sleep, 3000
  3240.    
  3241.     GuiControl Hide, UI_SliderBar_Indicator_Pressed
  3242.     GuiControl Show, UI_SliderBar_Indicator
  3243.    
  3244.     Gui_To_Hide := "GUI_Base_SliderBar_Indicator_Pressed_VControl_Array" . SliderIndex
  3245.     GuiControl Hide, %Gui_To_Hide%
  3246.     Gui_To_Show := "GUI_Base_SliderBar_Indicator_VControl_Array" . SliderIndex
  3247.     GuiControl Show, %Gui_To_Show%
  3248.    
  3249.    
  3250.     if ( control = UI_LastClicked )
  3251.     {
  3252.         ;nothing
  3253.     }
  3254.     else
  3255.     {
  3256.         ;nothing
  3257.     }
  3258. }
  3259.  
  3260.  
  3261. mciSendString(Command) {
  3262.    Return, DllCall("winmm.dll\mciSendString", Str,Command, Str,"", Int,0, Int,0)
  3263.    }
  3264.  
  3265.  
  3266.  
  3267.  
  3268. reset()
  3269. {
  3270.     global
  3271.     GuiControl Hide, GUI_Base_PlayButton_Playing
  3272.     GuiControl Show, GUI_Base_PlayButton_Normal
  3273.    
  3274.     Static_ID := GUI_Base_PlayButton_Playing_StaticID[1]
  3275.     ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %Static_ID%, ahk_id %MyGuiHWND%, , ,
  3276.     MsgBox % "1. " . GUI_Base_PlayButton_StaticID[1] . "`n2 " . GUI_Base_PlayButton_Highlighted_StaticID[1] . "`n3 " . GUI_Base_PlayButton_Playing_StaticID[1]
  3277.     MsgBox, %Icon_X% - %Icon_Y%  - %Icon_Width%  - %Icon_Height%
  3278.    
  3279.    
  3280.    
  3281.    
  3282. }
  3283.  
  3284.  
  3285.  
  3286.  
  3287. ResetPrevitewButtonTEST:
  3288.     GUI_Base_PlayButton_Playing_VControl_Array := %GUI_Base_PlayButton_Playing_VControl_Array%
  3289.     GuiControl Hide, GUI_Base_PlayButton_Playing_VControl_Array
  3290.     GuiControl Show, GUI_Base_PlayButton_VControl_Array
  3291.     MsgBox % "1. " . GUI_Base_PlayButton_StaticID[1] . "`n2 " . GUI_Base_PlayButton_Highlighted_StaticID[1] . "`n3 " . GUI_Base_PlayButton_Playing_StaticID[1]
  3292.  
  3293.  
  3294.     Play := GUI_Base_PlayButton_StaticID[1]
  3295.     Path := GUI_Base_PlayButton_StaticID_Path[1]
  3296.    
  3297.     MsgBox % Path
  3298.     ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height,%Play% ,ahk_id %MyGuiHWND%, , ,
  3299.     GUIControl, MoveDraw, GUI_Base_PlayButton_VControl_Array, x%Icon_X% y%Icon_Y%
  3300.     GUIControl, MoveDraw, GUI_Base_PlayButton_Playing_VControl_Array, x%Icon_X% y%Icon_Y%
  3301.     Static_ID := GUI_Base_PlayButton_Playing_StaticID[1]
  3302.     ControlGetPos, Icon_X, Icon_Y, Icon_Width, Icon_Height, %Static_ID%, ahk_id %MyGuiHWND%, , ,
  3303.     MsgBox, %Icon_X%
  3304.     GUIControl, MoveDraw, GUI_Base_PlayButton_Playing_VControl_Array, x0 y0
  3305.    
  3306.     GUI_Options_Preview_Playing := false
  3307.     Sleep, 10
  3308.     MsgBox, Reset!
  3309.     SetTimer, ResetPreviewButton, OFF
  3310.     reset()
  3311. return
  3312.  
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358. class SecondCounter {
  3359.     __New() {
  3360.         this.interval := 1000
  3361.         this.count := 0
  3362.         ; Tick() has an implicit parameter "this" which is a reference to
  3363.         ; the object, so we need to create a function which encapsulates
  3364.         ; "this" and the method to call:
  3365.         this.timer := ObjBindMethod(this, "Tick")
  3366.     }
  3367.     Start() {
  3368.         ; Known limitation: SetTimer requires a plain variable reference.
  3369.         timer := this.timer
  3370.         SetTimer % timer, % this.interval
  3371.         ToolTip % "Counter started"
  3372.     }
  3373.     Stop() {
  3374.         ; To turn off the timer, we must pass the same object as before:
  3375.         timer := this.timer
  3376.         SetTimer % timer, Off
  3377.         ToolTip % "Counter stopped at " this.count
  3378.     }
  3379.     ; In this example, the timer calls this method:
  3380.     Tick() {
  3381.         ToolTip % ++this.count
  3382.     }
  3383. }
  3384.  
  3385.  
  3386.  
  3387.  
  3388.  
  3389.  
  3390.  
  3391.  
  3392.  
  3393. UI_AnnouncementPreview_Clicked_LetGo(Clicked_Control_Name,IconIndex,StaticID)
  3394. {
  3395.     MouseGetPos, , , id, control
  3396.     ;ToolTip, GUI_Base_Icon_Click_LetGo New control: %control% `nOld id %GUI_Base_User_Last_Clicked%
  3397.  
  3398.     if ( control = GUI_Base_User_Last_Clicked )
  3399.     {
  3400.         PlaySoundEffect("KerriganA_NeedMoreFood02", 5000)
  3401.         GUI_Options_Preview_Playing := true
  3402.         GuiControl Hide, GUI_Base_PlayButton_Highlighted_VControl_Array
  3403.         GuiControl Show, GUI_Base_PlayButton_Playing_VControl_Array
  3404.        
  3405.         Sleep, 100
  3406.         GuiControl Hide, GUI_Base_PlayButton_Playing_VControl_Array
  3407.         GuiControl Show, GUI_Base_PlayButton_VControl_Array
  3408.        
  3409.     }
  3410.     else
  3411.     {
  3412.         GuiControl Hide, GUI_Base_PlayButton_Highlighted_VControl_Array
  3413.         GuiControl Show, GUI_Base_PlayButton_VControl_Array
  3414.     }
  3415. }
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433. SetSystemCursor(file)
  3434.  
  3435. {
  3436.  
  3437.    IDC_SIZEALL := 32646
  3438.  
  3439.  
  3440.  
  3441.    CursorHandle := DllCall( "LoadCursorFromFile", Str,file )
  3442.  
  3443.  
  3444.  
  3445.    Cursors = 32512,32513,32514,32515,32516,32640,32641,32642,32643,32644,32645,32646,32648,32649,32650,32651
  3446.  
  3447.    Loop, Parse, Cursors, `,
  3448.  
  3449.    {
  3450.  
  3451.       DllCall( "SetSystemCursor", Uint,CursorHandle, Int,A_Loopfield )
  3452.  
  3453.    }
  3454.  
  3455. }
  3456. RestoreCursors()
  3457.  
  3458. {
  3459.  
  3460.    SPI_SETCURSORS := 0x57
  3461.  
  3462.    DllCall( "SystemParametersInfo", UInt,SPI_SETCURSORS, UInt,0, UInt,0, UInt,0 )
  3463.  
  3464. }
  3465. OnMouseLeave(wParam, lParam, msg, hwnd)
  3466. {
  3467.     MouseGetPos, , , id, control
  3468.     WinGetTitle, title, ahk_id %id%
  3469.     WinGetClass, class, ahk_id %id%
  3470.     WinGet, ControlList, ControlList,,
  3471.     ToolTip, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control% `nControlList: %ControlList%
  3472.     MsgBox, HEEYYYYYYYYYYYYYYYYYY
  3473. }
  3474.  
  3475. OnMouseMove(wParam, lParam, msg, hwnd)
  3476. {
  3477.     ;static
  3478.    ; hCurs:=DllCall("LoadCursor","UInt",0,"Int",32649,"UInt")
  3479.     ;DllCall("SetCursor","UInt",hCurs)
  3480.     ;file= %A_ScriptDir%\cross_i.cur
  3481.     ;Image := "\GUI\cursor.ani"
  3482.     ;Cursor = %A_WorkingDir%%Image%
  3483.     ;SetSystemCursor(Cursor)
  3484.     ;CursorHandle := DllCall( "LoadCursorFromFile", Str,Cursor )
  3485.     ;DllCall( "SetSystemCursor", Uint,CursorHandle, Int,CursorHandle )
  3486.  
  3487. ;MsgBox % Cursor
  3488. ;CursorHandle := DllCall( "LoadCursorFromFile", Str,Cursor )
  3489.  
  3490. MouseGetPos, , , id, control
  3491. WinGetTitle, title, ahk_id %id%
  3492. ;WinGetClass, class, ahk_id %id%
  3493. ;WinGet, ControlList, ControlList,,
  3494. ;ToolTip, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control% `nControlList: %ControlList%
  3495.     ;Image := "\GUI\cursor.ani"
  3496.     Image := "\GUI_Resources\Cursor\cursor.ani"
  3497.     Cursor = %A_WorkingDir%%Image%
  3498.  
  3499.    
  3500.     ;
  3501.     static TrackWnd, TrackPos
  3502.    
  3503.     ; Ignore repeat WM_MOUSEMOVE messages if position hasn't changed.
  3504.     if (TrackWnd = hwnd && TrackPos = lParam)
  3505.         return
  3506.    
  3507.    
  3508.    
  3509.     VarSetCapacity(ET, 16)
  3510.     NumPut(16   , ET,  0)
  3511.     NumPut(0x3  , ET,  4)   ; TME_HOVER=1, TME_LEAVE=2
  3512.     NumPut(hwnd , ET,  8)
  3513.     NumPut(500  , ET, 12)
  3514.    
  3515.     TrackWnd := hwnd
  3516.     TrackPos := lParam
  3517.  
  3518.     DllCall("TrackMouseEvent", "uint", &ET)
  3519.     ;OnMessage(0x2A3, "OnMouseLeave")
  3520.    
  3521.     SetSystemCursor(Cursor)
  3522.    
  3523.     SetTimer, FixCursor, 100
  3524.  
  3525.  
  3526. }
  3527.  
  3528. FixCursor:
  3529. MouseGetPos, , , id, control
  3530. WinGetTitle, title, ahk_id %id%
  3531. ;WinGetClass, class, ahk_id %id%
  3532. ;MsgBox, %title%
  3533. if (title = "SC2_PersonalAssistant.ahk")
  3534.     return
  3535.  
  3536. SetTimer, FixCursor, OFF
  3537. RestoreCursors()
  3538. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement