From 2cf4b45b85f59525a5c5f8382d73055fd150af12 Mon Sep 17 00:00:00 2001 From: Jayvant Javier Pujara Date: Sun, 16 Dec 2012 04:02:59 -0500 Subject: [PATCH] Project/Subproject navigation --- Hotkeys.ahk | 14 ++++++------- ProjectManage.ahk | 25 +++++++++++++++++++++--- ProjectRemove.ahk | 15 ++++++++++++++ ProjectsView.ahk | 50 ++++++++++++++++++++++++++++++----------------- Search.ahk | 33 +++++++++++++++++++++++++++++-- 5 files changed, 107 insertions(+), 30 deletions(-) diff --git a/Hotkeys.ahk b/Hotkeys.ahk index b97ced0..8702bfa 100644 --- a/Hotkeys.ahk +++ b/Hotkeys.ahk @@ -51,9 +51,9 @@ return #If WinActive(WindowFind) ; Quickly assign new Difficulty to project via Ctrl+Number: -^1:: -^2:: -^3:: +!1:: +!2:: +!3:: Gui, ListView, MainList Selection := LV_GetNext("","F") LV_GetText(SelectedProjectID, Selection, IDCol) @@ -72,10 +72,10 @@ else return ; Quickly assign new Importance to project via Shift+Number: -+1:: -+2:: -+3:: -+4:: +^1:: +^2:: +^3:: +^4:: Gui, ListView, MainList Selection := LV_GetNext("","F") LV_GetText(SelectedProjectID, Selection, IDCol) diff --git a/ProjectManage.ahk b/ProjectManage.ahk index e66ce7b..2e98edb 100644 --- a/ProjectManage.ahk +++ b/ProjectManage.ahk @@ -112,6 +112,7 @@ return ProjectManagerSubmit: +;Notification(Action, "Action") ListSelected := "MainList" ; Allows Side List to be updated as well Gui, ProjectManager:Default Gui, ProjectManager:Submit, NoHide @@ -138,6 +139,13 @@ if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd" || Action = "S { Record.Parent := SelectedProjectID } + else + { + LV_GetText(NewParentSelectionID, LV_GetNext(), 1) + ;Notification(NewParentSelectionID, "NewParentSelectionID") + if (NewParentSelectionID <> 0) + Record.Parent := NewParentSelectionID + } db.Insert(Record, "projects") @@ -282,6 +290,11 @@ ProjectManage(Action) ProjectDifficulty = ProjectSkill = ProjectImportance = + if (ListSelected = "SideList") + LV_GetText(SelectedProjectID, Selection, 1) ; Get project ID number from hidden column of "side" ListView, cause we be adding a new stand-alone project + ParentOptCurrID = + if (Action = "QuickAdd" || Action = "QuickDone") + SelectedProjectID = 0 } if (Action = "Subproject" || Action = "SideAdd") { @@ -346,14 +359,20 @@ ProjectManage(Action) 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) + if (!SelectedProjectID || SelectedProjectID = 0) + ParentExcludeFilter := "" + else + ParentExcludeFilter := " AND id <> " . SelectedProjectID + ;Notification(SelectedProjectID, "SelectedProjectID") + ParentOptions := db.OpenRecordSet("SELECT * FROM projects WHERE difficulty <> 0 " . ParentExcludeFilter) Gui, ProjectManager:Default while (!ParentOptions.EOF) { ParentOptID := ParentOptions["id"] ParentOptName := ParentOptions["project"] - LV_Add("",ParentOptID, ParentOptName) + LV_Add("",ParentOptID, ParentOptName) ; Add projects to parents list ParentOptions.MoveNext() } ParentOptions.Close() @@ -423,7 +442,7 @@ 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) . "%'") +ParentOptions := db.OpenRecordSet("SELECT * FROM projects WHERE difficulty <> 0 " . ParentExcludeFilter . " AND project LIKE '%" . SafeQuote(ParentSearchQuery) . "%'") GuiControl, -ReDraw, ParentChangeList while (!ParentOptions.EOF) { diff --git a/ProjectRemove.ahk b/ProjectRemove.ahk index 7792f80..6342b85 100644 --- a/ProjectRemove.ahk +++ b/ProjectRemove.ahk @@ -2,6 +2,7 @@ ;~ Confirm project deletion/removal: RemoveProject: +Gui +OwnDialogs Gui, ListView, MainList Selection := LV_GetNext("","F") LV_GetText(SelectedProjectID, Selection, IDCol) @@ -29,5 +30,19 @@ else RemoveProjectGuiEscape: GuiChildClose("RemoveProject") return + + /* + MsgBox, 36, Remove Project, Remove this project? + IfMsgBox Yes + { + db.Query("DELETE FROM projects WHERE id = " . SelectedProjectID ) + db.Query("DELETE FROM skills WHERE projectID = " . SelectedProjectID) + RefreshSkillsList(FilterSkillSelected) + gosub FilterUpdate + return + } + else + return + */ } return \ No newline at end of file diff --git a/ProjectsView.ahk b/ProjectsView.ahk index f14d9c4..458e954 100644 --- a/ProjectsView.ahk +++ b/ProjectsView.ahk @@ -8,8 +8,13 @@ CountUp := db.Query("SELECT * FROM projects") CountUp := CountUp.Rows.Count() WinVis = true -; Buttons for Main Gui Window: + Gui, 1:Default +; Hidden button for opening side list items from main list +Gui, Add, Button, x0 y0 w0 h0 gMainListSelect vMainListSelector Hidden Default, + +; Buttons for Main Gui Window: + 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 vButtonSubproject, Su&bproject ; Create subproject for selected task @@ -289,7 +294,7 @@ UpdateList(NextSelection="", ImportanceSelected="All", Skill="All", ParentSelect Filter .= "AND project LIKE '%" . SafeQuote(SearchString) "%' " ; Parent selected: - if (ParentSelected <> "") + if (ParentSelected <> "" && ParentSelected <> 0) Filter .= "AND parent = " . ParentSelected . " " ;Notification(ImportanceSelected, Filter) @@ -315,22 +320,10 @@ UpdateList(NextSelection="", ImportanceSelected="All", Skill="All", ParentSelect LV_Modify(NextSelection, "Focus Select Vis") ; Display language from database codes and set colors: - Times := LV_GetCount() - Loop % Times + Loop % LV_GetCount() { ThisLine := A_Index - ; Display parent projects names: - LV_GetText(ParentID, ThisLine, ParentCol) - GetParent := db.OpenRecordSet("SELECT project FROM projects WHERE id = " ParentID) - while (!GetParent.EOF) - { - ParentName := GetParent["project"] - GetParent.MoveNext() - } - GetParent.Close() - LV_Modify(ThisLine, "Col" . ParentCol,ParentName) - ; Display Difficulty level names and set color codes: for k, v in DifficultyLevels { @@ -372,9 +365,30 @@ UpdateList(NextSelection="", ImportanceSelected="All", Skill="All", ParentSelect GetParent.Close() LV_Modify(ThisLine, "Col" . ParentCol, ParentName) + ; Display arrows next to projects that have subprojects: + ; Get ID of project: + LV_GetText(SubprojCheckIDCount, ThisLine, IDCol) + ; Check to see if it has undone children + SubprojCount := db.OpenRecordSet("SELECT count(project) FROM projects WHERE parent = " . SubprojCheckIDCount " AND difficulty <> 0") + while (!SubprojCount.EOF) + { + ArrowDisplay := SubprojCount["count(project)"] + SubprojCount.MoveNext() + } + SubprojCount.Close() + ; if it does, alter the text in the project column to have two >> next to the project to denote this: + if (ArrowDisplay > 0) + { + ; Get the text of the project + LV_GetText(ProjNameMod, ThisLine, ProjNameCol) + ; Add the mark to it; modify the column text + LV_Modify(ThisLine, "Col" . ProjNameCol, ProjNameMod . " >>") + } + + } - ; Resize columns here. Hide anything unfriendly/coded: + ; Resize columns here. Hide anything unfriendly/encoded: LV_ModifyCol() MainColCount := LV_GetCount("Col") Loop % MainColCount @@ -441,8 +455,8 @@ SideListGet() SideListFocRow := LV_GetNext() LV_GetText(SideListFocusedID, LV_GetNext(), SLParentIDCol) Gui, ListView, MainList - ;Notification(SideListFocusedID, ListSelected) - if (SideListFocusedID = "ID" || SideListFocusedID = 0) + ;Notification(SideListFocusedID, "SideListFocusedID") + if (SideListFocusedID = "ID") return else return SideListFocusedID diff --git a/Search.ahk b/Search.ahk index a260047..9e6774b 100644 --- a/Search.ahk +++ b/Search.ahk @@ -66,7 +66,7 @@ else return 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") +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_GuiControl <> "MainListSelector") { ;Notification("MainList Selected") GuiControlGet, ListSelected, 1:FocusV @@ -76,4 +76,33 @@ if (A_GuiEvent = "K" && (A_EventInfo = 33 || A_EventInfo = 34 || A_EventInfo = 3 if (SBParent <> "Parent") SB_SetText(SBParent) } -return \ No newline at end of file +else if (A_GuiEvent = "DoubleClick" || (A_GuiControl = "MainListSelector" && A_GuiEvent = "Normal" && ListSelected = "MainList")) ; on DoubleClick or Enter of the main list, get the Subproject count of the selected project +{ + ;Notification("A_GuiControl: " . A_GuiControl, "A_GuiEvent: " . A_GuiEvent ", ListSelected: " . ListSelected) + Gui, ListView, MainList + if (A_GuiEvent = "DoubleClick") + MainListRowSel := A_EventInfo + else if (A_GuiEvent = "Normal") + MainListRowSel := LV_GetNext() + LV_GetText(SideListOpenProjID, MainListRowSel, IDCol) + Gui, ListView, SideList + Loop % LV_GetCount() + { + SLOLine := A_Index + LV_GetText(SideListOpenMatch, A_Index, SLParentIDCol) + if (SideListOpenProjID = SideListOpenMatch) + { + ;GuiControl, Focus, SideList + LV_Modify(SLOLine, "Focus Select Vis") + gosub FilterUpdate + } + } +} +else if (A_GuiEvent = "K" && A_EventInfo = "8" && SideListGet() <> 0) +{ + ;Notification("BACKSPACE!") + Gui, ListView, SideList + LV_Modify(1, "Focus Select Vis") + gosub FilterUpdate +} +return