Side list implemented

This commit is contained in:
Jayvant Javier Pujara 2012-12-04 15:36:11 -05:00
parent 693650a4b5
commit 78830b6271
13 changed files with 269 additions and 127 deletions

View File

@ -119,6 +119,14 @@ Capitalize(String)
return Initial . 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. 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 StringReplace, string, string, ','', All

View File

@ -16,7 +16,7 @@ Gui, HUD_Level:New
Gui, HUD_Level:+LastFound +AlwaysOnTop -Caption +ToolWindow Gui, HUD_Level:+LastFound +AlwaysOnTop -Caption +ToolWindow
Gui, HUD_Level:Color, %HUD_Color% Gui, HUD_Level:Color, %HUD_Color%
;Gui, HUD_Level:Add, Picture, x0 y0 w400 h70 , Res\BG.png ;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 Gui, HUD_Level:Add, Progress, vHUD_Progress x12 y12 w425 h18 cWhite Background48B1DF
NameSize = 260 NameSize = 260
Gui, HUD_Level:Add, Text, vHUD_Name x12 y+1 w%NameSize% r1 c%HUD_Color2% BackgroundTrans, % ProfileGet("name") Gui, HUD_Level:Add, Text, vHUD_Name x12 y+1 w%NameSize% r1 c%HUD_Color2% BackgroundTrans, % ProfileGet("name")

View File

@ -4,8 +4,15 @@
;~ Pressing Alt+V focuses user on the ListView: ;~ Pressing Alt+V focuses user on the ListView:
#If WinActive(WindowFind) #If WinActive(WindowFind)
!x:: !x::
Gui, ListView, MainList
GuiControl, Focus, 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 return
;~ Enables Ctrl+Backspace deletion in edit fields: ;~ Enables Ctrl+Backspace deletion in edit fields:
@ -18,22 +25,22 @@ return
#If ; Clear out context sensitivity #If ; Clear out context sensitivity
; Easy tasks ; Easy tasks
^+1:: ^+1::
UpdateProgress("Really Easy Achievement", 5, "increase.wav") UpdateProgress(DifficultyLevels[1] . " Achievement", AwardLevels[1], "increase.wav")
return return
; Medium difficulty ; Medium difficulty
^+2:: ^+2::
UpdateProgress("Pretty Easy Achievement", 10, "medium.wav") UpdateProgress(DifficultyLevels[2] . " Achievement", AwardLevels[2], "medium.wav")
return return
; Heavy lifting ; Heavy lifting
^+3:: ^+3::
UpdateProgress("Medium Achievement", 25, "hard.wav") UpdateProgress(DifficultyLevels[3] . " Achievement", AwardLevels[3], "hard.wav")
return return
; Completed big project ; Completed big project
^+4:: ^+4::
UpdateProgress("Hard Achievement", 100, "goal.wav") UpdateProgress("Epic Achievement", 100, "goal.wav")
return return
!F2:: !F2::
@ -47,9 +54,11 @@ return
;~ WinActivate, %WindowFind% ;~ WinActivate, %WindowFind%
;~ return ;~ return
; Quickly assign new Difficulty to project via Ctrl+Number:
^1:: ^1::
^2:: ^2::
^3:: ^3::
Gui, ListView, MainList
Selection := LV_GetNext("","F") Selection := LV_GetNext("","F")
LV_GetText(SelectedProjectID, Selection, IDCol) LV_GetText(SelectedProjectID, Selection, IDCol)
If (SelectedProjectID == "ID") If (SelectedProjectID == "ID")
@ -65,3 +74,24 @@ else
return return
} }
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

View File

@ -33,6 +33,7 @@ SetBatchLines -1
#Include SkillsView.ahk #Include SkillsView.ahk
#Include ProjectLog.ahk #Include ProjectLog.ahk
#Include ProfileEdit.ahk #Include ProfileEdit.ahk
#Include SoundEdit.ahk
#Include SettingsEdit.ahk #Include SettingsEdit.ahk
#Include About.ahk #Include About.ahk
#Include Help.ahk #Include Help.ahk

