Example #1
0
 public UndoMgr(ProjectMainForm owner, TabMgr.TabId id)
 {
     m_owner    = owner;
     m_id       = id;
     m_history  = new List <UndoAction>();
     m_nCurrent = -1;
 }
Example #2
0
        public void RemoveRange(TabMgr.TabId id, int nStart, int nCount)
        {
            ListBox lb = GetListbox(id);

            for (int i = 0; i < nCount; i++)
            {
                lb.Items.RemoveAt(nStart);
            }
        }
Example #3
0
        public void SetCurrent(TabMgr.TabId id, int nIndex)
        {
            ListBox lb = GetListbox(id);

            if (nIndex >= lb.Items.Count)
            {
                return;
            }
            lb.SelectedIndex = nIndex;
        }
Example #4
0
        /// <summary>
        /// Get the listbox associated with the given tab id.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private ListBox GetListbox(TabMgr.TabId id)
        {
            switch (id)
            {
            case TabMgr.TabId.Sprites:
                return(lbSprites);

            case TabMgr.TabId.BackgroundMaps:
                return(lbBackgroundMaps);

            case TabMgr.TabId.BackgroundImages:
                return(lbBackgroundImages);
            }
            return(null);
        }
Example #5
0
        public void Remove(TabMgr.TabId id, int nIndex)
        {
            ListBox lb = GetListbox(id);

            lb.Items.RemoveAt(nIndex);
        }
Example #6
0
        public void Add(TabMgr.TabId id, UndoAction action)
        {
            ListBox lb = GetListbox(id);

            lb.Items.Add(action.Description);
        }
Example #7
0
 public void SetCurrentUndo(TabMgr.TabId id, int nCurrent)
 {
     m_undoHistory.SetCurrent(id, nCurrent);
 }
Example #8
0
 /// <summary>
 /// Remove a range of undo actions.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="nStart">Index of the first undo action to remove</param>
 /// <param name="nCount">Number of undo actions to remove</param>
 public void RemoveUndoRange(TabMgr.TabId id, int nStart, int nCount)
 {
     m_undoHistory.RemoveRange(id, nStart, nCount);
 }
Example #9
0
 public void RemoveUndo(TabMgr.TabId id, int nIndex)
 {
     m_undoHistory.Remove(id, nIndex);
 }
Example #10
0
 public void AddUndo(TabMgr.TabId id, UndoAction action)
 {
     m_undoHistory.Add(id, action);
 }
Example #11
0
 public TabMgr GetTab(TabMgr.TabId id)
 {
     return(m_tabs[(int)id]);
 }
Example #12
0
 public UndoMgr(ProjectMainForm owner, TabMgr.TabId id)
 {
     m_owner = owner;
     m_id = id;
     m_history = new List<UndoAction>();
     m_nCurrent = -1;
 }