diff --git a/FileManage.ahk b/FileManage.ahk index 5acdb87..c228493 100644 --- a/FileManage.ahk +++ b/FileManage.ahk @@ -98,6 +98,7 @@ FileOpenGUI_Refresh() global if (OldDB) { + ListSelected := "MainList" gosub ClearSearch MomentumLastUpdate := ProfileGet("MMTLastUpdate") HUD_Refresh() diff --git a/Finances.ahk b/Finances.ahk new file mode 100644 index 0000000..e69de29 diff --git a/Functions.ahk b/Functions.ahk index 7170194..dd2b99f 100644 --- a/Functions.ahk +++ b/Functions.ahk @@ -79,6 +79,19 @@ WM_NOTIFY( wparam, lparam, msg, hwnd ) { Return, Code = HDN_BEGINTRACKA || Code = HDN_BEGINTRACKW ? True : "" } +DBGetVal(Query, Val) +{ + global db + R := db.OpenRecordSet(Query) + while (!R.EOF) + { + V := R[Val] + R.MoveNext() + } + R.Close() + return V +} + ProfileSet(setting, value) { global db diff --git a/HUD.ahk b/HUD.ahk index 01956a7..242e86b 100644 --- a/HUD.ahk +++ b/HUD.ahk @@ -4,6 +4,7 @@ HUD_Color = 15384E HUD_Trans = 200 HUD_Color2 = 48B1DF +HUD_Font = Electrolize ; Create a new independent Guis for the HUD @@ -24,7 +25,7 @@ Gui, HUD_Level:Font, s10 PointsSize := 424 - NameSize Gui, HUD_Level:Add, Text, vHUD_Points x+1 w%PointsSize% Right cWhite BackgroundTrans, Gui, HUD_Level:Font, s14 -Gui, HUD_Level:Add, Text, vHUD_Text x12 y+7 w425 cWhite BackgroundTrans ; Shows current level and temporarily shows new XP awards. +Gui, HUD_Level:Add, Text, vHUD_Text x12 y+7 w425 cWhite BackgroundTrans r1 ; Shows current level and temporarily shows new XP awards. HUD_LevelText := "LEVEL " HUD_LevelTitle := ;Gui, HUD_Level:Color, 15384E @@ -47,6 +48,17 @@ Winset, ExStyle, +0x20 Gui, HUD_Momentum:Show, x80 y135 w450 h30 NoActivate Gui, HUD_Momentum:Hide +; Money/Finances Module: +Gui, HUD_Finances:New +Gui, HUD_Finances:+LastFound +AlwaysOnTop -Caption +ToolWindow +Gui, HUD_Finances:Color, %HUD_Color% +Gui, HUD_Finances:Font, S14 Q5 bold, %HUD_Font% +Gui, HUD_Finances:Add, Text, x9 y4 cWhite BackgroundTrans, $2405 +WinSet, Transparent, %HUD_Trans% +WinSet, ExStyle, +0x20 +Gui, HUD_Finances:Show, % "x80 y" (A_ScreenHeight - 80) " h30" +;Gui, HUD_Finances:Hide + HUD_Refresh() { global diff --git a/Hotkeys.ahk b/Hotkeys.ahk index 4958c51..b97ced0 100644 --- a/Hotkeys.ahk +++ b/Hotkeys.ahk @@ -22,7 +22,7 @@ send, ^+{left}{delete} return ;~ Give yourself points manually: -#If ; Clear out context sensitivity +#If ; Clear out context sensitivity so it works everywhere ; Easy tasks ^+1:: UpdateProgress(DifficultyLevels[1] . " Achievement", AwardLevels[1], "increase.wav") @@ -43,17 +43,13 @@ return UpdateProgress("Epic Achievement", 100, "goal.wav") return +; Toggle HUD: !F2:: HUD_Progress() return -;~ !F1:: -;~ if (WinActive(WindowFind)) - ;~ WinMinimize, %WindowFind% -;~ else - ;~ WinActivate, %WindowFind% -;~ return +#If WinActive(WindowFind) ; Quickly assign new Difficulty to project via Ctrl+Number: ^1:: ^2:: @@ -94,4 +90,5 @@ else gosub FilterUpdate return } -return \ No newline at end of file +return +#If \ No newline at end of file diff --git a/Main.ahk b/Main.ahk index b894cc3..ee13925 100644 --- a/Main.ahk +++ b/Main.ahk @@ -38,6 +38,7 @@ SetBatchLines -1 #Include About.ahk #Include Help.ahk #Include FileManage.ahk +#Include Finances.ahk MenuHandler: return \ No newline at end of file diff --git a/MenuBar.ahk b/MenuBar.ahk index 4845870..e4a56c5 100644 --- a/MenuBar.ahk +++ b/MenuBar.ahk @@ -18,6 +18,7 @@ Menu, FileMenu, Add, E&xit, GuiClose ; View:=========================================== Menu, ViewMenu, Add, &Skill Stats...`tCtrl+K, SkillsView Menu, ViewMenu, Add, &Project Log...`tCtrl+L, ProjectLog +Menu, ViewMenu, Add, &Finances...`tCtrl+F, MenuHandler ; Options:========================================= Menu, OptionsMenu, Add, &Profile...`tCtrl+P, ProfileEdit diff --git a/ProjectManage.ahk b/ProjectManage.ahk index 976248e..e66ce7b 100644 --- a/ProjectManage.ahk +++ b/ProjectManage.ahk @@ -41,7 +41,7 @@ if (!ProjectSkillsEdit) return else { - SkillACStopKeys := ["Tab", "`,", "Enter"] + SkillACStopKeys := ["Tab", "Enter"] for k, v in SkillACStopKeys { Hotkey, %v%, SkillInsertAC, On @@ -100,7 +100,7 @@ if (SkillsEditFocus = "ProjectSkillsEdit") SendRaw % A_LoopField for k, v in SkillACStopKeys Hotkey, %v%, Off - Send `, ;%A_Space% + Send `,%A_Space% if (A_Index = 1) break } @@ -112,8 +112,10 @@ return ProjectManagerSubmit: +ListSelected := "MainList" ; Allows Side List to be updated as well +Gui, ProjectManager:Default Gui, ProjectManager:Submit, NoHide -SkillACShutOff() +SkillACShutOff() ; Use +Owndialogs instead if (ProjectNameEdit = "") { MsgBox, 8192, Error, Can't make a project with no name! @@ -154,6 +156,12 @@ else if (Action = "Edit") SkillsIDSetting := SelectedProjectID ; Update Importance level: db.Query("UPDATE projects SET Importance = '" KeyGet(ImportanceLevels, ProjectImportanceEdit) "' WHERE ID = " SelectedProjectID ) + ; Update parent field: + LV_GetText(NewParentSelectionID, LV_GetNext(), 1) + if (NewParentSelectionID = 0) + db.Query("UPDATE projects SET parent = '' WHERE ID = " . SelectedProjectID) + else + db.Query("UPDATE projects SET parent = " . NewParentSelectionID . " WHERE ID = " . SelectedProjectID) } ; Insert skills: Loop, parse, ProjectSkillsEdit, CSV @@ -205,7 +213,6 @@ return ; Functions for Project Management: ============================================================= - LastProjectID() { global db @@ -219,26 +226,15 @@ LastProjectID() return QuickID } -DBGetVal(Query, Val) -{ - global db - R := db.OpenRecordSet(Query) - while (!R.EOF) - { - V := R[Val] - R.MoveNext() - } - R.Close() - return V -} - ProjectManage(Action) { global if (Action = "SideAdd") Gui, ListView, SideList else - Gui, ListView, MainList + { + Gui, ListView, %ListSelected% + } ProjectNameEdit = ProjectDifficultyEdit = ProjectSkillEdit = @@ -249,7 +245,7 @@ ProjectManage(Action) { LV_GetText(SelectedProjectID, Selection, 1) ; Get project ID number from hidden column of ListView ; If no row is selected and edit is called, do nothing and go back: - If (SelectedProjectID == "ID") + If (SelectedProjectID == "ID" || !SelectedProjectID) { return } @@ -261,6 +257,7 @@ ProjectManage(Action) ProjectName := ProjectInfo["project"] ProjectDifficulty := ProjectInfo["Difficulty"] ProjectImportance := ProjectInfo["importance"] + ParentOptCurrID := ProjectInfo["parent"] ProjectInfo.MoveNext() } ProjectInfo.Close() @@ -305,6 +302,16 @@ ProjectManage(Action) Gui, ProjectManager:Default } + ; GUI elements/controls: ========================================================================== + + ; Set size of this window: + Width = 300 + Height = 200 + + ; Tab options: + Gui, ProjectManager:Add, Tab2, x0 y0 w300 h200 -Wrap, Project|Parent|Scheduling|Rewards|Misc. + + ; Project Tab: ============================================ ; Name of project: if (Action = "SideAdd" || Action = "Subproject") Gui, ProjectManager:Add, Text, ,% StringClip(SubProjParentName, 45) . " >>" @@ -321,19 +328,67 @@ ProjectManage(Action) Gui, ProjectManager:Add, DropDownList, vProjectImportanceEdit, % ListImportance(ProjectImportance) ; Skill: - Gui, ProjectManager:Add, Text, xs, S&kills: + Gui, ProjectManager:Add, Text, xs, S&kills (separate with a comma): Gui, ProjectManager:Add, Edit, vProjectSkillsEdit gSkillsAutoComplete w240 r1, % ProjectSkill ; Submit button: - Gui, ProjectManager:Add, Button, Default gProjectManagerSubmit w80 xm y+20, &Submit + Gui, Tab + Gui, ProjectManager:Add, Button, Default gProjectManagerSubmit w80 xm y+10, &Submit - ; Set size of this window: - Width = 300 - Height = 200 + ; Parent Tab: ============================================ + Gui, Tab, 2 + ; Search box: + Gui, ProjectManager:Add, Text, , Search: + Gui, ProjectManager:Add, Edit, % "x+1 gParentChangeSearch vParentChangeEdit r1 w" Width - 80, + ; ListView: + if (ParentOptCurrID) + ParentListH = 5 + else + ParentListH = 6 + Gui, ProjectManager:Add, ListView, % "y+3 xm vParentChangeList -Multi -Hdr r" ParentListH " w" Width - 20, ID|Project + ; Fill in ListView: + ParentOptions := db.OpenRecordSet("SELECT * FROM projects WHERE difficulty <> 0 AND id <> " . SelectedProjectID) + Gui, ProjectManager:Default + while (!ParentOptions.EOF) + { + ParentOptID := ParentOptions["id"] + ParentOptName := ParentOptions["project"] + LV_Add("",ParentOptID, ParentOptName) + ParentOptions.MoveNext() + } + ParentOptions.Close() + + ; Sort possible parent projects alphabetically: + LV_ModifyCol(2, "Sort AutoHdr") + + ; Insert "None" option at the top: + LV_Insert(1,"","0","None") + + ; Hide ID col: + LV_ModifyCol(1, 0) + + ; Highlight current parent: + if (ParentOptCurrID) + { + Loop % LV_GetCount() + { + POSelRow := A_Index + LV_GetText(ParentOptMatch, POSelRow, 1) + if (ParentOptMatch = ParentOptCurrID) + { + LV_Modify(POSelRow, "Focus Select") + LV_Modify(POSelRow+4, "Vis") + } + } + ; Display current parent project: + Gui, ProjectManager:Add, Text, , % StringClip(DBGetVal("SELECT project FROM projects WHERE id = " . ParentOptCurrID, "project"), 50) + } + else + LV_Modify(1, "Focus Select Vis") ; Calculate position for centering this child GUI window on wherever the main project list window is: - xc := CenterX(300) - yc := CenterY(200) + xc := CenterX(Width) + yc := CenterY(Height) ; Show window: ; Select title for Project Manager window: @@ -356,7 +411,36 @@ ProjectManage(Action) SetTimer, ACWinWatch, 300 return ACWinWatch: - if !WinActive("ahk_class AutoHotkeyGUI") + GuiControlGet, SkillEditWatch, ProjectManager:FocusV + if (!WinActive("ahk_class AutoHotkeyGUI") || SkillEditWatch <> "ProjectSkillsEdit") SkillACShutOff() return -} \ No newline at end of file +} + +ParentChangeSearch: +Critical +Gui, ProjectManager:Default +; Update project list to show possible parents +LV_Delete() +GuiControlGet, ParentSearchQuery, , ParentChangeEdit +ParentOptions := db.OpenRecordSet("SELECT * FROM projects WHERE difficulty <> 0 AND id <> " . SelectedProjectID . " AND project LIKE '%" . SafeQuote(ParentSearchQuery) . "%'") +GuiControl, -ReDraw, ParentChangeList +while (!ParentOptions.EOF) +{ + ParentOptID := ParentOptions["id"] + ParentOptName := ParentOptions["project"] + LV_Add("",ParentOptID, ParentOptName) + ParentOptions.MoveNext() +} +ParentOptions.Close() + +; Sort possible parent projects alphabetically: +LV_ModifyCol(2, "Sort AutoHdr") + +; Insert "None" option at the top: +LV_Insert(1,"","0","None") + +; Hide ID col: +LV_ModifyCol(1, 0) +GuiControl, +ReDraw, ParentChangeList +return \ No newline at end of file diff --git a/ProjectsView.ahk b/ProjectsView.ahk index a3a3319..f14d9c4 100644 --- a/ProjectsView.ahk +++ b/ProjectsView.ahk @@ -12,7 +12,7 @@ WinVis = true Gui, 1:Default Gui, Add, Button, y3 x15 gAddProject, &Add Project ; Press Alt+A to add project Gui, Add, Button, y3 x+1 gEditProject, &Edit Project ; Edit project (Alt+E, and so on) -Gui, Add, Button, y3 x+1 gAddSubproject, Su&bproject ; Create subproject for selected task +Gui, Add, Button, y3 x+1 gAddSubproject vButtonSubproject, Su&bproject ; Create subproject for selected task Gui, Add, Button, y3 x+1 gCompleteProject, Project &Done ; Confirm project is done Gui, Add, Button, y3 x+1 gRemoveProject, &Remove Project ; Confirm project deletion @@ -40,15 +40,20 @@ Gui, Add, Checkbox, vFilterShowDone gFilterUpdate x+10, Show do&ne SideListWidth = 200 Gui, Add, ListView, x0 y+15 r20 AltSubmit -Multi vSideList -Hdr gSideListUpdate, ID|Diff|Parent -;~ ListView: -Gui, Add, ListView, x+1 r20 AltSubmit -Multi Count%CountUp% vMainList hwndColored_LV_1, ID|DifficultyID|ImportanceID|ParentID|ColorID|Difficulty|Project|Importance|Parent +;~ Main ListView: +Gui, Add, ListView, x+1 r20 AltSubmit -Multi Count%CountUp% vMainList hwndColored_LV_1 gMainListSelect, ID|DifficultyID|ImportanceID|ParentID|ColorID|Difficulty|Project|Importance|Parent } + +; Status bar: +Gui, Add, StatusBar, , + Colored_LV_1_BG = 5 ;ColorIDCol GuiControl, Focus, SearchQuery ; Focus on search bar by default Gui, Show, w827 h600, %AppTitle% ; Show the GUI we've created UpdateList() ; Show all projects Gui, +Resize +MinSize621x ; Make GUI resizable + return ;~ =============================================================================== @@ -58,8 +63,9 @@ GuiSize: if A_EventInfo = 1 ; The window has been minimized. No action needed. return ; Otherwise, the window has been resized or maximized. Resize the controls to match. -GuiControl, Move, Sidelist, % "H" . (A_GuiHeight - 55) . " W" . (SideListWidth := A_GuiWidth * .35) -GuiControl, Move, Mainlist, % "H" . (A_GuiHeight - 55) . " W" . (A_GuiWidth - (SideListWidth + 5)) . " X" . (SideListWidth+5) +SBar = 78 +GuiControl, Move, Sidelist, % "H" . (A_GuiHeight - SBar) . " W" . (SideListWidth := A_GuiWidth * .35) +GuiControl, Move, Mainlist, % "H" . (A_GuiHeight - SBar) . " W" . (A_GuiWidth - (SideListWidth + 5)) . " X" . (SideListWidth+5) ; Resize search bar to fit dropdown filter controls: if (A_GuiWidth > 811) ;827) { @@ -83,7 +89,47 @@ return GuiClose: ExitApp - +; ================================================================================ +;~ Right-click context menu actions: +GuiContextMenu: +Critical off +if ((A_GuiControl = "SideList" && A_EventInfo <> 1) || A_GuiControl = "MainList") +{ + Gui, ListView, %A_GuiControl% + try + { + Menu, RightClick, DeleteAll + } + ; Right-click/context items: + if (A_GuiControl = "SideList") + { + LV_GetText(SLContextProjName, LV_GetNext(), SLParentNameCol) + SLContextProjName := StringClip(SLContextProjName, 50) + Menu, RightClick, Add, % SLContextProjName, MenuHandler + Menu, RightClick, Disable, % SLContextProjName + Menu, RightClick, Default, % SLContextProjName + Menu, RightClick, Add, &Add Project..., MenuHandler + } + if (A_GuiControl = "MainList") + { + LV_GetText(MLContextProjName, LV_GetNext(), ProjNameCol) + MLContextProjName := StringClip(MLContextProjName, 50) + ; Grayed-out project name: + Menu, RightClick, Add, % MLContextProjName, MenuHandler + Menu, RightClick, Disable, % MLContextProjName + Menu, RightClick, Default, % MLContextProjName + ; Add subproject option: + Menu, RightClick, Add, &Add Subproject..., AddSubproject + } + Menu, RightClick, Add, + Menu, RightClick, Add, &Edit Project..., EditProject + Menu, RightClick, Add, + Menu, RightClick, Add, Project &Done, CompleteProject + Menu, RightClick, Add, &Remove Project, RemoveProject + Menu, RightClick, Show, %A_GuiX%, %A_GuiY% +} +;Notification(A_EventInfo) +return ;Main ListView-related Functions================================================== ; Call to refresh skills list after adding a new skill: @@ -262,6 +308,7 @@ UpdateList(NextSelection="", ImportanceSelected="All", Skill="All", ParentSelect Projects.Close() GuiControl, -ReDraw, MainList LV_ModifyCol(IDCol, "Integer sortdesc") ; Enable this to sort by ID, which could show most recent or oldest first, depending. + LV_ModifyCol(ImpIDCol, "sort") LV_ModifyCol(DiffIDCol, "sort") If (NextSelection) @@ -337,7 +384,7 @@ UpdateList(NextSelection="", ImportanceSelected="All", Skill="All", ParentSelect LV_ModifyCol(DiffIDCol, 0) ; Hide difficulty code col LV_ModifyCol(ImpIDCol, 0) ; Hide importance code col LV_ModifyCol(ParentIDCol, 0) ; Hide parent ID col - if (SideListGet()) + if (SideListGet()) ; Call SideListGet again to check whether to hide parent col in main list. LV_ModifyCol(ParentCol, 0) ; Enable ListView coloring: @@ -350,6 +397,8 @@ UpdateList(NextSelection="", ImportanceSelected="All", Skill="All", ParentSelect UpdateSidelist() { global + if (ListSelected = "SideList") + return SLParentIDCol = 1 SLParentDiffCol = 2 SLParentNameCol = 3 @@ -377,10 +426,32 @@ UpdateSidelist() LV_ModifyCol(SLParentIDCol, 0) LV_ModifyCol(SLParentDiffCol, 0) GuiControl, +ReDraw, SideList - ;Notification(SideListFocusedID, "SideListFocusedID") if (SideListFocusedID = "" || SideListFocusedID = 0 || SideListFocusedID = "ID") CurrentParentSelected = 1 else CurrentParentSelected := SideListFocRow LV_Modify(CurrentParentSelected, "Focus Select Vis") +} + +SideListGet() +{ + global + Gui, 1:Default + Gui, ListView, SideList + SideListFocRow := LV_GetNext() + LV_GetText(SideListFocusedID, LV_GetNext(), SLParentIDCol) + Gui, ListView, MainList + ;Notification(SideListFocusedID, ListSelected) + if (SideListFocusedID = "ID" || SideListFocusedID = 0) + return + else + return SideListFocusedID +} + +; Move side list selector back to "All" (first row): +SLResetAll() +{ + global + Gui, ListView, SideList + LV_Modify(1, "Focus Select Vis") } \ No newline at end of file diff --git a/Search.ahk b/Search.ahk index d471103..a260047 100644 --- a/Search.ahk +++ b/Search.ahk @@ -52,33 +52,28 @@ return ;=================================================================================== SideListUpdate: -if (A_GuiEvent = "K" && (A_EventInfo = 33 || A_EventInfo = 34 || A_EventInfo = 35 || A_EventInfo = 36 || A_EventInfo = 38 || A_EventInfo = 40)) OR (A_GuiEvent = "Normal") +Critical +if ((A_GuiEvent = "K" && (A_EventInfo = 33 || A_EventInfo = 34 || A_EventInfo = 35 || A_EventInfo = 36 || A_EventInfo = 38 || A_EventInfo = 40)) OR (A_GuiEvent = "Normal") || A_GuiEvent = "RightClick") { - GuiControl, Choose, ImportanceChoose, 1 - RefreshSkillsList() - gosub FilterUpdate + GuiControl, , SearchQuery ; Blank search box. By changing control, gLabel appears to trigger + GuiControl, Choose, ImportanceChoose, 1 ; Reset importance selector + RefreshSkillsList() ; Reset skill selector + GuiControlGet, ListSelected, 1:FocusV + GuiControl, Disable, ButtonSubproject } else return return -SideListGet() +MainListSelect: +if (A_GuiEvent = "K" && (A_EventInfo = 33 || A_EventInfo = 34 || A_EventInfo = 35 || A_EventInfo = 36 || A_EventInfo = 38 || A_EventInfo = 40)) OR (A_GuiEvent = "Normal") { - global - Gui, ListView, SideList - SideListFocRow := LV_GetNext() - LV_GetText(SideListFocusedID, LV_GetNext(), SLParentIDCol) - Gui, ListView, MainList - if (SideListFocusedID = "ID" || SideListFocusedID = 0) - return - else - return SideListFocusedID + ;Notification("MainList Selected") + GuiControlGet, ListSelected, 1:FocusV + GuiControl, Enable, ButtonSubproject + Gui, ListView, % ListSelected + LV_GetText(SBParent, LV_GetNext(), ParentCol) + if (SBParent <> "Parent") + SB_SetText(SBParent) } - -; Move selector back to "All" (first row): -SLResetAll() -{ - global - Gui, ListView, SideList - LV_Modify(1, "Focus Select Vis") -} \ No newline at end of file +return \ No newline at end of file