View File

@ -21,7 +21,8 @@ Menu, ViewMenu, Add, &Project Log...`tCtrl+L, ProjectLog
; Options:========================================= ; Options:=========================================
Menu, OptionsMenu, Add, &Profile...`tCtrl+P, ProfileEdit 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:=========================================== ; Help:===========================================
Menu, HelpMenu, Add, &Reference..., ReferenceHotkeys Menu, HelpMenu, Add, &Reference..., ReferenceHotkeys

View File

@ -48,34 +48,19 @@ return
CompleteProject(SelectedProjectID) CompleteProject(SelectedProjectID)
{ {
global db, DifficultyLevels, AwardLevels 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) CompletedProject := db.OpenRecordSet("SELECT * FROM projects WHERE id = " SelectedProjectID)
while (!CompletedProject.EOF) while (!CompletedProject.EOF)
{ {
DifficultyToAward := CompletedProject["difficulty"] DifficultyToAward := CompletedProject["difficulty"]
SkillToIncrease := CompletedProject["skill"]
CompletedProject.MoveNext() CompletedProject.MoveNext()
} }
CompletedProject.Close() CompletedProject.Close()
; Mark project as done: ; 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 amount of points to award for the chosen level:
; 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
for Num, Difficulty in DifficultyLevels for Num, Difficulty in DifficultyLevels
{ {
if (DifficultyToAward = Num) if (DifficultyToAward = Num)
@ -85,7 +70,23 @@ CompleteProject(SelectedProjectID)
AwardGiven := Award AwardGiven := Award
} }
} }
UpdateProgress(DifficultyLevels[DifficultyToAward] . " Achievement", AwardGiven) 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()
} }

View File

