/** * Initializes the plugin */ public void Initialize() { mainForm = this.pluginHost.MainForm; pluginPanel = null; // listen to keys XMLComplete.Init(mainForm); UITools.OnCharAdded += new UITools.CharAddedHandler( XMLComplete.OnChar ); }
protected override void Dispose(bool disposing) { if (disposing) { if (Menu != null) ((Form)m_content).Menu = Menu; m_content = null; } base.Dispose(disposing); }
static public void HideBar(DockContent target) { foreach(Control ctrl in target.Controls) { if (ctrl is MessageBar) { (ctrl as MessageBar).MessageBarClick(null, null); return; } } }
internal HiddenMdiChild(DockContent content) : base() { SetStyle(ControlStyles.Selectable, false); if (content == null) throw(new ArgumentNullException()); Form mdiParent = (content.DockPanel == null) ? null : content.DockPanel.FindForm(); if (mdiParent != null) if (!mdiParent.IsMdiContainer) mdiParent = null; if (mdiParent == null) throw(new InvalidOperationException()); m_content = content; Menu = ((Form)content).Menu; FormBorderStyle = FormBorderStyle.None; Text = m_content.Text; SetMdiParent(mdiParent); }
/// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Constructor[@name="()"]/*'/> public DockPanel() { m_extender = new DockPanelExtender(this); m_dragHandler = new DragHandler(this); m_panes = new DockPaneCollection(); m_floatWindows = new FloatWindowCollection(); SetStyle(ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); SuspendLayout(); Font = SystemInformation.MenuFont; m_autoHideWindow = new AutoHideWindow(this); m_autoHideWindow.Visible = false; if (Environment.Version.Major == 1) { m_dummyControl = new DummyControl(); m_dummyControl.Bounds = Rectangle.Empty; Controls.Add(m_dummyControl); } m_dockWindows = new DockWindowCollection(this); Controls.AddRange(new Control[] { DockWindows[DockState.Document], DockWindows[DockState.DockLeft], DockWindows[DockState.DockRight], DockWindows[DockState.DockTop], DockWindows[DockState.DockBottom] }); m_localWindowsHook = new LocalWindowsHook(HookType.WH_CALLWNDPROCRET); m_localWindowsHook.HookInvoked += new LocalWindowsHook.HookEventHandler(this.HookEventHandler); m_localWindowsHook.Install(); m_dummyContent = new DockContent(); ResumeLayout(); }
static private MessageBar CreateBar(DockContent target, string message) { MessageBar bar; foreach(Control ctrl in target.Controls) { if (ctrl is MessageBar) { bar = (ctrl as MessageBar); bar.Update(message); bar.Visible = true; return bar; } } bar = new MessageBar(); bar.Visible = false; target.Controls.Add(bar); bar.Update(message); bar.BringToFront(); bar.Dock = DockStyle.Top; bar.Visible = true; return bar; }
public AutoHideTab CreateAutoHideTab(DockContent content) { return new AutoHideTabVS2003(content); }
private void DrawTab_ToolWindow(Graphics g, DockContent content, Rectangle rect) { Rectangle rectIcon = new Rectangle( rect.X + ToolWindowImageGapLeft, rect.Y + rect.Height - 1 - ToolWindowImageGapBottom - ToolWindowImageHeight, ToolWindowImageWidth, ToolWindowImageHeight); Rectangle rectText = rectIcon; rectText.X += rectIcon.Width + ToolWindowImageGapRight; rectText.Width = rect.Width - rectIcon.Width - ToolWindowImageGapLeft - ToolWindowImageGapRight - ToolWindowTextGapRight; if (DockPane.ActiveContent == content) { g.FillRectangle(ActiveBackBrush, rect); g.DrawLine(OutlineOuterPen, rect.X, rect.Y, rect.X, rect.Y + rect.Height - 1); g.DrawLine(OutlineInnerPen, rect.X, rect.Y + rect.Height - 1, rect.X + rect.Width - 1, rect.Y + rect.Height - 1); g.DrawLine(OutlineInnerPen, rect.X + rect.Width - 1, rect.Y, rect.X + rect.Width - 1, rect.Y + rect.Height - 1); g.DrawString(content.TabText, Font, ActiveTextBrush, rectText, ToolWindowTextStringFormat); } else { if (Tabs.IndexOf(DockPane.ActiveContent) != Tabs.IndexOf(content) + 1) g.DrawLine(TabSeperatorPen, rect.X + rect.Width - 1, rect.Y + ToolWindowTabSeperatorGapTop, rect.X + rect.Width - 1, rect.Y + rect.Height - 1 - ToolWindowTabSeperatorGapBottom); g.DrawString(content.TabText, Font, InactiveTextBrush, rectText, ToolWindowTextStringFormat); } if (rect.Contains(rectIcon)) g.DrawIcon(content.Icon, rectIcon); }
private void FloatWindow_OnEndDrag(bool abort) { if (abort) { return; } FloatWindow floatWindow = (FloatWindow)DragControl; if (DropTarget.DropTo == null) { Rectangle rect = DragControl.Bounds; rect.X = Control.MousePosition.X + m_mouseOffset.X; rect.Y = Control.MousePosition.Y + m_mouseOffset.Y; DragControl.Bounds = rect; } else if (DropTarget.DropTo is DockPane) { DockPane paneTo = DropTarget.DropTo as DockPane; if (DropTarget.Dock == DockStyle.Fill) { for (int i = floatWindow.DockList.Count - 1; i >= 0; i--) { DockPane pane = floatWindow.DockList[i]; for (int j = pane.Contents.Count - 1; j >= 0; j--) { DockContent c = pane.Contents[j]; c.Pane = paneTo; if (DropTarget.ContentIndex != -1) { paneTo.SetContentIndex(c, DropTarget.ContentIndex); } c.Activate(); } } } else { DockAlignment alignment = DockAlignment.Left; if (DropTarget.Dock == DockStyle.Left) { alignment = DockAlignment.Left; } else if (DropTarget.Dock == DockStyle.Right) { alignment = DockAlignment.Right; } else if (DropTarget.Dock == DockStyle.Top) { alignment = DockAlignment.Top; } else if (DropTarget.Dock == DockStyle.Bottom) { alignment = DockAlignment.Bottom; } MergeDockList(floatWindow.DisplayingList, paneTo.DockListContainer.DockList, paneTo, alignment, 0.5); } } else if (DropTarget.DropTo is DockPanel) { DockList dockListTo = null; if (DropTarget.Dock == DockStyle.Top) { dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockTop].DockList; } else if (DropTarget.Dock == DockStyle.Bottom) { dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockBottom].DockList; } else if (DropTarget.Dock == DockStyle.Left) { dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockLeft].DockList; } else if (DropTarget.Dock == DockStyle.Right) { dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockRight].DockList; } else if (DropTarget.Dock == DockStyle.Fill) { dockListTo = floatWindow.DockPanel.DockWindows[DockState.Document].DockList; } DockPane prevPane = null; for (int i = dockListTo.Count - 1; i >= 0; i--) { if (dockListTo[i] != floatWindow.DisplayingList[0]) { prevPane = dockListTo[i]; } } MergeDockList(floatWindow.DisplayingList, dockListTo, prevPane, DockAlignment.Left, 0.5); } }
/// <exclude /> protected internal override void EnsureTabVisible(DockContent content) { if (Appearance != DockPane.AppearanceStyle.Document || !Tabs.Contains(content)) return; Rectangle rectTabStrip = TabsRectangle; Rectangle rectTab = GetTabRectangle(Tabs.IndexOf(content)); if (rectTab.Right > rectTabStrip.Right) { OffsetX -= rectTab.Right - rectTabStrip.Right; rectTab.X -= rectTab.Right - rectTabStrip.Right; } if (rectTab.Left < rectTabStrip.Left) OffsetX += rectTabStrip.Left - rectTab.Left; OnRefreshChanges(); }
public DockPane CreateDockPane(DockContent content, DockPane prevPane, DockAlignment alignment, double proportion, bool show) { return new DockPane(content, prevPane, alignment, proportion, show); }
/// <exclude/> protected override void WndProc(ref Message m) { if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDOWN) { if (IsDisposed) { return; } uint result = User32.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam); if (result == 2 && DockPanel.AllowRedocking && this.AllowRedocking) // HITTEST_CAPTION { Activate(); m_dockPanel.DragHandler.BeginDragFloatWindow(this); } else { base.WndProc(ref m); } return; } else if (m.Msg == (int)Win32.Msgs.WM_CLOSE) { if (DockList.Count == 0) { base.WndProc(ref m); return; } for (int i = DockList.Count - 1; i >= 0; i--) { DockContentCollection contents = DockList[i].Contents; for (int j = contents.Count - 1; j >= 0; j--) { DockContent content = contents[j]; if (content.DockState != DockState.Float) { continue; } if (!content.CloseButton) { continue; } if (content.HideOnClose) { content.Hide(); } else { content.Close(); } } } return; } else if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDBLCLK) { uint result = User32.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam); if (result != 2) // HITTEST_CAPTION { base.WndProc(ref m); return; } // Restore to panel DockContent activeContent = DockPanel.ActiveContent; foreach (DockPane pane in DockList) { if (pane.DockState != DockState.Float) { continue; } pane.RestoreToPanel(); } if (activeContent != null) { activeContent.Activate(); } return; } else if (m.Msg == WM_CHECKDISPOSE) { if (DockList.Count == 0) { Dispose(); } return; } base.WndProc(ref m); }
private void SafeInit() { this.mainForm = this.pluginHost.MainForm; this.pluginUI = new PluginUI(); System.Drawing.Image image = this.mainForm.GetSystemImage(46); /** * Create panel */ this.pluginUI.Tag = "ActionScript"; this.pluginUI.Text = "ActionScript"; this.pluginPanel = mainForm.CreateDockingPanel(this.pluginUI, this.pluginGuid, image, DockState.DockRight); /** * Default shortcuts */ if (!MainForm.MainSettings.HasKey(SETTING_SHORTCUT_CHECK)) MainForm.MainSettings.AddValue(SETTING_SHORTCUT_CHECK, "F7"); if (!MainForm.MainSettings.HasKey(SETTING_SHORTCUT_BUILD)) MainForm.MainSettings.AddValue(SETTING_SHORTCUT_BUILD, "CtrlF8"); if (!MainForm.MainSettings.HasKey(SETTING_SHORTCUT_GOTO)) MainForm.MainSettings.AddValue(SETTING_SHORTCUT_GOTO, "F4"); if (!MainForm.MainSettings.HasKey(SETTING_SHORTCUT_BACK)) MainForm.MainSettings.AddValue(SETTING_SHORTCUT_BACK, "ShiftF4"); if (!MainForm.MainSettings.HasKey(SETTING_SHORTCUT_CLEARCACHE)) MainForm.MainSettings.AddValue(SETTING_SHORTCUT_CLEARCACHE, "CtrlF7"); /** * Create menu items */ menuItems = new ArrayList(); CommandBarItem item; CommandBarMenu menu = mainForm.GetCBMenu("ViewMenu"); menu.Items.AddButton(image, "&ActionScript Panel", new EventHandler(this.OpenPanel)); Keys k; // tools items menu = this.mainForm.GetCBMenu("FlashToolsMenu"); if (menu != null) { menu.Items.AddSeparator(); // clear class cache k = MainForm.MainSettings.GetShortcut(SETTING_SHORTCUT_CLEARCACHE); if (k != Keys.None) this.mainForm.IgnoredKeys.Add(k); else ErrorHandler.ShowInfo("Settings Error: Invalid Shortcut ("+MainForm.MainSettings.GetValue(SETTING_SHORTCUT_CLEARCACHE)+")"); menu.Items.AddButton("&Clear Class Cache", new EventHandler(this.ClearClassCache), k); // convert to intrinsic item = menu.Items.AddButton("Convert To &Intrinsic", new EventHandler(this.MakeIntrinsic)); menuItems.Add(item); // check actionscript image = this.pluginUI.treeIcons.Images[11]; k = MainForm.MainSettings.GetShortcut(SETTING_SHORTCUT_CHECK); if (k != Keys.None) this.mainForm.IgnoredKeys.Add(k); else ErrorHandler.ShowInfo("Settings Error: Invalid Shortcut ("+MainForm.MainSettings.GetValue(SETTING_SHORTCUT_CHECK)+")"); item = menu.Items.AddButton(image, "Check &ActionScript", new EventHandler(this.CheckActionScript), k); menuItems.Add(item); // quick MTASC build image = this.pluginUI.treeIcons.Images[10]; k = MainForm.MainSettings.GetShortcut(SETTING_SHORTCUT_BUILD); if (k != Keys.None) this.mainForm.IgnoredKeys.Add(k); else ErrorHandler.ShowInfo("Settings Error: Invalid Shortcut ("+MainForm.MainSettings.GetValue(SETTING_SHORTCUT_BUILD)+")"); item = menu.Items.AddButton(image, "&Quick Build", new EventHandler(this.QuickBuild), k); menuItems.Add(item); } else ErrorHandler.ShowInfo("MainMenu Error: no 'FlashToolsMenu' group found"); // toolbar items CommandBar toolbar = MainForm.GetCBToolbar(); if (toolbar != null) { toolbar.Items.AddSeparator(); // check image = this.pluginUI.treeIcons.Images[11]; item = toolbar.Items.AddButton(image, "Check ActionScript", new EventHandler(this.CheckActionScript)); menuItems.Add(item); // build image = this.pluginUI.treeIcons.Images[10]; item = toolbar.Items.AddButton(image, "Quick Build", new EventHandler(this.QuickBuild)); menuItems.Add(item); } // search items menu = this.mainForm.GetCBMenu("SearchMenu"); if (menu != null) { menu.Items.AddSeparator(); // goto back from declaration image = this.mainForm.GetSystemImage(18); k = MainForm.MainSettings.GetShortcut(SETTING_SHORTCUT_BACK); if (k != Keys.None) this.mainForm.IgnoredKeys.Add(k); else ErrorHandler.ShowInfo("Settings Error: Invalid Shortcut ("+MainForm.MainSettings.GetValue(SETTING_SHORTCUT_BACK)+")"); item = menu.Items.AddButton(image, "&Back From Declaration", new EventHandler(this.BackDeclaration), k); menuItems.Add(item); // goto declaration image = this.mainForm.GetSystemImage(17); k = MainForm.MainSettings.GetShortcut(SETTING_SHORTCUT_GOTO); if (k != Keys.None) this.mainForm.IgnoredKeys.Add(k); else ErrorHandler.ShowInfo("Settings Error: Invalid Shortcut ("+MainForm.MainSettings.GetValue(SETTING_SHORTCUT_GOTO)+")"); item = menu.Items.AddButton(image, "Goto &Declaration", new EventHandler(this.GotoDeclaration), k); menuItems.Add(item); } else ErrorHandler.ShowInfo("MainMenu Error: no 'SearchMenu' group found"); /** * Initialize completion context */ sciReferences = new ArrayList(); ASContext.Init(this); UITools.OnCharAdded += new UITools.CharAddedHandler( OnChar ); InfoTip.OnMouseHover += new InfoTip.MouseHoverHandler( OnMouseHover ); UITools.OnTextChanged += new UITools.TextChangedHandler( ASContext.OnTextChanged ); InfoTip.OnUpdateCallTip += new InfoTip.UpdateCallTipHandler( OnUpdateCallTip ); this.mainForm.IgnoredKeys.Add(Keys.Control|Keys.Enter); this.mainForm.IgnoredKeys.Add(Keys.F1); /** * Path to the Flash IDE */ if (!MainForm.MainSettings.HasKey(SETTING_MACROMEDIA_FLASHIDE)) { string found = ""; foreach(string flashexe in MACROMEDIA_FLASHIDE_PATH) { if (System.IO.File.Exists(flashexe)) { found = flashexe; break; } } MainForm.MainSettings.AddValue(SETTING_MACROMEDIA_FLASHIDE, found); } }
/// <include file='CodeDoc\DockPaneTabCollection.xml' path='//CodeDoc/Class[@name="DockPaneTabCollection"]/Method[@name="Contains(DockContent)"]/*'/>> public bool Contains(DockContent content) { return (IndexOf(content) != -1); }
/// <include file='CodeDoc\AutoHideTabCollection.xml' path='//CodeDoc/Class[@name="AutoHideTabCollection"]/Method[@name="IndexOf(DockContent)"]/*'/>> public int IndexOf(DockContent content) { return(DockPane.DisplayingContents.IndexOf(content)); }
internal AutoHideTabVS2003(DockContent content) : base(content) { }
/// <include file='CodeDoc\AutoHideTabCollection.xml' path='//CodeDoc/Class[@name="AutoHideTabCollection"]/Method[@name="Contains(DockContent)"]/*'/>> public bool Contains(DockContent content) { return(IndexOf(content) != -1); }
private void Content_OnEndDrag(bool abort) { User32.SetCursor(DragControl.Cursor.Handle); if (abort) { return; } DockContent content = ((DockPane)DragControl).ActiveContent; if (DropTarget.DropTo is DockPane) { DockPane paneTo = DropTarget.DropTo as DockPane; if (DropTarget.Dock == DockStyle.Fill) { bool samePane = (content.Pane == paneTo); if (!samePane) { content.Pane = paneTo; } if (DropTarget.ContentIndex == -1 || !samePane) { paneTo.SetContentIndex(content, DropTarget.ContentIndex); } else { DockContentCollection contents = paneTo.Contents; int oldIndex = contents.IndexOf(content); int newIndex = DropTarget.ContentIndex; if (oldIndex < newIndex) { newIndex += 1; if (newIndex > contents.Count - 1) { newIndex = -1; } } paneTo.SetContentIndex(content, newIndex); } content.Activate(); } else { DockPane pane = content.DockPanel.DockPaneFactory.CreateDockPane(content, paneTo.DockState, true); IDockListContainer container = paneTo.DockListContainer; if (DropTarget.Dock == DockStyle.Left) { pane.AddToDockList(container, paneTo, DockAlignment.Left, 0.5); } else if (DropTarget.Dock == DockStyle.Right) { pane.AddToDockList(container, paneTo, DockAlignment.Right, 0.5); } else if (DropTarget.Dock == DockStyle.Top) { pane.AddToDockList(container, paneTo, DockAlignment.Top, 0.5); } else if (DropTarget.Dock == DockStyle.Bottom) { pane.AddToDockList(container, paneTo, DockAlignment.Bottom, 0.5); } pane.DockState = paneTo.DockState; pane.Activate(); } } else if (DropTarget.DropTo is DockPanel) { DockPane pane; DockPanel dockPanel = content.DockPanel; if (DropTarget.Dock == DockStyle.Top) { pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockTop, true); } else if (DropTarget.Dock == DockStyle.Bottom) { pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockBottom, true); } else if (DropTarget.Dock == DockStyle.Left) { pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockLeft, true); } else if (DropTarget.Dock == DockStyle.Right) { pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockRight, true); } else if (DropTarget.Dock == DockStyle.Fill) { pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.Document, true); } else { return; } pane.Activate(); } else if (IsDockStateValid(DockState.Float)) { Point ptMouse = Control.MousePosition; Size size = FloatWindow.DefaultWindowSize; Point location; if (content.DockState == DockState.Document) { location = new Point(ptMouse.X + m_mouseOffset.X, ptMouse.Y + m_mouseOffset.Y); } else { location = new Point(ptMouse.X + m_mouseOffset.X, ptMouse.Y + m_mouseOffset.Y - size.Height); } if (ptMouse.X > location.X + size.Width) { location.X += ptMouse.X - (location.X + size.Width) + OutlineBorderWidth; } DockPane pane = content.DockPanel.DockPaneFactory.CreateDockPane(content, new Rectangle(location, size), true); pane.Activate(); } }
internal DockPaneTabVS2003(DockContent content) : base(content) { }
public DockPane CreateDockPane(DockContent content, DockState visibleState, bool show) { return new DockPane(content, visibleState, show); }
/** * Gets the editor documents */ public DockContent[] GetDocuments() { int found = 0; int count = this.dockPanel.Documents.Length; for (int i = 0; i<count; i++) { if (this.dockPanel.Documents[i] is FlashDevelop.TabbedDocument) found++; } DockContent[] elements = new DockContent[found]; found = 0; for (int i = 0; i<count; i++) { if (this.dockPanel.Documents[i] is FlashDevelop.TabbedDocument) { elements[found++] = this.dockPanel.Documents[i]; } } return elements; }
public DockPane CreateDockPane(DockContent content, FloatWindow floatWindow, bool show) { return new DockPane(content, floatWindow, show); }
/** * Reloads the specified document */ public void ReloadDocument(DockContent doc, bool showQuestion) { if (showQuestion) { if (MessageBox.Show("Are you sure you want to reload the file?\nAll changes get lost.", " Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } this.reloadingDoc = true; TabbedDocument td = (TabbedDocument)doc; int codepage = FileSystem.GetFileCodepage(td.FilePath); Encoding encoding = Encoding.GetEncoding(codepage); string contents = FileSystem.Read(td.FilePath, encoding); td.SciControl.Encoding = encoding; td.SciControl.CodePage = codepage; td.SciControl.Text = contents; td.SciControl.EmptyUndoBuffer(); this.OnFileReload(); }
/// <include file='CodeDoc/DockPaneStripBase.xml' path='//CodeDoc/Class[@name="DockPaneStripBase"]/Method[@name="EnsureTabVisible(DockContent)"]/*'/> protected internal abstract void EnsureTabVisible(DockContent content);
private void Pane_OnEndDrag(bool abort) { User32.SetCursor(DragControl.Cursor.Handle); if (abort) { return; } DockPane pane = (DockPane)DragControl; if (DropTarget.DropTo is DockPane) { DockPane paneTo = DropTarget.DropTo as DockPane; if (DropTarget.Dock == DockStyle.Fill) { for (int i = pane.Contents.Count - 1; i >= 0; i--) { DockContent c = pane.Contents[i]; c.Pane = paneTo; if (DropTarget.ContentIndex != -1) { paneTo.SetContentIndex(c, DropTarget.ContentIndex); } c.Activate(); } } else { if (DropTarget.Dock == DockStyle.Left) { pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Left, 0.5); } else if (DropTarget.Dock == DockStyle.Right) { pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Right, 0.5); } else if (DropTarget.Dock == DockStyle.Top) { pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Top, 0.5); } else if (DropTarget.Dock == DockStyle.Bottom) { pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Bottom, 0.5); } pane.DockState = paneTo.DockState; pane.Activate(); } } else if (DropTarget.DropTo is DockPanel) { if (DropTarget.Dock == DockStyle.Top) { pane.DockState = DockState.DockTop; } else if (DropTarget.Dock == DockStyle.Bottom) { pane.DockState = DockState.DockBottom; } else if (DropTarget.Dock == DockStyle.Left) { pane.DockState = DockState.DockLeft; } else if (DropTarget.Dock == DockStyle.Right) { pane.DockState = DockState.DockRight; } else if (DropTarget.Dock == DockStyle.Fill) { pane.DockState = DockState.Document; } pane.Activate(); } else if (IsDockStateValid(DockState.Float)) { Point ptMouse = Control.MousePosition; Point location = new Point(ptMouse.X + m_mouseOffset.X, ptMouse.Y + m_mouseOffset.Y); Size size; bool createFloatWindow = true; if (pane.FloatWindow == null) { size = FloatWindow.DefaultWindowSize; } else if (pane.FloatWindow.DockList.Count == 1) { size = pane.FloatWindow.Size; createFloatWindow = false; } else { size = FloatWindow.DefaultWindowSize; } if (ptMouse.X > location.X + size.Width) { location.X += ptMouse.X - (location.X + size.Width) + OutlineBorderWidth; } if (createFloatWindow) { pane.FloatWindow = pane.DockPanel.FloatWindowFactory.CreateFloatWindow(pane.DockPanel, pane, new Rectangle(location, size)); } else { pane.FloatWindow.Bounds = new Rectangle(location, size); } pane.DockState = DockState.Float; pane.Activate(); } }
/// <include file='CodeDoc\DockPaneTabCollection.xml' path='//CodeDoc/Class[@name="DockPaneTabCollection"]/Method[@name="IndexOf(DockContent)"]/*'/>> public int IndexOf(DockContent content) { return DockPane.DisplayingContents.IndexOf(content); }
/// <include file='CodeDoc\DockContent.xml' path='//CodeDoc/Class[@name="DockContent"]/Method[@name="Show(DockPane, DockContent)"]/*'/> public void Show(DockPane pane, DockContent beforeContent) { if (pane == null) throw(new ArgumentNullException(ResourceHelper.GetString("DockContent.Show.NullPane"))); if (beforeContent != null && pane.Contents.IndexOf(beforeContent) == -1) throw(new ArgumentException(ResourceHelper.GetString("DockContent.Show.InvalidBeforeContent"))); DockPanel = pane.DockPanel; Pane = pane; pane.SetContentIndex(this, pane.Contents.IndexOf(beforeContent)); Show(); }
/** * Gets a index of the document */ private int GetIndexForDockContent(DockContent doc) { int count = this.dockPanel.Documents.Length; for (int i = 0; i<count; i++) { if (doc.Equals(this.dockPanel.Documents[i])) { return i; } } return -1; }
/** * Find the ScintillaControl of a document */ public ScintillaControl GetSciControl(DockContent document) { if (document == null) { document = CurDocument; if (document == null) { return null; } } foreach(Control ctrl in document.Controls) { if (ctrl is ScintillaControl) { return ctrl as ScintillaControl; } } return null; }
/// <include file='CodeDoc/DockPaneTab.xml' path='//CodeDoc/Class[@name="DockPaneTab"]/Construct[@name="(DockContent)"]/*'/> public DockPaneTab(DockContent content) { m_content = content; }
public void Initialize() { MainFormRef = MainForm; // Mika: added Icons.Initialize(MainForm); Settings.Initialize(MainForm); PluginData.Load(); showProjectClasspaths = Settings.ShowProjectClasspaths; showGlobalClasspaths = Settings.ShowGlobalClasspaths; MainForm.IgnoredKeys.Add(Keys.F5); MainForm.IgnoredKeys.Add(Keys.F8); #region Actions and Event Listeners menus = new FDMenus(MainForm); menus.View.Click += new EventHandler(OpenPanel); menus.GlobalClasspaths.Click += new EventHandler(OpenGlobalClasspaths); menus.ProjectMenu.NewProject.Click += new EventHandler(NewProject); menus.ProjectMenu.OpenProject.Click += new EventHandler(OpenProject); menus.ProjectMenu.CloseProject.Click += new EventHandler(CloseProject); menus.ProjectMenu.TestMovie.Click += new EventHandler(TestMovie); menus.ProjectMenu.BuildProject.Click += new EventHandler(BuildProject); menus.ProjectMenu.Properties.Click += new EventHandler(OpenProjectProperties); menus.RecentComboBox.RequestProject += new ProjectRequestHandler(GetProject); menus.RecentComboBox.OpenProject += new ProjectOpenHandler(OpenProjectSilent); buildActions = new BuildActions(MainForm); buildActions.BuildComplete += new BuildCompleteHandler(BuildComplete); buildActions.ClasspathsChanged += new EventHandler(ProjectClasspathsChanged); flashDevelopActions = new FlashDevelopActions(MainForm); fileActions = new FileActions(pluginUI); fileActions.OpenFile += new FileNameHandler(OpenFile); fileActions.FileDeleted += new FileNameHandler(FileDeleted); fileActions.FileMoved += new FileMovedHandler(FileMoved); projectActions = new ProjectActions(pluginUI); // create our UI surface and a docking panel for it pluginUI = new PluginUI(this,menus,fileActions,projectActions); pluginUI.NewProject += new EventHandler(NewProject); pluginUI.OpenProject += new EventHandler(OpenProject); pluginUI.Rename += new RenameEventHandler(fileActions.Rename); pluginUI.Tree.MovePath += new DragPathEventHandler(fileActions.Move); pluginUI.Tree.CopyPath += new DragPathEventHandler(fileActions.Copy); pluginUI.Menu.Open.Click += new EventHandler(TreeOpenItems); pluginUI.Menu.Execute.Click += new EventHandler(TreeExecuteItems); pluginUI.Menu.Insert.Click += new EventHandler(TreeInsertItem); pluginUI.Menu.AddLibrary.Click += new EventHandler(TreeAddLibraryItems); pluginUI.Menu.AlwaysCompile.Click += new EventHandler(TreeAlwaysCompileItems); pluginUI.Menu.Cut.Click += new EventHandler(TreeCutItems); pluginUI.Menu.Copy.Click += new EventHandler(TreeCopyItems); pluginUI.Menu.Paste.Click += new EventHandler(TreePasteItems); pluginUI.Menu.Delete.Click += new EventHandler(TreeDeleteItems); pluginUI.Menu.LibraryOptions.Click += new EventHandler(TreeLibraryOptions); pluginUI.Menu.Hide.Click += new EventHandler(TreeHideItems); pluginUI.Menu.ShowHidden.Click += new EventHandler(ToggleShowHidden); pluginUI.Menu.AddNewClass.Click += new EventHandler(TreeAddNewClass); pluginUI.Menu.AddNewXml.Click += new EventHandler(TreeAddXml); pluginUI.Menu.AddNewFile.Click += new EventHandler(TreeAddFile); pluginUI.Menu.AddNewFolder.Click += new EventHandler(TreeAddFolder); pluginUI.Menu.AddLibraryAsset.Click += new EventHandler(TreeAddAsset); pluginUI.Menu.AddExistingFile.Click += new EventHandler(TreeAddExistingFile); pluginUI.TreeBar.Refresh.Click += new EventHandler(TreeRefreshNode); menus.RecentComboBox.Rebuild(); #endregion pluginPanel = MainForm.CreateDockingPanel(pluginUI, Guid, Icons.Project.Img, DockState.DockRight); // try to open the last opened project string lastProject = Settings.LastProject; if (Settings.LastProject != "" && File.Exists(Settings.LastProject)) { OpenProjectSilent(lastProject); // if we open the last project right away, we need to give ASCompletion // some time before we can trust that it received our classpaths ok startupTimer = new Timer(); startupTimer.Tick += new EventHandler(ProjectClasspathsChanged); startupTimer.Interval = 1000; startupTimer.Start(); } else Project = null; try { ProjectIcon.Associate(); // make sure .fdp points to this instance of FD } catch(UnauthorizedAccessException) { // silent } catch(Exception) { // silent? } }
/** * Initializes the plugin */ public void Initialize() { this.mainForm = this.pluginHost.MainForm; this.pluginUI = new PluginUI(this); System.Drawing.Image image = mainForm.GetSystemImage(22); /** * Create panel */ this.pluginUI.Tag = "Output"; this.pluginUI.Text = "Output"; this.pluginPanel = mainForm.CreateDockingPanel(this.pluginUI, this.pluginGuid, image, DockState.DockBottomAutoHide); /** * Create menu item */ CommandBarMenu ViewMenu = mainForm.GetCBMenu("ViewMenu"); ViewMenu.Items.AddButton(image, "&Output Panel", new EventHandler(this.OpenPanel)); }
/// <include file='CodeDoc\EventArgs.xml' path='//CodeDoc/Class[@name="DockContentEventArgs"]/Constructor[@name="(DockContent)"]/*'/> public DockContentEventArgs(DockContent content) { m_content = content; }
public DockPane CreateDockPane(DockContent content, Rectangle floatWindowBounds, bool show) { return new DockPane(content, floatWindowBounds, show); }
private void DrawTab(Graphics g, DockContent content, Rectangle rect) { OnBeginDrawTab(content.DockPaneTab); if (Appearance == DockPane.AppearanceStyle.ToolWindow) DrawTab_ToolWindow(g, content, rect); else DrawTab_Document(g, content, rect); OnEndDrawTab(content.DockPaneTab); }
public DockPaneTab CreateDockPaneTab(DockContent content) { return new DockPaneTabVS2003(content); }
private void DrawTab_Document(Graphics g, DockContent content, Rectangle rect) { Rectangle rectText = rect; rectText.X += DocumentTextExtraWidth / 2; rectText.Width -= DocumentTextExtraWidth; if (DockPane.ActiveContent == content) { g.FillRectangle(ActiveBackBrush, rect); g.DrawLine(OutlineOuterPen, rect.X, rect.Y, rect.X, rect.Y + rect.Height); g.DrawLine(OutlineOuterPen, rect.X, rect.Y, rect.X + rect.Width - 1, rect.Y); g.DrawLine(OutlineInnerPen, rect.X + rect.Width - 1, rect.Y, rect.X + rect.Width - 1, rect.Y + rect.Height - 1); if (DockPane.IsActiveDocumentPane) { using (Font boldFont = new Font(this.Font, FontStyle.Bold)) { g.DrawString(content.Text, boldFont, ActiveTextBrush, rectText, DocumentTextStringFormat); } } else g.DrawString(content.Text, Font, InactiveTextBrush, rectText, DocumentTextStringFormat); } else { if (Tabs.IndexOf(DockPane.ActiveContent) != Tabs.IndexOf(content) + 1) g.DrawLine(TabSeperatorPen, rect.X + rect.Width - 1, rect.Y, rect.X + rect.Width - 1, rect.Y + rect.Height - 1 - DocumentTabGapTop); g.DrawString(content.Text, Font, InactiveTextBrush, rectText, DocumentTextStringFormat); } }
private void DrawTab(Graphics g, AutoHideTabVS2003 tab) { Rectangle rectTab = GetTabRectangle(tab); if (rectTab.IsEmpty) { return; } DockState dockState = tab.Content.DockState; DockContent content = tab.Content; OnBeginDrawTab(tab); Brush brushTabBackGround = BrushTabBackground; Pen penTabBorder = PenTabBorder; Brush brushTabText = BrushTabText; g.FillRectangle(brushTabBackGround, rectTab); g.DrawLine(penTabBorder, rectTab.Left, rectTab.Top, rectTab.Left, rectTab.Bottom); g.DrawLine(penTabBorder, rectTab.Right, rectTab.Top, rectTab.Right, rectTab.Bottom); if (dockState == DockState.DockTopAutoHide || dockState == DockState.DockRightAutoHide) { g.DrawLine(penTabBorder, rectTab.Left, rectTab.Bottom, rectTab.Right, rectTab.Bottom); } else { g.DrawLine(penTabBorder, rectTab.Left, rectTab.Top, rectTab.Right, rectTab.Top); } // Set no rotate for drawing icon and text Matrix matrixRotate = g.Transform; g.Transform = MatrixIdentity; // Draw the icon Rectangle rectImage = rectTab; rectImage.X += ImageGapLeft; rectImage.Y += ImageGapTop; int imageHeight = rectTab.Height - ImageGapTop - ImageGapBottom; int imageWidth = ImageWidth; if (imageHeight > ImageHeight) { imageWidth = ImageWidth * (imageHeight / ImageHeight); } rectImage.Height = imageHeight; rectImage.Width = imageWidth; rectImage = GetTransformedRectangle(dockState, rectImage); g.DrawIcon(content.Icon, rectImage); // Draw the text if (content == content.Pane.ActiveContent) { Rectangle rectText = rectTab; rectText.X += ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft; rectText.Width -= ImageGapLeft + imageWidth + ImageGapRight + TextGapLeft; rectText = GetTransformedRectangle(dockState, rectText); if (dockState == DockState.DockLeftAutoHide || dockState == DockState.DockRightAutoHide) { g.DrawString(content.TabText, Font, brushTabText, rectText, StringFormatTabVertical); } else { g.DrawString(content.TabText, Font, brushTabText, rectText, StringFormatTabHorizontal); } } // Set rotate back g.Transform = matrixRotate; OnEndDrawTab(tab); }