Project/Subproject navigation

This commit is contained in:
Jayvant Javier Pujara 2012-12-16 04:02:59 -05:00
parent 4c3b03ed79
commit 2cf4b45b85
5 changed files with 107 additions and 30 deletions

View File

@ -51,9 +51,9 @@ return
#If WinActive(WindowFind) #If WinActive(WindowFind)
; Quickly assign new Difficulty to project via Ctrl+Number: ; Quickly assign new Difficulty to project via Ctrl+Number:
^1:: !1::
^2:: !2::
^3:: !3::
Gui, ListView, MainList Gui, ListView, MainList
Selection := LV_GetNext("","F") Selection := LV_GetNext("","F")
LV_GetText(SelectedProjectID, Selection, IDCol) LV_GetText(SelectedProjectID, Selection, IDCol)
@ -72,10 +72,10 @@ else
return return
; Quickly assign new Importance to project via Shift+Number: ; Quickly assign new Importance to project via Shift+Number:
+1:: ^1::
+2:: ^2::
+3:: ^3::
+4:: ^4::
Gui, ListView, MainList Gui, ListView, MainList
Selection := LV_GetNext("","F") Selection := LV_GetNext("","F")
LV_GetText(SelectedProjectID, Selection, IDCol) LV_GetText(SelectedProjectID, Selection, IDCol)

View File

@ -112,6 +112,7 @@ return
ProjectManagerSubmit: ProjectManagerSubmit:
;Notification(Action, "Action")
ListSelected := "MainList" ; Allows Side List to be updated as well ListSelected := "MainList" ; Allows Side List to be updated as well
Gui, ProjectManager:Default Gui, ProjectManager:Default
Gui, ProjectManager:Submit, NoHide Gui, ProjectManager:Submit, NoHide
@ -138,6 +139,13 @@ if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd" || Action = "S
{ {
Record.Parent := SelectedProjectID Record.Parent := SelectedProjectID
} }
else
{
LV_GetText(NewParentSelectionID, LV_GetNext(), 1)
;Notification(NewParentSelectionID, "NewParentSelectionID")
if (NewParentSelectionID <> 0)
Record.Parent := NewParentSelectionID
}
db.Insert(Record, "projects") db.Insert(Record, "projects")
@ -282,6 +290,11 @@ ProjectManage(Action)
ProjectDifficulty = ProjectDifficulty =
ProjectSkill = ProjectSkill =
ProjectImportance = 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") if (Action = "Subproject" || Action = "SideAdd")
{ {
@ -346,14 +359,20 @@ ProjectManage(Action)
else else
ParentListH = 6 ParentListH = 6
Gui, ProjectManager:Add, ListView, % "y+3 xm vParentChangeList -Multi -Hdr r" ParentListH " w" Width - 20, ID|Project Gui, ProjectManager:Add, ListView, % "y+3 xm vParentChangeList -Multi -Hdr r" ParentListH " w" Width - 20, ID|Project
; Fill in ListView: ; 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 Gui, ProjectManager:Default
while (!ParentOptions.EOF) while (!ParentOptions.EOF)
{ {
ParentOptID := ParentOptions["id"] ParentOptID := ParentOptions["id"]
ParentOptName := ParentOptions["project"] ParentOptName := ParentOptions["project"]
LV_Add("",ParentOptID, ParentOptName) LV_Add("",ParentOptID, ParentOptName) ; Add projects to parents list
ParentOptions.MoveNext() ParentOptions.MoveNext()
} }
ParentOptions.Close() ParentOptions.Close()
@ -423,7 +442,7 @@ Gui, ProjectManager:Default
; Update project list to show possible parents ; Update project list to show possible parents
LV_Delete() LV_Delete()
GuiControlGet, ParentSearchQuery, , ParentChangeEdit 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 GuiControl, -ReDraw, ParentChangeList
while (!ParentOptions.EOF) while (!ParentOptions.EOF)
{ {

View File

@ -2,6 +2,7 @@
;~ Confirm project deletion/removal: ;~ Confirm project deletion/removal:
RemoveProject: RemoveProject:
Gui +OwnDialogs
Gui, ListView, MainList Gui, ListView, MainList
Selection := LV_GetNext("","F") Selection := LV_GetNext("","F")
LV_GetText(SelectedProjectID, Selection, IDCol) LV_GetText(SelectedProjectID, Selection, IDCol)
@ -29,5 +30,19 @@ else
RemoveProjectGuiEscape: RemoveProjectGuiEscape:
GuiChildClose("RemoveProject") GuiChildClose("RemoveProject")
return 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 return

View File

@ -8,8 +8,13 @@ CountUp := db.Query("SELECT * FROM projects")
CountUp := CountUp.Rows.Count() CountUp := CountUp.Rows.Count()
WinVis = true WinVis = true
; Buttons for Main Gui Window:
Gui, 1:Default 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 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 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 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) "%' " Filter .= "AND project LIKE '%" . SafeQuote(SearchString) "%' "
; Parent selected: ; Parent selected:
if (ParentSelected <> "") if (ParentSelected <> "" && ParentSelected <> 0)
Filter .= "AND parent = " . ParentSelected . " " Filter .= "AND parent = " . ParentSelected . " "
;Notification(ImportanceSelected, Filter) ;Notification(ImportanceSelected, Filter)
@ -315,22 +320,10 @@ UpdateList(NextSelection="", ImportanceSelected="All", Skill="All", ParentSelect
LV_Modify(NextSelection, "Focus Select Vis") LV_Modify(NextSelection, "Focus Select Vis")
; Display language from database codes and set colors: ; Display language from database codes and set colors:
Times := LV_GetCount() Loop % LV_GetCount()
Loop % Times
{ {
ThisLine := A_Index 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: ; Display Difficulty level names and set color codes:
for k, v in DifficultyLevels for k, v in DifficultyLevels
{ {
@ -372,9 +365,30 @@ UpdateList(NextSelection="", ImportanceSelected="All", Skill="All", ParentSelect
GetParent.Close() GetParent.Close()
LV_Modify(ThisLine, "Col" . ParentCol, ParentName) 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() LV_ModifyCol()
MainColCount := LV_GetCount("Col") MainColCount := LV_GetCount("Col")
Loop % MainColCount Loop % MainColCount
@ -441,8 +455,8 @@ SideListGet()
SideListFocRow := LV_GetNext() SideListFocRow := LV_GetNext()
LV_GetText(SideListFocusedID, LV_GetNext(), SLParentIDCol) LV_GetText(SideListFocusedID, LV_GetNext(), SLParentIDCol)
Gui, ListView, MainList Gui, ListView, MainList
;Notification(SideListFocusedID, ListSelected) ;Notification(SideListFocusedID, "SideListFocusedID")
if (SideListFocusedID = "ID" || SideListFocusedID = 0) if (SideListFocusedID = "ID")
return return
else else
return SideListFocusedID return SideListFocusedID

View File

@ -66,7 +66,7 @@ else
return return
MainListSelect: 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") ;Notification("MainList Selected")
GuiControlGet, ListSelected, 1:FocusV GuiControlGet, ListSelected, 1:FocusV
@ -76,4 +76,33 @@ if (A_GuiEvent = "K" && (A_EventInfo = 33 || A_EventInfo = 34 || A_EventInfo = 3
if (SBParent <> "Parent") if (SBParent <> "Parent")
SB_SetText(SBParent) SB_SetText(SBParent)
} }
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 return