@ -15,7 +15,10 @@ return
; Add a new project: ; Add a new project:
AddProject: AddProject:
Action := "Add" if (SideListGet())
Action := "SideAdd"
else
Action := "Add"
ProjectManage(Action) ProjectManage(Action)
return 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! MsgBox, 8192, Error, "All" and "None" can't be used as skill names!
return return
} }
if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd" || Action = "Subproject") if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd" || Action = "Subproject" || Action = "SideAdd")
{ {
Record := {} Record := {}
Record.Project := ProjectNameEdit Record.Project := ProjectNameEdit
Record.Difficulty := KeyGet(DifficultyLevels, ProjectDifficultyEdit) Record.Difficulty := KeyGet(DifficultyLevels, ProjectDifficultyEdit)
Record.Importance := KeyGet(ImportanceLevels, ProjectImportanceEdit) Record.Importance := KeyGet(ImportanceLevels, ProjectImportanceEdit)
Record.dateEntered := A_Now Record.dateEntered := A_Now
if (Action = "Subproject") if (Action = "Subproject" || Action = "SideAdd")
{ {
Record.Parent := SelectedProjectID Record.Parent := SelectedProjectID
} }
@ -139,15 +142,6 @@ if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd" || Action = "S
NewProjectID := LastProjectID() NewProjectID := LastProjectID()
SkillsIDSetting := NewProjectID SkillsIDSetting := NewProjectID
if (Action = "QuickDone" || Action = "QuickAdd")
{
Gui, ProjectManager:Cancel
Gui, 1:Default
if (Action = "QuickDone")
{
CompleteProject(LastProjectID())
}
}
} }
else if (Action = "Edit") else if (Action = "Edit")
{ {
@ -181,6 +175,10 @@ else if (Action = "QuickAdd" || Action = "QuickDone")
{ {
Gui, ProjectManager:Cancel Gui, ProjectManager:Cancel
Gui, 1:Default Gui, 1:Default
if (Action = "QuickDone")
{
CompleteProject(LastProjectID())
}
} }
gosub FilterUpdate gosub FilterUpdate
RefreshSkillsList(FilterSkillSelected) RefreshSkillsList(FilterSkillSelected)
@ -194,7 +192,7 @@ try
for k, v in SkillACStopKeys for k, v in SkillACStopKeys
Hotkey, %v%, Off Hotkey, %v%, Off
} }
if (Action = "Add" || Action = "Edit" || Action = "Subproject") if (Action = "Add" || Action = "Edit" || Action = "Subproject" || Action = "SideAdd")
{ {
GuiChildClose("ProjectManager") GuiChildClose("ProjectManager")
} }
@ -237,14 +235,17 @@ DBGetVal(Query, Val)
ProjectManage(Action) ProjectManage(Action)
{ {
global global
Gui, ListView, MainList if (Action = "SideAdd")
Gui, ListView, SideList
else
Gui, ListView, MainList
ProjectNameEdit = ProjectNameEdit =
ProjectDifficultyEdit = ProjectDifficultyEdit =
ProjectSkillEdit = ProjectSkillEdit =
; Get the row number of the selected project from the main project ListView: ; Get the row number of the selected project from the main project ListView:
Selection := LV_GetNext("","F") Selection := LV_GetNext("","F")
; If editing or adding subproject, get the ID number of that project: ; 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 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 no row is selected and edit is called, do nothing and go back:
@ -285,9 +286,10 @@ ProjectManage(Action)
ProjectSkill = ProjectSkill =
ProjectImportance = ProjectImportance =
} }
if (Action = "Subproject") if (Action = "Subproject" || Action = "SideAdd")
{ {
; Temporary, working on where (if) to include parent project name in subproject-add box): ; Temporary, working on where (if) to include parent project name in subproject-add box):
SubProjParentName := ProjectName
ProjectName = ProjectName =
ProjectDifficulty = ProjectDifficulty =
ProjectSkill = ProjectSkill =
@ -295,7 +297,7 @@ ProjectManage(Action)
} }
; Build the GUI window to either add or edit a project: ; Build the GUI window to either add or edit a project:
; Initiate a modal child window owned by the main window (by default): ; 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") GuiChildInit("ProjectManager")
else if (Action = "QuickDone" || Action = "QuickAdd") else if (Action = "QuickDone" || Action = "QuickAdd")
{ {
@ -304,21 +306,24 @@ ProjectManage(Action)
} }
; Name of project: ; 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% Gui, ProjectManager:Add, Edit, vProjectNameEdit W270 r1, %ProjectName%
; Difficulty: ; Difficulty:
Gui, ProjectManager:Add, Text, Section, &Difficulty: Gui, ProjectManager:Add, Text, Section, &Difficulty:
Gui, ProjectManager:Add, DropDownList, vProjectDifficultyEdit, % ListDifficulty(ProjectDifficulty) 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: ; Importance:
Gui, ProjectManager:Add, Text, xm, Impo&rtance: Gui, ProjectManager:Add, Text, ys, Impo&rtance:
Gui, ProjectManager:Add, DropDownList, vProjectImportanceEdit, % ListImportance(ProjectImportance) 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: ; Submit button:
Gui, ProjectManager:Add, Button, Default gProjectManagerSubmit w80 xm y+20, &Submit 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: ; Calculate position for centering this child GUI window on wherever the main project list window is:
xc := CenterX(300) xc := CenterX(300)
yc := CenterY(200) yc := CenterY(200)
; Show window:
StringUpper, Action, Action, T
if (Action = "QuickDone")
{
StringReplace, PMTitle, Action, done, Done ; Show window:
} ; Select title for Project Manager window:
else if (Action = "QuickAdd") if (Action = "QuickAdd")
StringReplace, PMTitle, Action, add, Add 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 else
PMTitle := Action Gui, ProjectManager:Show, w%Width% h%Height% x%xc% y%yc%, %PMTitle%
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
; Remove the skill auto-complete tooltip if LifeRPG window loses focus: ; Remove the skill auto-complete tooltip if LifeRPG window loses focus:
SetTimer, ACWinWatch, 300 SetTimer, ACWinWatch, 300
return return

View File

