home *** CD-ROM | disk | FTP | other *** search
- ' ---------------------------------------------------------------------------
- Function SetTimeLineByReadyShape(shapeTask As Shape, shapeTL As Shape) As Integer
- On Error Resume Next
- Dim shapeOldTL As Shape
- Dim shapeOldTLIs1D As Boolean
-
- Set shapeOldTL = FindShapeByNameInGroup(shapeTask, "TimeLineS")
- If shapeOldTL <> Null Then
- shapeOldTLIs1D = shapeOldTL.Is1D
- If shapeOldTL.ID <> shapeTL.ID Then
- shapeTask.RemoveShapeByID(shapeOldTL.ID)
- End If
- End If
- thisDoc.MoveShapeToGroup(shapeTL, shapeTask, 0, 0, -1)
-
- shapeTL.BeginY = shapeTask.Height*0.5
- shapeTL.SetPropertyFormula("=Parent.Height*0.5", CDPT_BEGINY)
- shapeTL.BeginX = shapeTask.ControlDot(1).X
- shapeTL.SetPropertyFormula("=Parent.Controls.X1", CDPT_BEGINX)
- shapeTL.EndX = shapeTask.ControlDot(2).X
- shapeTL.SetPropertyFormula("=Parent.Controls.X2", CDPT_ENDX)
- shapeTL.Variable(1).X = shapeTask.ControlDot(3).X - shapeTask.ControlDot(1).X
- shapeTL.SetPropertyFormula("=Parent.Controls.X3-Parent.Controls.X1", CDPT_VARIABLE_X, 1)
-
- shapeTask.SetPropertyFormula("=2", CDPT_CONTROL_XBEHAVIOUR, 2)
- shapeTask.SetPropertyFormula("=2", CDPT_CONTROL_XBEHAVIOUR, 3)
- If NOT shapeOldTLIs1D Then
- shapeTask.ControlDot(2).X = shapeTask.ControlDot(1).X + 100
- shapeTask.ControlDot(3).X = shapeTask.ControlDot(1).X + 50
- shapeTask.SetDefaultFormula(CDPT_CONTROL_X, 2)
- shapeTask.SetDefaultFormula(CDPT_CONTROL_X, 3)
- End If
-
- shapeTL.RecalcProperty(CDPT_BEGINY)
- shapeTL.RecalcProperty(CDPT_BEGINX)
- shapeTL.RecalcProperty(CDPT_ENDX)
- shapeTL.RecalcProperty(CDPT_VARIABLE_X, 1)
-
- shapeTask.RecalcProperty(CDPT_CONTROL_XBEHAVIOUR, 2)
- shapeTask.RecalcProperty(CDPT_CONTROL_XBEHAVIOUR, 3)
- End Function
- ' ---------------------------------------------------------------------------
- Function SetMilestoneByReadyShape(shapeTask As Shape, shapeTL As Shape) As Integer
- On Error Resume Next
- Dim shapeOldTL As Shape
- Dim bToChange As Boolean
-
- Set shapeOldTL = FindShapeByNameInGroup(shapeTask, "TimeLineS")
- bToChange = True
- If shapeOldTL <> Null Then
- If shapeOldTL.Is1D Then
- bToChange = (MsgBox("To change timeline?", cdbYesNo) = cdbYes)
- End If
- End If
- If bToChange Then
- If shapeOldTL <> Null Then
- If shapeOldTL.ID <> shapeTL.ID Then
- shapeTask.RemoveShapeByID(shapeOldTL.ID)
- End If
- End If
- thisDoc.MoveShapeToGroup(shapeTL, shapeTask, 0, 0, -1)
- shapeTL.GPinY = shapeTL.Height*0.5
- shapeTL.SetPropertyFormula("=Parent.Height*0.5", CDPT_GPINY)
- shapeTL.GPinX = shapeTL.ControlDot(1).X
- shapeTL.SetPropertyFormula("=Parent.Controls.X1", CDPT_GPINX)
-
- shapeTask.SetPropertyFormula("=7", CDPT_CONTROL_XBEHAVIOUR, 2)
- shapeTask.SetPropertyFormula("=7", CDPT_CONTROL_XBEHAVIOUR, 3)
- shapeTask.ControlDot(2).X = shapeTask.Width
- shapeTask.ControlDot(3).X = shapeTask.Width
- shapeTask.SetPropertyFormula("=Width", CDPT_CONTROL_X, 2)
- shapeTask.SetPropertyFormula("=Width", CDPT_CONTROL_X, 3)
-
- shapeTask.RecalcProperty(CDPT_CONTROL_XBEHAVIOUR, 2)
- shapeTask.RecalcProperty(CDPT_CONTROL_XBEHAVIOUR, 3)
- shapeTask.RecalcProperty(CDPT_CONTROL_X, 2)
- shapeTask.RecalcProperty(CDPT_CONTROL_X, 3)
- Else
- Dim NumControl As Long
- Dim Ctrl1 As Long, Ctrl2 As Long
- Ctrl1 = shapeTask.ControlDot(1).X + shapeTask.GPinX
- Ctrl2 = shapeTask.ControlDot(2).X + shapeTask.GPinX
- If Abs(Ctrl1 - shapeTL.GPinX) < Abs(Ctrl2 - shapeTL.GPinX) Then
- NumControl = 1
- shapeTL.GPinX = Ctrl1
- Else
- NumControl = 2
- shapeTL.GPinX = Ctrl2
- End If
- shapeTL.SetPropertyFormula("=ObjID" & shapeTask.ID & ".Controls.X" & NumControl & "+ObjID" & shapeTask.ID & ".GPinX", CDPT_GPINX)
- shapeTL.GPinY = shapeTask.GPinY + shapeTask.Height*0.5
- shapeTL.SetPropertyFormula("=ObjID" & shapeTask.ID & ".GPinY+ObjID" & shapeTask.ID & ".Height*0.5", CDPT_GPINY)
- End If
-
- shapeTL.RecalcProperty(CDPT_GPINY)
- shapeTL.RecalcProperty(CDPT_GPINX)
- End Function
- ' ---------------------------------------------------------------------------
- Function TLPlaceMy(inTimeLine As Shape) As Boolean
- On Error Resume Next
- Dim shapeTask As Shape
- Dim x1 As Long, x2 As Long, y1 As Long, y2 As Long
- Dim rx1 As Long, rx2 As Long, ry1 As Long, ry2 As Long
-
- If inTimeLine.Is1D Then
- x1 = inTimeLine.BeginX
- y1 = inTimeLine.BeginY
- x2 = inTimeLine.EndX
- y2 = inTimeLine.EndY
- Else
- x1 = inTimeLine.GPinX
- y1 = inTimeLine.GPinY
- x2 = x1
- y2 = y1
- End If
- For I=thisDoc.ActivePage.ShapesNum() To 1 Step -1
- If thisDoc.ActivePage.Shape(I).Name = "TaskBar" Then
- Set shapeTask = thisDoc.ActivePage.Shape(I)
- rx1 = shapeTask.GPinX
- rx2 = shapeTask.GPinX + shapeTask.Width
- ry1 = shapeTask.GPinY
- ry2 = shapeTask.GPinY + shapeTask.Height
- If LineInRect(x1, y1, x2, y2, rx1, ry1, rx2, ry2) = True Then
- If inTimeLine.Is1D Then
- SetTimeLineByReadyShape(shapeTask, inTimeLine)
- Else
- SetMilestoneByReadyShape(shapeTask, inTimeLine)
- End If
- Place = True
- Exit Function
- End If
- End If
- Next
- Place = False
- End Function
- ' ---------------------------------------------------------------------------
- If thisShape.Variable(1).Y = 0 Then
- thisShape.Name = "TimeLineS"
- TLPlaceMy(thisShape)
- End If
- thisShape.Variable(1).Y = 1
- ' ---------------------------------------------------------------------------
-