Exemplo n.º 1
0
 public PlaysTimeline(IWidget widget) : base(widget)
 {
     eventsTimelines  = new Dictionary <EventType, CategoryTimeline> ();
     timelineToFilter = new Dictionary <TimelineObject, object> ();
     secondsPerPixel  = 0.1;
     Accuracy         = Constants.TIMELINE_ACCURACY;
     SelectionMode    = MultiSelectionMode.MultipleWithModifier;
     SingleSelectionObjects.Add(typeof(TimerTimeNodeObject));
     currentTime = new Time(0);
 }
Exemplo n.º 2
0
 public PlaysTimeline(IWidget widget) : base(widget)
 {
     viewModelToView = new Dictionary <IViewModel, TimelineView> ();
     secondsPerPixel = 0.1;
     Accuracy        = Constants.TIMELINE_ACCURACY;
     SelectionMode   = MultiSelectionMode.MultipleWithModifier;
     SingleSelectionObjects.Add(typeof(TimerTimeNodeView));
     currentTime      = new Time(0);
     duration         = new Time(0);
     cursor           = CursorType.LeftArrow;
     cursorIsDrawTool = false;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Updates the current selection. If <paramref name="sel"/> is <c>null</c>,
        /// it clears the current selection. If <paramref name="sel"/> wasn't previously
        /// selected, it's added to the list of selected objects, otherwise it's removed
        /// from the list.
        /// </summary>
        /// <param name="sel">The selection.</param>
        /// <param name="notify">If set to <c>true</c>, notifies about the changes.</param>
        internal protected virtual void UpdateSelection(Selection sel, bool notify = true)
        {
            ICanvasSelectableObject so;
            Selection seldup;

            if (sel == null)
            {
                ClearSelection();
                if (notify)
                {
                    SelectionChanged(Selections);
                }
                return;
            }

            so = sel.Drawable as ICanvasSelectableObject;

            if (so == null)
            {
                return;
            }


            if (Selections.Count > 0)
            {
                if (SingleSelectionObjects.Contains(so.GetType()) ||
                    SingleSelectionObjects.Contains(Selections [0].Drawable.GetType()))
                {
                    return;
                }
            }

            seldup = Selections.FirstOrDefault(s => s.Drawable == sel.Drawable);

            if (seldup != null)
            {
                so.Selected = false;
                Selections.Remove(seldup);
            }
            else
            {
                so.Selected = true;
                Selections.Add(sel);
            }
            if (notify)
            {
                SelectionChanged(Selections);
            }
        }