@ -1,6 +1,7 @@
;~ =============================================================================== ;~ ===============================================================================
;~ Building and Displaying the Main GUI: ;~ Building and Displaying the Main GUI:
Send !{F2} if (SettingGet("HUD", "ShowOnStartup") = 1)
Send !{F2}
; Improves performance for adding elements to ListView: ; Improves performance for adding elements to ListView:
CountUp := db.Query("SELECT * FROM projects") 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: ;~ Filter view by importance:
Gui, Add, Text, x+10 vDifficultyChooseText, &Difficulty: Gui, Add, Text, x+10 vImportanceChooseText, &Importance:
Gui, Add, DropDownList, vDifficultyChoose gFilterUpdate x+5 w60, All|| ; Filtering subroutines are located in Search.ahk Gui, Add, DropDownList, vImportanceChoose gFilterUpdate x+5 w60, All|| ; Filtering subroutines are located in Search.ahk
GuiControl, , DifficultyChoose, % ListDifficulty("All") GuiControl, , ImportanceChoose, % ListImportance("All")
; Filter view by skill: ; Filter view by skill:
Gui, Add, Text, x+10 vSkillChooseText, S&kill: Gui, Add, Text, x+10 vSkillChooseText, S&kill:
@ -35,21 +36,19 @@ GuiControl, , FilterSkill, % ListSkills()
; Show done or not: ; Show done or not:
Gui, Add, Checkbox, vFilterShowDone gFilterUpdate x+10, Show do&ne Gui, Add, Checkbox, vFilterShowDone gFilterUpdate x+10, Show do&ne
; Sidelist: ; Sidelist:
SideListWidth = 200 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: ;~ ListView:
Gui, Add, ListView, x+1 r20 AltSubmit -Multi Count%CountUp% vMainList hwndColored_LV_1, ID|DifficultyID|ImportanceID|ParentID|ColorID|Difficulty|Project|Importance|Parent 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 Colored_LV_1_BG = 5 ;ColorIDCol
GuiControl, Focus, SearchQuery ; Focus on search bar by default GuiControl, Focus, SearchQuery ; Focus on search bar by default
Gui, Show, w827 h600, %AppTitle% ; Show the GUI we've created Gui, Show, w827 h600, %AppTitle% ; Show the GUI we've created
UpdateList() ; Show all projects UpdateList() ; Show all projects
Gui, +Resize +MinSize621x ; Make GUI resizable Gui, +Resize +MinSize621x ; Make GUI resizable
return return
;~ =============================================================================== ;~ ===============================================================================
@ -72,8 +71,8 @@ else if (A_GuiWidth <= 811)
} }
GuiControl, MoveDraw, SearchQuery, % "w" SearchBarWidth GuiControl, MoveDraw, SearchQuery, % "w" SearchBarWidth
GuiControl, MoveDraw, ClearSearchButton, % "x" 50 + SearchBarWidth + 10 GuiControl, MoveDraw, ClearSearchButton, % "x" 50 + SearchBarWidth + 10
GuiControl, MoveDraw, DifficultyChooseText, % "x" 50 + SearchBarWidth + 55 GuiControl, MoveDraw, ImportanceChooseText, % "x" 50 + SearchBarWidth + 55
GuiControl, MoveDraw, DifficultyChoose, % "x" 50 + SearchBarWidth + 120 GuiControl, MoveDraw, ImportanceChoose, % "x" 50 + SearchBarWidth + 120
GuiControl, MoveDraw, SkillChooseText, % "x" 50 + SearchBarWidth + 190 GuiControl, MoveDraw, SkillChooseText, % "x" 50 + SearchBarWidth + 190
GuiControl, MoveDraw, FilterSkill, % "x" 50 + SearchBarWidth + 220 GuiControl, MoveDraw, FilterSkill, % "x" 50 + SearchBarWidth + 220
GuiControl, MoveDraw, FilterShowDone, % "x" 50 + SearchBarWidth + 350 GuiControl, MoveDraw, FilterShowDone, % "x" 50 + SearchBarWidth + 350
@ -180,7 +179,7 @@ ListImportance(SetImportance="")
return ImportanceFormatted return ImportanceFormatted
} }
UpdateList(NextSelection="", DifficultySelected="All", Skill="All") UpdateList(NextSelection="", ImportanceSelected="All", Skill="All", ParentSelected="")
{ {
global global
; The ID of the project - A number from the database: ; The ID of the project - A number from the database:
@ -231,19 +230,23 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All")
else else
Filter .= "WHERE " Filter .= "WHERE "
if (FilterShowDone = 1) if (FilterShowDone = 1)
Filter .= "Difficulty = 0 or Difficulty is null " Filter .= "(Difficulty = 0 or Difficulty is null) "
else else
Filter .= "difficulty <> 0 " Filter .= "difficulty <> 0 "
; Difficulty level ; Importance level
if (DifficultySelected <> "All") if (ImportanceSelected <> "All")
Filter .= "AND Difficulty = " . KeyGet(DifficultyLevels, DifficultySelected) . " " Filter .= "AND importance = " . KeyGet(ImportanceLevels, ImportanceSelected) . " "
; Search string: ; Search string:
if (SearchString <> "") if (SearchString <> "")
Filter .= "AND project LIKE '%" . SafeQuote(SearchString) "%'" Filter .= "AND project LIKE '%" . SafeQuote(SearchString) "%' "
;Notification(DifficultySelected, Filter) ; Parent selected:
if (ParentSelected <> "")
Filter .= "AND parent = " . ParentSelected . " "
;Notification(ImportanceSelected, Filter)
Projects := db.OpenRecordSet(Filter) Projects := db.OpenRecordSet(Filter)
while (!Projects.EOF) while (!Projects.EOF)
@ -334,6 +337,8 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All")
LV_ModifyCol(DiffIDCol, 0) ; Hide difficulty code col LV_ModifyCol(DiffIDCol, 0) ; Hide difficulty code col
LV_ModifyCol(ImpIDCol, 0) ; Hide importance code col LV_ModifyCol(ImpIDCol, 0) ; Hide importance code col
LV_ModifyCol(ParentIDCol, 0) ; Hide parent ID col LV_ModifyCol(ParentIDCol, 0) ; Hide parent ID col
if (SideListGet())
LV_ModifyCol(ParentCol, 0)
; Enable ListView coloring: ; Enable ListView coloring:
OnMessage( WM_NOTIFY := 0x4E, "WM_NOTIFY" ) OnMessage( WM_NOTIFY := 0x4E, "WM_NOTIFY" )
@ -345,9 +350,9 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All")
UpdateSidelist() UpdateSidelist()
{ {
global global
ParentIDCol = 1 SLParentIDCol = 1
ParentDiffCol = 2 SLParentDiffCol = 2
ParentNameCol = 3 SLParentNameCol = 3
Gui, 1:Default Gui, 1:Default
Gui, ListView, SideList Gui, ListView, SideList
GuiControl, -ReDraw, SideList GuiControl, -ReDraw, SideList
@ -363,12 +368,19 @@ UpdateSidelist()
ParentProjectList.MoveNext() ParentProjectList.MoveNext()
} }
ParentProjectList.Close() 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_Insert(1, "", 0, 0, "All") ; To show all projects, ID shall be 0 (zero)
LV_ModifyCol() LV_ModifyCol()
Loop % LV_GetCount("Col") Loop % LV_GetCount("Col")
LV_Modify(A_Index, "AutoHDR") LV_Modify(A_Index, "AutoHDR")
LV_ModifyCol(ParentIDCol, 0) LV_ModifyCol(SLParentIDCol, 0)
LV_ModifyCol(ParentDiffCol, 0) LV_ModifyCol(SLParentDiffCol, 0)
GuiControl, +ReDraw, SideList GuiControl, +ReDraw, SideList
;Notification(SideListFocusedID, "SideListFocusedID")
if (SideListFocusedID = "" || SideListFocusedID = 0 || SideListFocusedID = "ID")
CurrentParentSelected = 1
else
CurrentParentSelected := SideListFocRow
LV_Modify(CurrentParentSelected, "Focus Select Vis")
} }

