From 78830b6271aba6b16241d8388d6193c5810b9d60 Mon Sep 17 00:00:00 2001 From: Jayvant Javier Pujara Date: Tue, 4 Dec 2012 15:36:11 -0500 Subject: [PATCH] Side list implemented --- Functions.ahk | 8 +++++ HUD.ahk | 2 +- Hotkeys.ahk | 40 ++++++++++++++++++++--- Main.ahk | 1 + MenuBar.ahk | 3 +- ProjectComplete.ahk | 41 +++++++++++------------ ProjectManage.ahk | 80 +++++++++++++++++++++++++-------------------- ProjectsView.ahk | 58 +++++++++++++++++++------------- Search.ahk | 51 +++++++++++++++++++++++++---- Settings.ahk | 6 ++-- SettingsEdit.ahk | 43 +++++++----------------- SkillsView.ahk | 3 +- SoundEdit.ahk | 60 ++++++++++++++++++++++++++++++++++ 13 files changed, 269 insertions(+), 127 deletions(-) create mode 100644 SoundEdit.ahk diff --git a/Functions.ahk b/Functions.ahk index d1e876f..7170194 100644 --- a/Functions.ahk +++ b/Functions.ahk @@ -119,6 +119,14 @@ Capitalize(String) return Initial . String } +StringClip(String, Len) +{ + Clip := SubStr(String, 1, Len) + if (StrLen(String) > Len) + Clip .= "..." + return Clip +} + SafeQuote(string) ; Escape single quotes for sql update. Insert doesn't seem to need it because the DB library handles it. { StringReplace, string, string, ','', All diff --git a/HUD.ahk b/HUD.ahk index 667e73e..01956a7 100644 --- a/HUD.ahk +++ b/HUD.ahk @@ -16,7 +16,7 @@ Gui, HUD_Level:New Gui, HUD_Level:+LastFound +AlwaysOnTop -Caption +ToolWindow Gui, HUD_Level:Color, %HUD_Color% ;Gui, HUD_Level:Add, Picture, x0 y0 w400 h70 , Res\BG.png -Gui, HUD_Level:Font, S14 Q5 bold, Electrolize +Gui, HUD_Level:Font, S14 Q5 Bold, Electrolize Gui, HUD_Level:Add, Progress, vHUD_Progress x12 y12 w425 h18 cWhite Background48B1DF NameSize = 260 Gui, HUD_Level:Add, Text, vHUD_Name x12 y+1 w%NameSize% r1 c%HUD_Color2% BackgroundTrans, % ProfileGet("name") diff --git a/Hotkeys.ahk b/Hotkeys.ahk index 044d4eb..4958c51 100644 --- a/Hotkeys.ahk +++ b/Hotkeys.ahk @@ -4,8 +4,15 @@ ;~ Pressing Alt+V focuses user on the ListView: #If WinActive(WindowFind) !x:: +Gui, ListView, MainList GuiControl, Focus, MainList -LV_Modify(1, "Select Focus") +LV_Modify(1, "Focus Select Vis") +return + +!z:: +Gui, ListView, SideList +GuiControl, Focus, SideList +LV_Modify(LV_GetNext(), "Focus Select Vis") return ;~ Enables Ctrl+Backspace deletion in edit fields: @@ -18,22 +25,22 @@ return #If ; Clear out context sensitivity ; Easy tasks ^+1:: -UpdateProgress("Really Easy Achievement", 5, "increase.wav") +UpdateProgress(DifficultyLevels[1] . " Achievement", AwardLevels[1], "increase.wav") return ; Medium difficulty ^+2:: -UpdateProgress("Pretty Easy Achievement", 10, "medium.wav") +UpdateProgress(DifficultyLevels[2] . " Achievement", AwardLevels[2], "medium.wav") return ; Heavy lifting ^+3:: -UpdateProgress("Medium Achievement", 25, "hard.wav") +UpdateProgress(DifficultyLevels[3] . " Achievement", AwardLevels[3], "hard.wav") return ; Completed big project ^+4:: -UpdateProgress("Hard Achievement", 100, "goal.wav") +UpdateProgress("Epic Achievement", 100, "goal.wav") return !F2:: @@ -47,9 +54,11 @@ return ;~ WinActivate, %WindowFind% ;~ return +; Quickly assign new Difficulty to project via Ctrl+Number: ^1:: ^2:: ^3:: +Gui, ListView, MainList Selection := LV_GetNext("","F") LV_GetText(SelectedProjectID, Selection, IDCol) If (SelectedProjectID == "ID") @@ -64,4 +73,25 @@ else ;UpdateList(Selection, FilterImportanceSelected, FilterSkillSelected) return } +return + +; Quickly assign new Importance to project via Shift+Number: ++1:: ++2:: ++3:: ++4:: +Gui, ListView, MainList +Selection := LV_GetNext("","F") +LV_GetText(SelectedProjectID, Selection, IDCol) +If (SelectedProjectID == "ID") +{ + return +} +else +{ + StringTrimLeft, NewImportance, A_ThisHotkey, 1 + db.Query("UPDATE projects SET importance = " NewImportance " WHERE id = " SelectedProjectID ) + gosub FilterUpdate + return +} return \ No newline at end of file diff --git a/Main.ahk b/Main.ahk index 3718fdc..b894cc3 100644 --- a/Main.ahk +++ b/Main.ahk @@ -33,6 +33,7 @@ SetBatchLines -1 #Include SkillsView.ahk #Include ProjectLog.ahk #Include ProfileEdit.ahk +#Include SoundEdit.ahk #Include SettingsEdit.ahk #Include About.ahk #Include Help.ahk diff --git a/MenuBar.ahk b/MenuBar.ahk index 9f2f1d2..4845870 100644 --- a/MenuBar.ahk +++ b/MenuBar.ahk @@ -21,7 +21,8 @@ Menu, ViewMenu, Add, &Project Log...`tCtrl+L, ProjectLog ; Options:========================================= Menu, OptionsMenu, Add, &Profile...`tCtrl+P, ProfileEdit -Menu, OptionsMenu, Add, &Settings...`tCtrl+S, SettingsEdit +Menu, OptionsMenu, Add, &Sounds...`tCtrl+S, SoundEdit +Menu, OptionsMenu, Add, S&ettings...`tCtrl+E, SettingsEdit ; Help:=========================================== Menu, HelpMenu, Add, &Reference..., ReferenceHotkeys diff --git a/ProjectComplete.ahk b/ProjectComplete.ahk index e6d9b52..d6d729b 100644 --- a/ProjectComplete.ahk +++ b/ProjectComplete.ahk @@ -48,34 +48,19 @@ return CompleteProject(SelectedProjectID) { global db, DifficultyLevels, AwardLevels - ; Get the difficulty to know how many points to award and the skill to show in notification + ; Get the difficulty to know how many points to award: CompletedProject := db.OpenRecordSet("SELECT * FROM projects WHERE id = " SelectedProjectID) while (!CompletedProject.EOF) { DifficultyToAward := CompletedProject["difficulty"] - SkillToIncrease := CompletedProject["skill"] CompletedProject.MoveNext() } CompletedProject.Close() ; Mark project as done: - db.Query("UPDATE projects SET difficulty = 0, importance = '', dateDone = " . A_Now . ", levelDone = " . LevelGet() . " WHERE id = " SelectedProjectID) + db.Query("UPDATE projects SET difficulty = 0, dateDone = " . A_Now . ", levelDone = " . LevelGet() . " WHERE id = " SelectedProjectID) ; removed importance = '', - /* - ; Get the level count for the skill if the project has one: - if (SkillToIncrease) - { - Table := db.Query("SELECT COUNT(skill) FROM projects WHERE skill = '" . SkillToIncrease . "' AND difficulty = 'Done'") - columnCount := table.Columns.Count() - for each, row in table.Rows - { - Loop, % columnCount - SkillLevel := row[A_index] - } - } - */ - - ; Get the amount of points to award for the chosen level + ; Get the amount of points to award for the chosen level: for Num, Difficulty in DifficultyLevels { if (DifficultyToAward = Num) @@ -85,7 +70,23 @@ CompleteProject(SelectedProjectID) AwardGiven := Award } } + UpdateProgress(DifficultyLevels[DifficultyToAward] . " Achievement", AwardGiven) - if (SkillToIncrease) - Notification("SKILL INCREASED", SkillToIncrease . " increased to " . SkillLevel) + + ; Show notifications for skill level increases: + SkillIncreaseList := db.OpenRecordSet("SELECT * FROM skills WHERE projectID = " . SelectedProjectID) + while (!SkillIncreaseList.EOF) + { + SkillToNotify := SkillIncreaseList["skill"] + Table := db.Query("SELECT COUNT(id) FROM projects WHERE id IN (SELECT projectID FROM skills WHERE skill = '" . SafeQuote(SkillToNotify) . "') AND difficulty = 0") + ColumnCount := Table.Columns.Count() + for each, row in Table.Rows + { + Loop, % ColumnCount + SkillLevel := row[A_index] + Notification("SKILL INCREASED", SkillToNotify . " increased to " . SkillLevel) + } + SkillIncreaseList.MoveNext() + } + SkillIncreaseList.Close() } \ No newline at end of file diff --git a/ProjectManage.ahk b/ProjectManage.ahk index 0e95fea..976248e 100644 --- a/ProjectManage.ahk +++ b/ProjectManage.ahk @@ -15,7 +15,10 @@ return ; Add a new project: AddProject: -Action := "Add" +if (SideListGet()) + Action := "SideAdd" +else + Action := "Add" ProjectManage(Action) return @@ -122,14 +125,14 @@ if (ProjectSkillEdit = "All" || ProjectSkillEdit = "None") ; Sort this out durin MsgBox, 8192, Error, "All" and "None" can't be used as skill names! return } -if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd" || Action = "Subproject") +if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd" || Action = "Subproject" || Action = "SideAdd") { Record := {} Record.Project := ProjectNameEdit Record.Difficulty := KeyGet(DifficultyLevels, ProjectDifficultyEdit) Record.Importance := KeyGet(ImportanceLevels, ProjectImportanceEdit) Record.dateEntered := A_Now - if (Action = "Subproject") + if (Action = "Subproject" || Action = "SideAdd") { Record.Parent := SelectedProjectID } @@ -139,15 +142,6 @@ if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd" || Action = "S NewProjectID := LastProjectID() SkillsIDSetting := NewProjectID - if (Action = "QuickDone" || Action = "QuickAdd") - { - Gui, ProjectManager:Cancel - Gui, 1:Default - if (Action = "QuickDone") - { - CompleteProject(LastProjectID()) - } - } } else if (Action = "Edit") { @@ -181,6 +175,10 @@ else if (Action = "QuickAdd" || Action = "QuickDone") { Gui, ProjectManager:Cancel Gui, 1:Default + if (Action = "QuickDone") + { + CompleteProject(LastProjectID()) + } } gosub FilterUpdate RefreshSkillsList(FilterSkillSelected) @@ -194,7 +192,7 @@ try for k, v in SkillACStopKeys Hotkey, %v%, Off } -if (Action = "Add" || Action = "Edit" || Action = "Subproject") +if (Action = "Add" || Action = "Edit" || Action = "Subproject" || Action = "SideAdd") { GuiChildClose("ProjectManager") } @@ -237,14 +235,17 @@ DBGetVal(Query, Val) ProjectManage(Action) { global - Gui, ListView, MainList + if (Action = "SideAdd") + Gui, ListView, SideList + else + Gui, ListView, MainList ProjectNameEdit = ProjectDifficultyEdit = ProjectSkillEdit = ; Get the row number of the selected project from the main project ListView: Selection := LV_GetNext("","F") ; If editing or adding subproject, get the ID number of that project: - if (Action = "Edit" || Action = "Subproject") + if (Action = "Edit" || Action = "Subproject" || Action = "SideAdd") { 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: @@ -285,9 +286,10 @@ ProjectManage(Action) ProjectSkill = ProjectImportance = } - if (Action = "Subproject") + if (Action = "Subproject" || Action = "SideAdd") { ; Temporary, working on where (if) to include parent project name in subproject-add box): + SubProjParentName := ProjectName ProjectName = ProjectDifficulty = ProjectSkill = @@ -295,7 +297,7 @@ ProjectManage(Action) } ; Build the GUI window to either add or edit a project: ; Initiate a modal child window owned by the main window (by default): - if (Action = "Add" || Action = "Edit" || Action = "Subproject") + if (Action = "Add" || Action = "Edit" || Action = "Subproject" || Action = "SideAdd") GuiChildInit("ProjectManager") else if (Action = "QuickDone" || Action = "QuickAdd") { @@ -304,21 +306,24 @@ ProjectManage(Action) } ; Name of project: - Gui, ProjectManager:Add, Text, , &Project Name: + if (Action = "SideAdd" || Action = "Subproject") + Gui, ProjectManager:Add, Text, ,% StringClip(SubProjParentName, 45) . " >>" + else + Gui, ProjectManager:Add, Text, , &Project Name: Gui, ProjectManager:Add, Edit, vProjectNameEdit W270 r1, %ProjectName% ; Difficulty: Gui, ProjectManager:Add, Text, Section, &Difficulty: Gui, ProjectManager:Add, DropDownList, vProjectDifficultyEdit, % ListDifficulty(ProjectDifficulty) - ; Skill: - Gui, ProjectManager:Add, Text, ys, Set S&kills: - Gui, ProjectManager:Add, Edit, vProjectSkillsEdit gSkillsAutoComplete w130 r1, % ProjectSkill - ; Importance: - Gui, ProjectManager:Add, Text, xm, Impo&rtance: + Gui, ProjectManager:Add, Text, ys, Impo&rtance: Gui, ProjectManager:Add, DropDownList, vProjectImportanceEdit, % ListImportance(ProjectImportance) + ; Skill: + Gui, ProjectManager:Add, Text, xs, S&kills: + Gui, ProjectManager:Add, Edit, vProjectSkillsEdit gSkillsAutoComplete w240 r1, % ProjectSkill + ; Submit button: Gui, ProjectManager:Add, Button, Default gProjectManagerSubmit w80 xm y+20, &Submit @@ -329,21 +334,24 @@ ProjectManage(Action) ; Calculate position for centering this child GUI window on wherever the main project list window is: xc := CenterX(300) yc := CenterY(200) + ; Show window: - StringUpper, Action, Action, T - if (Action = "QuickDone") - { - - StringReplace, PMTitle, Action, done, Done - } - else if (Action = "QuickAdd") - StringReplace, PMTitle, Action, add, Add + ; Select title for Project Manager window: + if (Action = "QuickAdd") + PMTitle := "QuickAdd New Project" + else if (Action = "QuickDone") + PMTitle := "QuickDone Project" + else if (Action = "Add") + PMTitle := "Add New Project" + else if (Action = "Edit") + PMTitle := "Edit Project" + else if (Action = "SideAdd" || Action = "Subproject") + PMTitle := "Add New Subproject" + + if (Action = "QuickAdd" || Action = "QuickDone") ; If calling QuickAdd/Done windows, don't set XY coordinates so that they will center everywhere: + Gui, ProjectManager:Show, w%Width% h%Height%, %PMTitle% else - PMTitle := Action - if (Action = "QuickAdd" || Action = "QuickDone") - Gui, ProjectManager:Show, w%Width% h%Height%, %PMTitle% Project - else - Gui, ProjectManager:Show, w%Width% h%Height% x%xc% y%yc%, %PMTitle% Project + Gui, ProjectManager:Show, w%Width% h%Height% x%xc% y%yc%, %PMTitle% ; Remove the skill auto-complete tooltip if LifeRPG window loses focus: SetTimer, ACWinWatch, 300 return diff --git a/ProjectsView.ahk b/ProjectsView.ahk index 8e91414..a3a3319 100644 --- a/ProjectsView.ahk +++ b/ProjectsView.ahk @@ -1,6 +1,7 @@ ;~ =============================================================================== ;~ Building and Displaying the Main GUI: -Send !{F2} +if (SettingGet("HUD", "ShowOnStartup") = 1) + Send !{F2} ; Improves performance for adding elements to ListView: CountUp := db.Query("SELECT * FROM projects") @@ -23,9 +24,9 @@ Gui, Add, Button, gClearSearch vClearSearchButton x+1, &Clear ; Pressing Alt+C a ;~ Filter view by importance: -Gui, Add, Text, x+10 vDifficultyChooseText, &Difficulty: -Gui, Add, DropDownList, vDifficultyChoose gFilterUpdate x+5 w60, All|| ; Filtering subroutines are located in Search.ahk -GuiControl, , DifficultyChoose, % ListDifficulty("All") +Gui, Add, Text, x+10 vImportanceChooseText, &Importance: +Gui, Add, DropDownList, vImportanceChoose gFilterUpdate x+5 w60, All|| ; Filtering subroutines are located in Search.ahk +GuiControl, , ImportanceChoose, % ListImportance("All") ; Filter view by skill: Gui, Add, Text, x+10 vSkillChooseText, S&kill: @@ -35,21 +36,19 @@ GuiControl, , FilterSkill, % ListSkills() ; Show done or not: Gui, Add, Checkbox, vFilterShowDone gFilterUpdate x+10, Show do&ne - ; Sidelist: SideListWidth = 200 -Gui, Add, ListView, x0 y+15 r20 AltSubmit -Multi vSideList -Hdr, ID|Diff|Parent +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 } 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 ;~ =============================================================================== @@ -72,8 +71,8 @@ else if (A_GuiWidth <= 811) } GuiControl, MoveDraw, SearchQuery, % "w" SearchBarWidth GuiControl, MoveDraw, ClearSearchButton, % "x" 50 + SearchBarWidth + 10 -GuiControl, MoveDraw, DifficultyChooseText, % "x" 50 + SearchBarWidth + 55 -GuiControl, MoveDraw, DifficultyChoose, % "x" 50 + SearchBarWidth + 120 +GuiControl, MoveDraw, ImportanceChooseText, % "x" 50 + SearchBarWidth + 55 +GuiControl, MoveDraw, ImportanceChoose, % "x" 50 + SearchBarWidth + 120 GuiControl, MoveDraw, SkillChooseText, % "x" 50 + SearchBarWidth + 190 GuiControl, MoveDraw, FilterSkill, % "x" 50 + SearchBarWidth + 220 GuiControl, MoveDraw, FilterShowDone, % "x" 50 + SearchBarWidth + 350 @@ -180,7 +179,7 @@ ListImportance(SetImportance="") return ImportanceFormatted } -UpdateList(NextSelection="", DifficultySelected="All", Skill="All") +UpdateList(NextSelection="", ImportanceSelected="All", Skill="All", ParentSelected="") { global ; The ID of the project - A number from the database: @@ -231,19 +230,23 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All") else Filter .= "WHERE " if (FilterShowDone = 1) - Filter .= "Difficulty = 0 or Difficulty is null " + Filter .= "(Difficulty = 0 or Difficulty is null) " else Filter .= "difficulty <> 0 " - ; Difficulty level - if (DifficultySelected <> "All") - Filter .= "AND Difficulty = " . KeyGet(DifficultyLevels, DifficultySelected) . " " + ; Importance level + if (ImportanceSelected <> "All") + Filter .= "AND importance = " . KeyGet(ImportanceLevels, ImportanceSelected) . " " ; Search string: if (SearchString <> "") - Filter .= "AND project LIKE '%" . SafeQuote(SearchString) "%'" + Filter .= "AND project LIKE '%" . SafeQuote(SearchString) "%' " + + ; Parent selected: + if (ParentSelected <> "") + Filter .= "AND parent = " . ParentSelected . " " - ;Notification(DifficultySelected, Filter) + ;Notification(ImportanceSelected, Filter) Projects := db.OpenRecordSet(Filter) while (!Projects.EOF) @@ -334,6 +337,8 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All") 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()) + LV_ModifyCol(ParentCol, 0) ; Enable ListView coloring: OnMessage( WM_NOTIFY := 0x4E, "WM_NOTIFY" ) @@ -345,9 +350,9 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All") UpdateSidelist() { global - ParentIDCol = 1 - ParentDiffCol = 2 - ParentNameCol = 3 + SLParentIDCol = 1 + SLParentDiffCol = 2 + SLParentNameCol = 3 Gui, 1:Default Gui, ListView, SideList GuiControl, -ReDraw, SideList @@ -363,12 +368,19 @@ UpdateSidelist() ParentProjectList.MoveNext() } ParentProjectList.Close() - LV_ModifyCol(ParentNameCol, "sort") + ;LV_ModifyCol(SLParentIDCol, "integer sortdesc") ; Choose which col to sort by + LV_ModifyCol(SLParentNameCol, "sort") LV_Insert(1, "", 0, 0, "All") ; To show all projects, ID shall be 0 (zero) LV_ModifyCol() Loop % LV_GetCount("Col") LV_Modify(A_Index, "AutoHDR") - LV_ModifyCol(ParentIDCol, 0) - LV_ModifyCol(ParentDiffCol, 0) + 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") } \ No newline at end of file diff --git a/Search.ahk b/Search.ahk index 1793ddd..d471103 100644 --- a/Search.ahk +++ b/Search.ahk @@ -7,13 +7,15 @@ ;~ =============================================================================== ; Filter main projects ListView by available skills: +Search: FilterUpdate: ImportanceUpdate: FilterSkillUpdate: -GuiControlGet, FilterDifficultySelected, 1:, DifficultyChoose +Critical +GuiControlGet, FilterImportanceSelected, 1:, ImportanceChoose GuiControlGet, FilterSkillSelected, 1:, FilterSkill GuiControlGet, FilterShowDone, 1:, FilterShowDone -UpdateList(Selection,FilterDifficultySelected,FilterSkillSelected) +UpdateList(Selection,FilterImportanceSelected,FilterSkillSelected, SideListGet()) return ;~ =============================================================================== @@ -21,8 +23,10 @@ return ClearSearch: Critical -GuiControl, , ImportanceChoose, |All|| -GuiControl, , ImportanceChoose, % ListImportance() +;GuiControl, , ImportanceChoose, |All|| +;GuiControl, , ImportanceChoose, % ListImportance() +SLResetAll() +GuiControl, Choose, ImportanceChoose, 1 GuiControl, , FilterSkill, |All||None| ; Put | at start to reset out the DDL GuiControl, , FilterSkill, % ListSkills() @@ -34,12 +38,47 @@ return ;~ =============================================================================== ;~ Search subroutine: - +/* Search: Critical GuiControlGet, SearchString, , SearchQuery GuiControlGet, FilterDifficultySelected, , DifficultyChoose GuiControlGet, FilterSkillSelected, , FilterSkill GuiControlGet, FilterShowDone, +;SLResetAll() UpdateList(Selection, FilterDifficultySelected, FilterSkillSelected) -return \ No newline at end of file +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") +{ + GuiControl, Choose, ImportanceChoose, 1 + RefreshSkillsList() + gosub FilterUpdate +} +else + return +return + +SideListGet() +{ + 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 +} + +; Move 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/Settings.ahk b/Settings.ahk index 5f21fd3..b5c7955 100644 --- a/Settings.ahk +++ b/Settings.ahk @@ -7,9 +7,9 @@ if FileExist(IconFile) Menu, Tray, NoStandard ;~ Project confidence levels: -ConfidenceLevels := ["High", "Medium", "Low"] +;ConfidenceLevels := ["High", "Medium", "Low"] -; For DB conversion: +; Difficulty level labels: DifficultyLevels := ["Easy", "Medium", "Hard"] ; Award points for each difficulty: @@ -84,5 +84,7 @@ GroupAdd, exclude, Skill Stats ahk_class AutoHotkeyGUI GroupAdd, exclude, About ahk_class AutoHotkeyGUI GroupAdd, exclude, Edit Your Profile ahk_class AutoHotkeyGUI GroupAdd, exclude, Project Log ahk_class AutoHotkeyGUI +SoundTitle := "Edit LifeRPG Sounds" +GroupAdd, exclude, % SoundTitle . " ahk_class AutoHotkeyGUI" SettingsTitle := "Edit LifeRPG Settings" GroupAdd, exclude, % SettingsTitle . " ahk_class AutoHotkeyGUI" diff --git a/SettingsEdit.ahk b/SettingsEdit.ahk index 05be03d..044a7a7 100644 --- a/SettingsEdit.ahk +++ b/SettingsEdit.ahk @@ -1,24 +1,21 @@ -; Edit app settings: =================================================== -;#If !WinActive("Skill Stats ahk_class AutoHotkeyGUI") && WinActive("LifeRPG ahk_class AutoHotkeyGUI") -;^s:: +; Edit general application settings: =================================================== + SettingsEdit: GuiChildInit("SettingsEdit") ; Define size and positions: SettingsW = 400 -SettingsH = 140 +SettingsH = 80 SettingsX := CenterX(SettingsW) SettingsY := CenterY(SettingsH) ; Create content and fields: -; Level Up Sound: -Gui, SettingsEdit:Add, Text, , Select sound file to use for &Level-Up Sound: -SettingLocationLevelUp := SettingGet("Sound","LevelUp") -if (SettingLocationLevelUp = "Error") - SettingLocationLevelUp := "" -Gui, SettingsEdit:Add, Edit, vSettingsEditLevelUpEdit w300 r1, % SettingLocationLevelUp -Gui, SettingsEdit:Add, Button, x+1 gLevelUpSoundBrowse w80, &Browse -Gui, SettingsEdit:Add, Button, y+1 xm gSoundTestLevelUp w40, Test -Gui, SettingsEdit:Add, Button, x+1 gSoundTestLevelUpStop w40, Stop +; Show HUD on program start checkbox: +Gui, SettingsEdit:Add, Checkbox, vSettingHUDShowOnStartup, Show the Heads-Up Display (HUD) on program start. +StateHUDShow := SettingGet("HUD","ShowOnStartup") +if (StateHUDShow = "Error") + StateHUDShow = 0 + +GuiControl, SettingsEdit:, SettingHUDShowOnStartup, % StateHUDShow ; Save button: Gui, SettingsEdit:Add, Button, Default y+30 xm w80 gSettingsEditSubmit, &Save @@ -27,30 +24,12 @@ Gui, SettingsEdit:Add, Button, x+10 w80 gSettingsEditGuiClose, &Cancel ; Show GUI: Gui, SettingsEdit:Show, w%SettingsW% h%SettingsH% x%SettingsX% y%SettingsY%, %SettingsTitle% -; hang out here until user saves or closes: -return - -LevelUpSoundBrowse: -Gui +OwnDialogs -FileSelectFile, NewLocationLevelUpSound, , , Select a sound file , Audio (*.wav; *.mp3) -GuiControl, SettingsEdit:, SettingsEditLevelUpEdit, % NewLocationLevelUpSound -return - -SoundTestLevelUp: -GuiControlGet, LUSFile, SettingsEdit:, SettingsEditLevelUpEdit -SoundPlay % LUSFile -return - -SoundTestLevelUpStop: -SoundPlay 341589134759384759348.wav return ; What do to when user submits: SettingsEditSubmit: Gui, SettingsEdit:Submit, NoHide -SettingSet("Sound","LevelUp", SettingsEditLevelUpEdit) -LevelUpSound := SettingsEditLevelUpEdit - +SettingSet("HUD","ShowOnStartup", SettingHUDShowOnStartup) ; What to do when user closes or escapes window: SettingsEditGuiClose: diff --git a/SkillsView.ahk b/SkillsView.ahk index d816150..277bf1b 100644 --- a/SkillsView.ahk +++ b/SkillsView.ahk @@ -22,7 +22,7 @@ while (!SkillsList.EOF) SkillListName := SkillsList["skill"] LV_Add("", SkillListName) RowNum := A_Index - Table := db.Query("SELECT COUNT(id) FROM projects WHERE id IN (SELECT projectID FROM skills WHERE skill = '" . SkillListName . "') AND difficulty = 0") + Table := db.Query("SELECT COUNT(id) FROM projects WHERE id IN (SELECT projectID FROM skills WHERE skill = '" . SafeQuote(SkillListName) . "') AND difficulty = 0") columnCount := Table.Columns.Count() for each, row in Table.Rows { @@ -68,6 +68,7 @@ if (FocusedControl = "SkillsListView") else if (A_GuiEvent = "DoubleClick" ) LV_GetText(SDC, A_EventInfo) GuiChildClose("SkillsView") +SLResetAll() RefreshSkillsList(SDC) UpdateList(,,FilterSkillSelected) return diff --git a/SoundEdit.ahk b/SoundEdit.ahk new file mode 100644 index 0000000..f9801d4 --- /dev/null +++ b/SoundEdit.ahk @@ -0,0 +1,60 @@ +; Edit app Sound: =================================================== +;#If !WinActive("Skill Stats ahk_class AutoHotkeyGUI") && WinActive("LifeRPG ahk_class AutoHotkeyGUI") +;^s:: +SoundEdit: +GuiChildInit("SoundEdit") +; Define size and positions: +SoundW = 400 +SoundH = 140 +SoundX := CenterX(SoundW) +SoundY := CenterY(SoundH) + +; Create content and fields: +; Level Up Sound: +Gui, SoundEdit:Add, Text, , Select sound file to use for &Level-Up Sound: +SoundLocationLevelUp := SettingGet("Sound","LevelUp") +if (SoundLocationLevelUp = "Error") + SoundLocationLevelUp := "" +Gui, SoundEdit:Add, Edit, vSoundEditLevelUpEdit w300 r1, % SoundLocationLevelUp +Gui, SoundEdit:Add, Button, x+1 gLevelUpSoundBrowse w80, &Browse +Gui, SoundEdit:Add, Button, y+1 xm gSoundTestLevelUp w40, Test +Gui, SoundEdit:Add, Button, x+1 gSoundTestLevelUpStop w40, Stop + +; Save button: +Gui, SoundEdit:Add, Button, Default y+30 xm w80 gSoundEditSubmit, &Save +; Cancel: +Gui, SoundEdit:Add, Button, x+10 w80 gSoundEditGuiClose, &Cancel + +; Show GUI: +Gui, SoundEdit:Show, w%SoundW% h%SoundH% x%SoundX% y%SoundY%, %SoundTitle% +; hang out here until user saves or closes: +return + +LevelUpSoundBrowse: +Gui +OwnDialogs +FileSelectFile, NewLocationLevelUpSound, , , Select a sound file , Audio (*.wav; *.mp3) +if (NewLocationLevelUpSound <> "") + GuiControl, SoundEdit:, SoundEditLevelUpEdit, % NewLocationLevelUpSound +return + +SoundTestLevelUp: +GuiControlGet, LUSFile, SoundEdit:, SoundEditLevelUpEdit +SoundPlay % LUSFile +return + +SoundTestLevelUpStop: +SoundPlay 341589134759384759348.wav +return + +; What do to when user submits: +SoundEditSubmit: +Gui, SoundEdit:Submit, NoHide +SettingSet("Sound","LevelUp", SoundEditLevelUpEdit) +LevelUpSound := SoundEditLevelUpEdit + + +; What to do when user closes or escapes window: +SoundEditGuiClose: +SoundEditGuiEscape: +GuiChildClose("SoundEdit") ; Close up GUI child window. +return \ No newline at end of file