Public Sub Tool_Lighting_Down(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
Dim l_litOld As Fury2LightSource
Dim l_litNew As Fury2LightSource
If Button = 2 Then
Select Case QuickShowMenu2(picMapViewport, X, Y, _
Menus(MenuString("Cu&t", , , "CUT", , , Editor.CanCut), MenuString("&Copy", , , "COPY", , , Editor.CanCopy), MenuString("&Paste", , , "PASTE", , , Editor.CanPaste), MenuString("&Delete", , , "DELETE", , , Editor.CanDelete)))
Case 1
Select Case Tool_Lighting
Case LightingTool_Cursor, LightingTool_Light
CutLight
Case LightingTool_Obstruction, LightingTool_ObstructionRectangle, LightingTool_SelectObstructions, LightingTool_MoveObstructions
CutLightingObstructions
Case LightingTool_Plane, LightingTool_SelectPlanes, LightingTool_MovePlanes
CutLightingPlanes
End Select
Case 2
Select Case Tool_Lighting
Case LightingTool_Cursor, LightingTool_Light
CopyLight
Case LightingTool_Obstruction, LightingTool_ObstructionRectangle, LightingTool_SelectObstructions, LightingTool_MoveObstructions
CopyLightingObstructions
Case LightingTool_Plane, LightingTool_SelectPlanes, LightingTool_MovePlanes
CopyLightingPlanes
End Select
Case 3
Select Case Tool_Lighting
Case LightingTool_Cursor, LightingTool_Light
With PasteLight(, False)
.X = m_lngMouseX
.Y = m_lngMouseY
End With
RefreshLights
Redraw
Case LightingTool_Obstruction, LightingTool_ObstructionRectangle, LightingTool_SelectObstructions, LightingTool_MoveObstructions
Case LightingTool_Plane, LightingTool_SelectPlanes, LightingTool_MovePlanes
End Select
Case 4
Select Case Tool_Lighting
Case LightingTool_Cursor, LightingTool_Light
DeleteLight
Case LightingTool_Obstruction, LightingTool_ObstructionRectangle, LightingTool_SelectObstructions, LightingTool_MoveObstructions
DeleteLightingObstructions
Case LightingTool_Plane, LightingTool_SelectPlanes, LightingTool_MovePlanes
DeleteLightingPlanes
End Select
Case Else
End Select
Else
Set l_litOld = SelectedLight
Select Case Tool_Lighting
Case LightingTool_Cursor
Set l_litNew = LightSourceFromPoint(m_lngRealMouseX, m_lngRealMouseY)
If l_litOld Is l_litNew Then
m_booDraggingLight = True
m_sngDragStartX = l_litOld.X
m_sngDragStartY = l_litOld.Y
MultiPropertyUndoPush l_litNew, Array("X", "Y"), Array(m_sngDragStartX, m_sngDragStartY)
Else
m_lngSelectedLight = SelectedLayer.Lighting.Lights.Find(l_litNew)
End If
If ViewOptions.AutoListSwitch Then
If tsLists.SelectedTab.Text = "Layers" Then
tsLists.SelectTab tsLists.Tabs("Lights")
End If
End If
RefreshLights
Redraw
Case LightingTool_Light
Set l_litNew = New Fury2LightSource
With l_litNew
.X = m_lngMouseX
.Y = m_lngMouseY
.FalloffDistance = 50
.Color = F2White
.Visible = True
.Name = "New Light"
.Spread = 180
End With
SelectedLayer.Lighting.Lights.Add l_litNew
m_lngSelectedLight = SelectedLayer.Lighting.Lights.Find(l_litNew)
RefreshLights
Redraw
Case LightingTool_SelectObstructions
If Button = 1 Then
If Shift = vbCtrlMask Then
m_lngSelectionMode = SelectionMode_Remove
ElseIf Shift = vbShiftMask Then
m_lngSelectionMode = SelectionMode_Add
Else
m_lngSelectionMode = SelectionMode_Replace
End If
m_bytOldSelection = m_bytSelectedLightingObstructions
m_booSelectingLightingObstructions = True
Redraw
End If
Case LightingTool_SelectPlanes
If Button = 1 Then
If Shift = vbCtrlMask Then
m_lngSelectionMode = SelectionMode_Remove
ElseIf Shift = vbShiftMask Then
m_lngSelectionMode = SelectionMode_Add
Else
m_lngSelectionMode = SelectionMode_Replace
End If
m_bytOldSelection = m_bytSelectedLightingPlanes
m_booSelectingLightingPlanes = True
Redraw
End If
Case LightingTool_MoveObstructions
If Button = 1 Then
m_lobLightingObstructionCache = SelectedLayer.Lighting.Obstructions
m_booDraggingLightingObstructions = True
End If
Case LightingTool_MovePlanes
If Button = 1 Then
m_plnLightingPlaneCache = SelectedLayer.Lighting.Planes
m_booDraggingLightingPlanes = True
End If
Case LightingTool_Obstruction
If Button = 1 Then
m_fptPoints(m_lngPoint).X = m_lngMouseX
m_fptPoints(m_lngPoint).Y = m_lngMouseY
m_lngPoint = m_lngPoint + 1
Redraw
End If
Case LightingTool_ObstructionRectangle
If Button = 1 Then
m_fptPoints(m_lngPoint).X = m_lngMouseX
m_fptPoints(m_lngPoint).Y = m_lngMouseY
m_lngPoint = m_lngPoint + 1
Redraw
End If
Case LightingTool_Plane
If Button = 1 Then
m_fptPoints(m_lngPoint).X = m_lngMouseX
m_fptPoints(m_lngPoint).Y = m_lngMouseY
m_lngPoint = m_lngPoint + 1
Redraw
End If
Case Else
End Select
End If
End Sub