private static void HandleSingleSelection(Event evt, TimelineWindow.TimelineState state, List <IBounds> elements) { if (RectangleSelect.CanClearSelection(evt)) { SelectionManager.Clear(); } TimelineItemGUI timelineItemGUI = RectangleSelect.PickItemGUI(elements); if (evt.get_modifiers() == 1) { timelineItemGUI.parentTrackGUI.RangeSelectItems(timelineItemGUI, state); } else if (evt.get_modifiers() == 2 || evt.get_modifiers() == 8) { bool flag = SelectionManager.Contains(timelineItemGUI.item); if (flag) { SelectionManager.Remove(timelineItemGUI.item); } else { SelectionManager.Add(timelineItemGUI.item); } } else { SelectionManager.Add(timelineItemGUI.item); } }
public void RebuildGUICache(TimelineWindow.TimelineState state) { TimelineItemGUI[] array = (from x in state.captured.OfType <TimelineItemGUI>() where x.selectableObject != null && x.parentTrackGUI.track == base.track select x).ToArray <TimelineItemGUI>(); TimelineItemGUI[] array2 = array; for (int i = 0; i < array2.Length; i++) { TimelineItemGUI item = array2[i]; state.captured.Remove(item); } this.m_ChildrenControls = (from x in this.m_ChildrenControls where x.GetType() != typeof(TimelineItemGUI) select x).ToList <Control>(); this.RebuildClipsGUICache(); this.RebuildEventsGUICache(state); this.SortItemsByStartTime(); this.m_TrackHash = base.track.Hash(); }
public void RangeSelectItems(TimelineItemGUI lastItemToSelect, TimelineWindow.TimelineState state) { List <TimelineItemGUI> source = SelectionManager.SelectedItemGUI().ToList <TimelineItemGUI>(); TimelineItemGUI timelineItemGUI = source.FirstOrDefault <TimelineItemGUI>(); if (timelineItemGUI == null) { SelectionManager.Add(lastItemToSelect.item); } else { List <TimelineTrackBaseGUI> allTracks = TimelineWindow.instance.allTracks; List <TimelineItemGUI> list = allTracks.OfType <TimelineTrackGUI>().SelectMany((TimelineTrackGUI ttGui) => from x in ttGui.items orderby x.item.start select x).ToList <TimelineItemGUI>(); int num = list.IndexOf(timelineItemGUI); TimelineItemGUI item = source.LastOrDefault <TimelineItemGUI>(); int num2 = list.IndexOf(item); int num3 = list.IndexOf(lastItemToSelect); if (num < num3) { for (int i = num; i <= num3; i++) { SelectionManager.Add(list[i].item); } } else { for (int j = num; j >= num3; j--) { SelectionManager.Add(list[j].item); } } if (Math.Min(num, num2) < num3 && num3 < Math.Max(num, num2)) { for (int k = Math.Min(num2, num3); k <= Math.Max(num2, num3); k++) { SelectionManager.Remove(list[k].item); } } SelectionManager.Add(lastItemToSelect.item); } }
public override void Init(IControl parent) { parent.MouseDown += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (state.IsCurrentEditingASequencerTextField()) { result = base.IgnoreEvent(); } else if (evt.get_button() != 0 && evt.get_button() != 1) { result = base.IgnoreEvent(); } else if (evt.get_modifiers() == 4) { result = base.IgnoreEvent(); } else if (TimelineWindow.instance.sequenceHeaderBounds.Contains(evt.get_mousePosition())) { foreach (TimelineTrackBaseGUI current in TimelineWindow.instance.allTracks) { Rect headerBounds = current.headerBounds; headerBounds.set_y(headerBounds.get_y() + TimelineWindow.instance.treeviewBounds.get_y()); if (headerBounds.Contains(evt.get_mousePosition())) { result = base.IgnoreEvent(); return(result); } } if (evt.get_modifiers() == null) { SelectionManager.Clear(); } result = base.IgnoreEvent(); } else { this.m_ActiveRect = TimelineWindow.instance.clipArea; if (!this.m_ActiveRect.Contains(evt.get_mousePosition())) { result = base.IgnoreEvent(); } else { List <IBounds> elementsAtPosition = Manipulator.GetElementsAtPosition(state.quadTree, evt.get_mousePosition()); bool flag; if (!RectangleSelect.CanStartRectableSelect(evt, elementsAtPosition, out flag)) { if (flag) { RectangleSelect.HandleReselection(elementsAtPosition); } else { RectangleSelect.HandleSingleSelection(evt, state, elementsAtPosition); } result = base.IgnoreEvent(); } else { state.captured.Add(target as IControl); this.m_IsCaptured = true; this.m_Start = evt.get_mousePosition(); this.m_End = evt.get_mousePosition(); if (RectangleSelect.CanClearSelection(evt)) { SelectionManager.Clear(); } result = base.IgnoreEvent(); } } } return(result); }; parent.KeyDown += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (this.m_IsCaptured && evt.get_keyCode() == 27) { state.captured.Remove(target as IControl); this.m_IsCaptured = false; result = base.ConsumeEvent(); } else { result = base.IgnoreEvent(); } return(result); }; parent.MouseUp += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (!this.m_IsCaptured) { if (evt.get_modifiers() == null && evt.get_button() == 0 && SelectionManager.IsMultiSelect()) { List <IBounds> elementsAtPosition = Manipulator.GetElementsAtPosition(state.quadTree, evt.get_mousePosition()); TimelineItemGUI timelineItemGUI = RectangleSelect.PickItemGUI(elementsAtPosition); if (timelineItemGUI != null && SelectionManager.Contains(timelineItemGUI.item)) { SelectionManager.Clear(); SelectionManager.Add(timelineItemGUI.item); } } result = base.IgnoreEvent(); } else { state.captured.Remove(target as IControl); this.m_IsCaptured = false; Rect r = this.CurrentSelectionRect(); if (r.get_width() < 1f || r.get_height() < 1f) { result = base.IgnoreEvent(); } else { List <IBounds> elementsInRectangle = Manipulator.GetElementsInRectangle(state.quadTree, r); if (elementsInRectangle.Count == 0) { result = base.IgnoreEvent(); } else { if (RectangleSelect.CanClearSelection(evt)) { SelectionManager.Clear(); } foreach (IBounds current in elementsInRectangle) { if (!(current is TimelineGroupGUI)) { if (current is TimelineItemGUI) { SelectionManager.Add(((TimelineItemGUI)current).item); } } } result = base.ConsumeEvent(); } } } return(result); }; parent.MouseDrag += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (!this.m_IsCaptured) { result = base.IgnoreEvent(); } else { this.m_End = evt.get_mousePosition(); result = base.ConsumeEvent(); } return(result); }; parent.Overlay += new TimelineUIEvent(this.DrawSelection); }
public static void DrawTrimGUI(WindowState state, TimelineItemGUI item, TrimEdge edge) { trimDrawer.DrawGUI(state, item.rect, modeColor, edge); }
public static void Add(IMarker marker, TimelineItemGUI gui) { s_ItemToItemGUI[marker] = gui; }
public static void Add(TimelineClip clip, TimelineItemGUI gui) { s_ItemToItemGUI[clip] = gui; }
public static bool IsDriver(TimelineItemGUI target, Event evt, TimelineWindow.TimelineState state) { return(SelectionManager.Contains(target.item)); }
protected void AddItem(TimelineItemGUI item) { m_Items.Add(item); m_NeedSort = true; }