private void ProjectMainForm_Load(object sender, EventArgs e) { TabMgr.ResizeMainForm(this); m_tabs = new TabMgr[(int)TabMgr.TabId.MAX]; TabMgr tabSprites = new TabMgr(this, TabMgr.TabId.Sprites); m_tabs[(int)TabMgr.TabId.Sprites] = tabSprites; TabMgr tabBackgroundMaps = new TabMgr(this, TabMgr.TabId.BackgroundMaps); m_tabs[(int)TabMgr.TabId.BackgroundMaps] = tabBackgroundMaps; TabMgr tabBackgroundImages = new TabMgr(this, TabMgr.TabId.BackgroundImages); m_tabs[(int)TabMgr.TabId.BackgroundImages] = tabBackgroundImages; m_tabCurrent = tabSprites; tabSet.SelectedIndex = (int)m_tabCurrent.Id; AddProjectMenuItems(); AddSubwindowsToTabs(); HandleEverythingChanged(); m_undoHistory = new UndoHistoryForm(this); UndoHistoryVisible = false; ClearUndo(); m_doc.HasUnsavedChanges = false; // Add an Application.Idle += new EventHandler(OnIdle); }
public void SetCurrent(TabMgr.TabId id, int nIndex) { ListBox lb = GetListbox(id); if (nIndex >= lb.Items.Count) return; lb.SelectedIndex = nIndex; }
private void tabSet_SelectedIndexChanged(object sender, EventArgs e) { // Hide windows from old tab. m_tabCurrent.HideWindows(); // Show windws for new tab. m_tabCurrent = m_tabs[tabSet.SelectedIndex]; m_tabCurrent.ShowWindows(); }
/// <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; }
public void AddSubwindowsToTabs() { TabMgr tabSprites = GetTab(TabMgr.TabId.Sprites); tabSprites.AddSpritesetWindow(m_doc.Spritesets.Current.SpritesetWindow); tabSprites.AddSpriteWindow(m_doc.Spritesets.Current.SpriteWindow); tabSprites.AddPaletteWindow(m_doc.Palettes.CurrentPalette.PaletteWindowForm()); tabSprites.ArrangeWindows(); TabMgr tabBackgroundMaps = GetTab(TabMgr.TabId.BackgroundMaps); tabBackgroundMaps.AddSpritesetWindow(m_doc.BackgroundSpritesets.Current.SpritesetWindow); tabBackgroundMaps.AddSpriteWindow(m_doc.BackgroundSpritesets.Current.SpriteWindow); tabBackgroundMaps.AddPaletteWindow(m_doc.BackgroundPalettes.CurrentPalette.PaletteWindowForm()); tabBackgroundMaps.AddMapWindow(m_doc.BackgroundMaps.CurrentMap.MapWindow); tabBackgroundMaps.ArrangeWindows(); TabMgr tabBackgroundImages = GetTab(TabMgr.TabId.BackgroundImages); tabBackgroundImages.AddBgImageListWindow(m_doc.BackgroundImages.BgImageListWindow); tabBackgroundImages.AddBgImageWindow(m_doc.BackgroundImages.BgImageWindow); tabBackgroundImages.ArrangeWindows(); }
public void Remove(TabMgr.TabId id, int nIndex) { ListBox lb = GetListbox(id); lb.Items.RemoveAt(nIndex); }
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); }
public void Add(TabMgr.TabId id, UndoAction action) { ListBox lb = GetListbox(id); lb.Items.Add(action.Description); }
public void SetCurrentUndo(TabMgr.TabId id, int nCurrent) { m_undoHistory.SetCurrent(id, nCurrent); }
/// <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); }
public void RemoveUndo(TabMgr.TabId id, int nIndex) { m_undoHistory.Remove(id, nIndex); }
public TabMgr GetTab(TabMgr.TabId id) { return m_tabs[(int)id]; }
public void AddUndo(TabMgr.TabId id, UndoAction action) { m_undoHistory.Add(id, action); }
public UndoMgr(ProjectMainForm owner, TabMgr.TabId id) { m_owner = owner; m_id = id; m_history = new List<UndoAction>(); m_nCurrent = -1; }