View File

@ -7,13 +7,15 @@
;~ =============================================================================== ;~ ===============================================================================
; Filter main projects ListView by available skills: ; Filter main projects ListView by available skills:
Search:
FilterUpdate: FilterUpdate:
ImportanceUpdate: ImportanceUpdate:
FilterSkillUpdate: FilterSkillUpdate:
GuiControlGet, FilterDifficultySelected, 1:, DifficultyChoose Critical
GuiControlGet, FilterImportanceSelected, 1:, ImportanceChoose
GuiControlGet, FilterSkillSelected, 1:, FilterSkill GuiControlGet, FilterSkillSelected, 1:, FilterSkill
GuiControlGet, FilterShowDone, 1:, FilterShowDone GuiControlGet, FilterShowDone, 1:, FilterShowDone
UpdateList(Selection,FilterDifficultySelected,FilterSkillSelected) UpdateList(Selection,FilterImportanceSelected,FilterSkillSelected, SideListGet())
return return
;~ =============================================================================== ;~ ===============================================================================
@ -21,8 +23,10 @@ return
ClearSearch: ClearSearch:
Critical Critical
GuiControl, , ImportanceChoose, |All|| ;GuiControl, , ImportanceChoose, |All||
GuiControl, , ImportanceChoose, % ListImportance() ;GuiControl, , ImportanceChoose, % ListImportance()
SLResetAll()
GuiControl, Choose, ImportanceChoose, 1
GuiControl, , FilterSkill, |All||None| ; Put | at start to reset out the DDL GuiControl, , FilterSkill, |All||None| ; Put | at start to reset out the DDL
GuiControl, , FilterSkill, % ListSkills() GuiControl, , FilterSkill, % ListSkills()
@ -34,12 +38,47 @@ return
;~ =============================================================================== ;~ ===============================================================================
;~ Search subroutine: ;~ Search subroutine:
/*
Search: Search:
Critical Critical
GuiControlGet, SearchString, , SearchQuery GuiControlGet, SearchString, , SearchQuery
GuiControlGet, FilterDifficultySelected, , DifficultyChoose GuiControlGet, FilterDifficultySelected, , DifficultyChoose
GuiControlGet, FilterSkillSelected, , FilterSkill GuiControlGet, FilterSkillSelected, , FilterSkill
GuiControlGet, FilterShowDone, GuiControlGet, FilterShowDone,
;SLResetAll()
UpdateList(Selection, FilterDifficultySelected, FilterSkillSelected) UpdateList(Selection, FilterDifficultySelected, FilterSkillSelected)
return 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")
}

View File

@ -7,9 +7,9 @@ if FileExist(IconFile)
Menu, Tray, NoStandard Menu, Tray, NoStandard
;~ Project confidence levels: ;~ Project confidence levels:
ConfidenceLevels := ["High", "Medium", "Low"] ;ConfidenceLevels := ["High", "Medium", "Low"]
; For DB conversion: ; Difficulty level labels:
DifficultyLevels := ["Easy", "Medium", "Hard"] DifficultyLevels := ["Easy", "Medium", "Hard"]
; Award points for each difficulty: ; Award points for each difficulty:
@ -84,5 +84,7 @@ GroupAdd, exclude, Skill Stats ahk_class AutoHotkeyGUI
GroupAdd, exclude, About ahk_class AutoHotkeyGUI GroupAdd, exclude, About ahk_class AutoHotkeyGUI
GroupAdd, exclude, Edit Your Profile ahk_class AutoHotkeyGUI GroupAdd, exclude, Edit Your Profile ahk_class AutoHotkeyGUI
GroupAdd, exclude, Project Log ahk_class AutoHotkeyGUI GroupAdd, exclude, Project Log ahk_class AutoHotkeyGUI
SoundTitle := "Edit LifeRPG Sounds"
GroupAdd, exclude, % SoundTitle . " ahk_class AutoHotkeyGUI"
SettingsTitle := "Edit LifeRPG Settings" SettingsTitle := "Edit LifeRPG Settings"
GroupAdd, exclude, % SettingsTitle . " ahk_class AutoHotkeyGUI" GroupAdd, exclude, % SettingsTitle . " ahk_class AutoHotkeyGUI"

View File

@ -1,24 +1,21 @@
; Edit app settings: =================================================== ; Edit general application settings: ===================================================
;#If !WinActive("Skill Stats ahk_class AutoHotkeyGUI") && WinActive("LifeRPG ahk_class AutoHotkeyGUI")
;^s::
SettingsEdit: SettingsEdit:
GuiChildInit("SettingsEdit") GuiChildInit("SettingsEdit")
; Define size and positions: ; Define size and positions:
SettingsW = 400 SettingsW = 400
SettingsH = 140 SettingsH = 80
SettingsX := CenterX(SettingsW) SettingsX := CenterX(SettingsW)
SettingsY := CenterY(SettingsH) SettingsY := CenterY(SettingsH)
; Create content and fields: ; Create content and fields:
; Level Up Sound: ; Show HUD on program start checkbox:
Gui, SettingsEdit:Add, Text, , Select sound file to use for &Level-Up Sound: Gui, SettingsEdit:Add, Checkbox, vSettingHUDShowOnStartup, Show the Heads-Up Display (HUD) on program start.
SettingLocationLevelUp := SettingGet("Sound","LevelUp") StateHUDShow := SettingGet("HUD","ShowOnStartup")
if (SettingLocationLevelUp = "Error") if (StateHUDShow = "Error")
SettingLocationLevelUp := "" StateHUDShow = 0
Gui, SettingsEdit:Add, Edit, vSettingsEditLevelUpEdit w300 r1, % SettingLocationLevelUp
Gui, SettingsEdit:Add, Button, x+1 gLevelUpSoundBrowse w80, &Browse GuiControl, SettingsEdit:, SettingHUDShowOnStartup, % StateHUDShow
Gui, SettingsEdit:Add, Button, y+1 xm gSoundTestLevelUp w40, Test
Gui, SettingsEdit:Add, Button, x+1 gSoundTestLevelUpStop w40, Stop
; Save button: ; Save button:
Gui, SettingsEdit:Add, Button, Default y+30 xm w80 gSettingsEditSubmit, &Save 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: ; Show GUI:
Gui, SettingsEdit:Show, w%SettingsW% h%SettingsH% x%SettingsX% y%SettingsY%, %SettingsTitle% 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 return
; What do to when user submits: ; What do to when user submits:
SettingsEditSubmit: SettingsEditSubmit:
Gui, SettingsEdit:Submit, NoHide Gui, SettingsEdit:Submit, NoHide
SettingSet("Sound","LevelUp", SettingsEditLevelUpEdit) SettingSet("HUD","ShowOnStartup", SettingHUDShowOnStartup)
LevelUpSound := SettingsEditLevelUpEdit
; What to do when user closes or escapes window: ; What to do when user closes or escapes window:
SettingsEditGuiClose: SettingsEditGuiClose:

View File

@ -22,7 +22,7 @@ while (!SkillsList.EOF)
SkillListName := SkillsList["skill"] SkillListName := SkillsList["skill"]
LV_Add("", SkillListName) LV_Add("", SkillListName)
RowNum := A_Index 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() columnCount := Table.Columns.Count()
for each, row in Table.Rows for each, row in Table.Rows
{ {
@ -68,6 +68,7 @@ if (FocusedControl = "SkillsListView")
else if (A_GuiEvent = "DoubleClick" ) else if (A_GuiEvent = "DoubleClick" )
LV_GetText(SDC, A_EventInfo) LV_GetText(SDC, A_EventInfo)
GuiChildClose("SkillsView") GuiChildClose("SkillsView")
SLResetAll()
RefreshSkillsList(SDC) RefreshSkillsList(SDC)
UpdateList(,,FilterSkillSelected) UpdateList(,,FilterSkillSelected)
return return

60
SoundEdit.ahk Normal file
View File

@ -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