diff --git a/ProjectManage.ahk b/ProjectManage.ahk index ff8ccd4..7e6b575 100644 --- a/ProjectManage.ahk +++ b/ProjectManage.ahk @@ -25,21 +25,86 @@ Action := "Edit" ProjectManage(Action) return -SkillAutoComplete: +SkillsAutoComplete: Critical Gui, ProjectManager:Submit, NoHide -;~ If (!GetKeyState("BackSpace","P") && ProjectSkillEdit && Pos := InStr(SkillsDB, "|" . ProjectSkillEdit)) -;~ { - ;~ Found := SubStr(SkillsDB, pos+1, InStr(SkillsDB, "|", 1, Pos + 1) - Pos - 1) - ;~ GuiControl, ProjectManager:Text, ProjectSkillEdit, %Found% - ;~ SendInput % "{End}" . "+{Left " . StrLen(Found) - StrLen(ProjectSkillEdit) . "}" -;~ } -ToolTip, X%A_CaretX% Y%A_CaretY%, A_CaretX, A_CaretY - 20 +if (!ProjectSkillsEdit) + return +else +{ + SkillACStopKeys := ["Tab", "`,", "Enter"] + for k, v in SkillACStopKeys + { + Hotkey, %v%, SkillInsertAC, On + } + SkillACToolTip = + SkillACObj := {} + Loop, Parse, ProjectSkillsEdit, CSV + { + SkillToAC = %A_LoopField% + SkillACObj.Insert(SkillToAC) + } + ;Notification(SkillACObj[SkillACObj.MaxIndex()]) + SkillInputLast := SkillACObj[SkillACObj.MaxIndex()] + if SkillInputLast is Space + { + SkillACShutOff() + return + } + else + { + SkillACList := db.OpenRecordSet("SELECT DISTINCT skill FROM skills WHERE skill LIKE '" . SafeQuote(SkillInputLast) . "%' ORDER BY skill") + while (!SkillACList.EOF) + { + SkillACToolTip .= SkillACList["skill"] . "`n" + SkillACList.MoveNext() + } + SkillACList.Close() + if SkillACToolTip is Space + { + SkillACShutOff() + return + } + else + ToolTip, %SkillACToolTip%, A_CaretX, A_CaretY + 20 + } +} +return + +SkillACShutOff() +{ + global SkillACStopKeys + ToolTip + for k, v in SkillACStopKeys + Hotkey, %v%, Off +} + +SkillInsertAC: +;Notification(SkillInputLast) +GuiControlGet, SkillsEditFocus, ProjectManager:FocusV +;Notification(SkillsEditFocus) +if (SkillsEditFocus = "ProjectSkillsEdit") +{ + Loop, Parse, SkillACToolTip, `n + { + Send % "{Backspace " . StrLen(SkillInputLast) . "}" + SendRaw % A_LoopField + for k, v in SkillACStopKeys + Hotkey, %v%, Off + Send `, ;%A_Space% + if (A_Index = 1) + break + } +} +ToolTip +for k, v in SkillACStopKeys + Hotkey, %v%, Off return ProjectManagerSubmit: Gui, ProjectManager:Submit, NoHide +SkillACShutOff() if (ProjectNameEdit = "") { MsgBox, 8192, Error, Can't make a project with no name! @@ -55,7 +120,8 @@ if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd") { Record := {} Record.Project := ProjectNameEdit - Record.Confidence := KeyGet(ConfidenceList, ProjectConfidenceEdit) + Record.Difficulty := KeyGet(DifficultyLevels, ProjectDifficultyEdit) + Record.Importance := KeyGet(ImportanceLevels, ProjectImportanceEdit) Record.dateEntered := A_Now db.Insert(Record, "projects") @@ -77,15 +143,19 @@ else if (Action = "Edit") { ; Update project name: db.Query("UPDATE projects SET project = '" SafeQuote(ProjectNameEdit) "' WHERE ID = " SelectedProjectID ) - ; Update confidence level: - db.Query("UPDATE projects SET confidence = '" KeyGet(ConfidenceList, ProjectConfidenceEdit) "' WHERE ID = " SelectedProjectID ) + ; Update Difficulty level: + db.Query("UPDATE projects SET Difficulty = '" KeyGet(DifficultyLevels, ProjectDifficultyEdit) "' WHERE ID = " SelectedProjectID ) ; Wipe the existing skills tied to this project: db.Query("DELETE FROM skills WHERE projectID = " . SelectedProjectID) SkillsIDSetting := SelectedProjectID + ; Update Importance level: + db.Query("UPDATE projects SET Importance = '" KeyGet(ImportanceLevels, ProjectImportanceEdit) "' WHERE ID = " SelectedProjectID ) } ; Insert skills: Loop, parse, ProjectSkillsEdit, CSV { + if A_LoopField is Space + continue SkillToInsert = %A_LoopField% ;This removes any leading space due to parse SkillToInsert := Capitalize(SkillToInsert) SkillsInsert := {} @@ -109,6 +179,12 @@ return ; Fall through below to close window. ProjectManagerGuiEscape: ProjectManagerGuiClose: +ToolTip +try +{ + for k, v in SkillACStopKeys + Hotkey, %v%, Off +} if (Action = "Add" || Action = "Edit") { GuiChildClose("ProjectManager") @@ -153,7 +229,7 @@ ProjectManage(Action) { global ProjectNameEdit = - ProjectConfidenceEdit = + ProjectDifficultyEdit = ProjectSkillEdit = ; Get the row number of the selected project from the main project ListView: Selection := LV_GetNext("","F") @@ -172,7 +248,8 @@ ProjectManage(Action) while(!ProjectInfo.EOF) { ProjectName := ProjectInfo["project"] - ProjectConfidence := ProjectInfo["confidence"] + ProjectDifficulty := ProjectInfo["Difficulty"] + ProjectImportance := ProjectInfo["importance"] ProjectInfo.MoveNext() } ProjectInfo.Close() @@ -194,8 +271,9 @@ ProjectManage(Action) else if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd") { ProjectName = - ProjectConfidence = + ProjectDifficulty = ProjectSkill = + ProjectImportance = } ; Build the GUI window to either add or edit a project: ; Initiate a modal child window owned by the main window (by default): @@ -211,20 +289,20 @@ ProjectManage(Action) Gui, ProjectManager:Add, Text, , &Project Name: Gui, ProjectManager:Add, Edit, vProjectNameEdit W270 r1, %ProjectName% - ; Confidence: - Gui, ProjectManager:Add, Text, , &Confidence: - Gui, ProjectManager:Add, DropDownList, vProjectConfidenceEdit, % ListConfidence(ProjectConfidence) + ; Difficulty: + Gui, ProjectManager:Add, Text, Section, &Difficulty: + Gui, ProjectManager:Add, DropDownList, vProjectDifficultyEdit, % ListDifficulty(ProjectDifficulty) ; Skill: - Gui, ProjectManager:Add, Text, x+20 y52, Set S&kills: - ; To set this, we need to go through all the skills on the table and get all the distinct skills: - ;SkillsDB := ListSkills(ProjectSkill) - ;Gui, ProjectManager:Add, ComboBox, vProjectSkillEdit gSkillAutoComplete w130 r7, % SkillsDB ;% ListSkills(ProjectSkill) + Gui, ProjectManager:Add, Text, ys, Set S&kills: + Gui, ProjectManager:Add, Edit, vProjectSkillsEdit gSkillsAutoComplete w130 r1, % ProjectSkill - Gui, ProjectManager:Add, Edit, vProjectSkillsEdit w130 r1, % ProjectSkill + ; Importance: + Gui, ProjectManager:Add, Text, xm, Impo&rtance: + Gui, ProjectManager:Add, DropDownList, vProjectImportanceEdit, % ListImportance(ProjectImportance) ; Submit button: - Gui, ProjectManager:Add, Button, Default gProjectManagerSubmit w80 x15 y+70, &Submit + Gui, ProjectManager:Add, Button, Default gProjectManagerSubmit w80 xm y+20, &Submit ; Set size of this window: Width = 300 diff --git a/ProjectsView.ahk b/ProjectsView.ahk index b5cffde..f85853c 100644 --- a/ProjectsView.ahk +++ b/ProjectsView.ahk @@ -23,9 +23,9 @@ Gui, Add, Button, gClearSearch vClearSearchButton x+1, &Clear ; Pressing Alt+C a ;~ Filter view by importance: -Gui, Add, Text, x+10 vConfidenceChooseText, &Confidence: -Gui, Add, DropDownList, vConfidenceChoose gFilterUpdate x+5 w60, All|| ; Filtering subroutines are located in Search.ahk -GuiControl, , ConfidenceChoose, % ListConfidence("All") +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") ; Filter view by skill: Gui, Add, Text, x+10 vSkillChooseText, S&kill: @@ -37,9 +37,9 @@ Gui, Add, Checkbox, vFilterShowDone gFilterUpdate x+10, Show do&ne ;~ ListView: -Gui, Add, ListView, x0 y+15 r20 Grid AltSubmit -Multi Count%CountUp% vMainList hwndColored_LV_1, ID|ConfidenceID|ParentID|ColorID|Confidence|Project|Parent +Gui, Add, ListView, x0 y+15 r20 Grid AltSubmit -Multi Count%CountUp% vMainList hwndColored_LV_1, ID|DifficultyID|ImportanceID|ParentID|ColorID|Difficulty|Project|Importance|Parent } -Colored_LV_1_BG = 4 ;ColorIDCol +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 @@ -65,8 +65,8 @@ else if (A_GuiWidth <= 811) } GuiControl, MoveDraw, SearchQuery, % "w" SearchBarWidth GuiControl, MoveDraw, ClearSearchButton, % "x" 50 + SearchBarWidth + 10 -GuiControl, MoveDraw, ConfidenceChooseText, % "x" 50 + SearchBarWidth + 55 -GuiControl, MoveDraw, ConfidenceChoose, % "x" 50 + SearchBarWidth + 120 +GuiControl, MoveDraw, DifficultyChooseText, % "x" 50 + SearchBarWidth + 55 +GuiControl, MoveDraw, DifficultyChoose, % "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 @@ -136,18 +136,18 @@ ListSkills(Selected="") return SkillComboList } -ListConfidence(SetConfidence="") +ListDifficulty(SetDifficulty="") { - global ConfidenceList - For k, v in ConfidenceList + global DifficultyLevels + For k, v in DifficultyLevels { - if (k = SetConfidence) + if (k = SetDifficulty) v := v . "|" - else if (k = 1 && SetConfidence <> "All") + else if (k = 1 && SetDifficulty <> "All") v := v . "|" - ConfidenceFormatted .= v . "|" + DifficultyFormatted .= v . "|" } - return ConfidenceFormatted + return DifficultyFormatted } KeyGet(obj, val) @@ -159,39 +159,43 @@ KeyGet(obj, val) } } -ListPriorities(SetPriority="") +ListImportance(SetImportance="") { - global Priorities - For k, imp in Priorities + global ImportanceLevels + For k, v in ImportanceLevels { - if (imp = SetPriority) - imp := imp . "|" - else if (k = 1 && SetPriority <> "All") - imp := imp . "|" - PriorityList .= imp . "|" + if (k = SetImportance) + v := v . "|" + else if (k = 1 && SetImportance <> "All") + v := v . "|" + ImportanceFormatted .= v . "|" } - return PriorityList + return ImportanceFormatted } -UpdateList(NextSelection="", ConfidenceSelected="All", Skill="All") +UpdateList(NextSelection="", DifficultySelected="All", Skill="All") { global - ; A number from the database: + ; The ID of the project - A number from the database: IDCol = 1 - ; A number from the database: - ConfIDCol = 2 - ; Number from the database: - ParentIDCol = 3 + ; The difficulty level - A number from the database: + DiffIDCol = 2 + ; The importance level - A number from the database: + ImpIDCol = 3 + ; The ID number of the parent - A Number from the database: + ParentIDCol = 4 - ; A number added from confidence rank info: - ColorIDCol = 4 + ; The color for the project - A number added from Difficulty rank info: + ColorIDCol = 5 - ; Text to be deciphered from rank code: - ConfidenceCol = 5 - ; Text from the database: - ProjNameCol = 6 - ; Text to be deciphered from database number: - ParentCol = 7 + ; Readable difficulty text - Text to be deciphered from rank code: + DifficultyCol = 6 + ; Name of the project - Text from the database: + ProjNameCol = 7 + ; Importance of the project - Text to be deciphered from rank number: + ImportanceCol = 8 + ; Name of parent project - Text to be deciphered from database number: + ParentCol = 9 Critical @@ -199,26 +203,6 @@ UpdateList(NextSelection="", ConfidenceSelected="All", Skill="All") GuiControlGet, SearchString, , SearchQuery GuiControl, -ReDraw, MainList LV_Delete() - ;~ if (Skill = "All") - ;~ { - ;~ Filter := "Select * from projects " - ;~ } - ;~ else if (Skill <> "All" && Skill <> "None") - ;~ { - ;~ Filter := "SELECT p.* FROM projects p, skills s WHERE s.projectID = p.ID AND (s.skill IN ('" . Skill . "')) " - ;~ } - ;~ else if (Skill = "None") - ;~ filter .= "" - ;~ if (ConfidenceSelected <> "" || FilterShowDone <> "" || Skill <> "" || SearchString <> "") - ;~ Filter .= "WHERE " - ;~ if (SearchString <> "") - ;~ Filter .= "project LIKE '%" SafeQuote(SearchString) "%' AND" - ;~ if (FilterShowDone <> 1) - ;~ Filter .= " confidence is not null " ; change this to 0 eventually - ;~ else if (FilterShowDone = 1) - ;~ Filter .= " confidence = 0 OR confidence is null" - ;~ if (ConfidenceSelected && ConfidenceSelected <> "All") - ;~ Filter .= " AND confidence = " KeyGet(ConfidenceList, ConfidenceSelected) " " ; Skills: if (Skill = "All") @@ -239,34 +223,35 @@ UpdateList(NextSelection="", ConfidenceSelected="All", Skill="All") else Filter .= "WHERE " if (FilterShowDone = 1) - Filter .= "confidence = 0 or confidence is null " + Filter .= "Difficulty = 0 or Difficulty is null " else - Filter .= "confidence is not null " + Filter .= "Difficulty is not null " - ; Confidence level - if (ConfidenceSelected <> "All") - Filter .= "AND confidence = " . KeyGet(ConfidenceList, ConfidenceSelected) . " " + ; Difficulty level + if (DifficultySelected <> "All") + Filter .= "AND Difficulty = " . KeyGet(DifficultyLevels, DifficultySelected) . " " ; Search string: if (SearchString <> "") Filter .= "AND project LIKE '%" . SafeQuote(SearchString) "%'" - ;Notification(ConfidenceSelected, Filter) + ;Notification(DifficultySelected, Filter) Projects := db.OpenRecordSet(Filter) while (!Projects.EOF) { ID := Projects["id"] - Confidence := Projects["confidence"] + Difficulty := Projects["Difficulty"] Project := Projects["project"] + Importance := Projects["importance"] Parent := Projects["parent"] - LV_Add("", ID, Confidence, Parent,"","", Project,"" ) ; This where database info is added to main ListView + LV_Add("", ID, Difficulty,Importance,Parent,"","", Project,"","" ) ; This where database info is added to main ListView Projects.MoveNext() } 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(ConfIDCol, "sort") + LV_ModifyCol(DiffIDCol, "sort") If (NextSelection) LV_Modify(NextSelection, "Focus Select Vis") @@ -288,22 +273,36 @@ UpdateList(NextSelection="", ConfidenceSelected="All", Skill="All") GetParent.Close() LV_Modify(ThisLine, "Col" . ParentCol,ParentName) - ; Display confidence level names and set color codes: - for k, v in ConfidenceList + ; Display Difficulty level names and set color codes: + for k, v in DifficultyLevels { - LV_GetText(ConfidenceCode, ThisLine, ConfIDCol) - if (k = ConfidenceCode) + LV_GetText(DifficultyCode, ThisLine, DiffIDCol) + if (k = DifficultyCode) { - LV_Modify(ThisLine, "Col" . ConfidenceCol, v) + LV_Modify(ThisLine, "Col" . DifficultyCol, v) LV_Modify(ThisLine, "Col" . ColorIDCol, Colors[k]) } - else if (ConfidenceCode = "" || ConfidenceCode = 0) + else if (DifficultyCode = "" || DifficultyCode = 0) { - LV_Modify(ThisLine, "Col" . ConfidenceCol, "Done") + LV_Modify(ThisLine, "Col" . DifficultyCol, "Done") LV_Modify(ThisLine, "Col" . ColorIDCol, BGR("F5FFFA")) } } + ; Display Importance level names: + for k, v in ImportanceLevels + { + LV_GetText(ImportanceCode, ThisLine, ImpIDCol) + if (k = ImportanceCode) + { + LV_Modify(ThisLine, "Col" . ImportanceCol, v) + } + else if (ImportanceCode = "" || ImportanceCode = 0) + { + LV_Modify(ThisLine, "Col" . ImportanceCol, "None") + } + } + ; Display parent project names: LV_GetText(ParentID, ThisLine, ParentIDCol) GetParent := db.OpenRecordSet("SELECT project FROM projects WHERE id = " ParentID) @@ -323,9 +322,10 @@ UpdateList(NextSelection="", ConfidenceSelected="All", Skill="All") Loop % MainColCount LV_ModifyCol(A_Index,"AutoHdr") LV_ModifyCol(IDCol, 0) ; Hide ID column - LV_ModifyCol(ColorIDCol, 0) ; Hide Color column - LV_ModifyCol(ConfIDCol, 0) ; etc. - LV_ModifyCol(ParentIDCol, 0) + LV_ModifyCol(ColorIDCol, 0) ; Hide color code column + LV_ModifyCol(DiffIDCol, 0) ; Hide difficulty code col + LV_ModifyCol(ImpIDCol, 0) ; Hide importance code col + LV_ModifyCol(ParentIDCol, 0) ; Hide parent ID col ; Enable ListView coloring: OnMessage( WM_NOTIFY := 0x4E, "WM_NOTIFY" ) diff --git a/Search.ahk b/Search.ahk index 2242d0a..1793ddd 100644 --- a/Search.ahk +++ b/Search.ahk @@ -10,10 +10,10 @@ FilterUpdate: ImportanceUpdate: FilterSkillUpdate: -GuiControlGet, FilterConfidenceSelected, 1:, ConfidenceChoose +GuiControlGet, FilterDifficultySelected, 1:, DifficultyChoose GuiControlGet, FilterSkillSelected, 1:, FilterSkill GuiControlGet, FilterShowDone, 1:, FilterShowDone -UpdateList(Selection,FilterConfidenceSelected,FilterSkillSelected) +UpdateList(Selection,FilterDifficultySelected,FilterSkillSelected) return ;~ =============================================================================== @@ -22,7 +22,7 @@ return ClearSearch: Critical GuiControl, , ImportanceChoose, |All|| -GuiControl, , ImportanceChoose, % ListPriorities() +GuiControl, , ImportanceChoose, % ListImportance() GuiControl, , FilterSkill, |All||None| ; Put | at start to reset out the DDL GuiControl, , FilterSkill, % ListSkills() @@ -38,8 +38,8 @@ return Search: Critical GuiControlGet, SearchString, , SearchQuery -GuiControlGet, FilterConfidenceSelected, , ConfidenceChoose +GuiControlGet, FilterDifficultySelected, , DifficultyChoose GuiControlGet, FilterSkillSelected, , FilterSkill GuiControlGet, FilterShowDone, -UpdateList(Selection, FilterConfidenceSelected, FilterSkillSelected) +UpdateList(Selection, FilterDifficultySelected, FilterSkillSelected) return \ No newline at end of file diff --git a/Settings.ahk b/Settings.ahk index e397550..2ce94c0 100644 --- a/Settings.ahk +++ b/Settings.ahk @@ -7,19 +7,19 @@ if FileExist(IconFile) Menu, Tray, NoStandard ;~ Project confidence levels: -ConfidenceList := ["High", "Medium", "Low"] +ConfidenceLevels := ["High", "Medium", "Low"] ; For DB conversion: -Difficulties := ["Really Easy", "Pretty Easy", "Medium", "Hard"] +DifficultyLevels := ["Easy", "Medium", "Hard"] ; Award points for each difficulty: -Awards := [5, 10, 25, 100] +AwardLevels := [5, 10, 25] ; Difficulty colors: Colors := [BGR("ADFF2F"), BGR("FFD700"), BGR("FF6347")] ;~ Priorities: -Priorities := ["Must", "Should", "Could", "Want"] +ImportanceLevels := ["High", "Medium", "Low"] BGR(RGB) { diff --git a/SubprojectAdd.ahk b/SubprojectAdd.ahk index 748be55..f714fdc 100644 --- a/SubprojectAdd.ahk +++ b/SubprojectAdd.ahk @@ -34,7 +34,7 @@ SPSkills := ListSkills() Gui, AddSubproject:Add, ComboBox, vProjectSkill gSPSkillAutoComplete w130 r7, % SPSkills Gui, AddSubproject:Add, Text, xm, Impo&rtance: -Gui, AddSubproject:Add, DropDownList, vProjectImportance, % ListPriorities("Must") +Gui, AddSubproject:Add, DropDownList, vProjectImportance, % ListImportance("Must") Gui, AddSubproject:Add, Button, Default gAddSubprojectSubmit w80 xm y+20, &Submit