public void RemoveAllDocuments(ContentDocument except) { ContentDocument[] copyOfPanesList = _panes.ToArray(); foreach (ContentDocument pane in copyOfPanesList) { if (pane != except) { bool cancelled = false; pane.Control.PanelClosing(true, ref cancelled); if (!cancelled) { pane.Control.DockingContainer.Hide(); pane.Visible = false; _panes.Remove(pane); _panesInOrderUsed.Remove(pane); } } } if (except != null) { SetActiveDocument(except); } else { RefreshWindowsMenu(); } }
private void TreeContextMenuOnHelp(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; ContentDocument document = (ContentDocument)item.Owner.Tag; Factory.GUIController.LaunchHelpForKeyword(document.Control.HelpKeyword); }
public void ShowPane(ContentDocument doc) { RemoveItemsFromLastPane(); if ((doc == null) || (doc.ToolbarCommands == null)) { return; } if (_toolBar.Items.Count > 0) { _toolBar.Items.Add(_paneSpecificSeparator); } foreach (MenuCommand command in doc.ToolbarCommands) { ToolStripButton button = new ToolStripButton(string.Empty, Factory.GUIController.ImageList.Images[command.IconKey], new EventHandler(ToolbarEventHandler), command.ID); button.Tag = doc; button.ToolTipText = command.Name; button.Enabled = command.Enabled; if (command.Checked) { button.CheckState = CheckState.Checked; } _toolBar.Items.Add(button); _buttonsForCurrentPane.Add(button); } }
private bool DrawPane(Graphics graphics, ContentDocument pane, bool selected, int x, int y) { Pen borderPen = Pens.Gray; int textWidth = (int)graphics.MeasureString(pane.Name, _selectedPaneFont).Width + 5; if (x + TAB_HEIGHT + textWidth >= btnListAll.Left) { // going off the edge of the screen return(false); } GraphicsPath path = new GraphicsPath(); path.AddLine(x, y + TAB_HEIGHT, x + TAB_HEIGHT, y); path.AddLine(x + TAB_HEIGHT, y, x + TAB_HEIGHT + textWidth, y); path.AddLine(x + TAB_HEIGHT + textWidth, y, x + TAB_HEIGHT + textWidth, y + TAB_HEIGHT); path.CloseFigure(); if (selected) { graphics.FillPath(Brushes.White, path); } graphics.DrawPath(borderPen, path); System.Drawing.Font fontToUse = _unselectedPaneFont; if (selected) { fontToUse = _selectedPaneFont; } graphics.DrawString(pane.Name, fontToUse, Brushes.Black, x + TAB_HEIGHT, y + 2); graphics.DrawLine(borderPen, 0, tabsPanel.ClientSize.Height - 1, tabsPanel.ClientSize.Width - 1, tabsPanel.ClientSize.Height - 1); pane.TabXOffset = x; pane.TabWidth = TAB_HEIGHT + textWidth; return(true); }
public void RemoveAllDocumentsExcept(ContentDocument pane) { List <ContentDocument> newPaneList = new List <ContentDocument>(); ContentDocument[] copyOfPaneList = _panes.ToArray(); foreach (ContentDocument doc in copyOfPaneList) { if (doc != pane) { bool cancelled = false; doc.Control.PanelClosing(true, ref cancelled); if (cancelled) { newPaneList.Add(doc); } else { doc.Visible = false; } } } _panes = newPaneList; _panes.Add(pane); _panesInOrderUsed = new List <ContentDocument>(); foreach (ContentDocument doc in _panes) { _panesInOrderUsed.Add(doc); } if (pane != _currentPane) { SetActiveDocument(pane); } tabsPanel.Invalidate(); }
private void RemoveDocument(ContentDocument pane, bool canCancel) { bool cancelled = false; pane.Control.PanelClosing(canCancel, ref cancelled); if (canCancel && cancelled) { return; } pane.Visible = false; _panes.Remove(pane); _panesInOrderUsed.Remove(pane); if (pane == _currentPane) { if (_panes.Count > 0) { SetActiveDocument(_panesInOrderUsed[0]); } else { _currentPane = null; contentPane1.Controls.Clear(); ShowControlAsEmpty(); if (ActiveDocumentChanged != null) { ActiveDocumentChanged(null); } } } tabsPanel.Invalidate(); }
private void DocumentListMenuEventHandler(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; ContentDocument document = (ContentDocument)item.Tag; SetActiveDocument(document); }
public void RemovePaneIfExists(ContentDocument pane) { if (tabbedDocumentContainer1.ContainsDocument(pane)) { tabbedDocumentContainer1.RemoveDocument(pane); } }
private void TreeContextMenuEventHandler(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; ContentDocument document = (ContentDocument)item.Owner.Tag; if (item.Name == MENU_ITEM_CLOSE) { RemoveDocument(document, true); } else if (item.Name == MENU_ITEM_CLOSE_ALL) { if (Factory.AGSEditor.Preferences.DialogOnMultibleTabsClose && MessageBox.Show("Are you sure you want to close all tabs?", "Confirm close", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } RemoveAllDocuments(null); // null -> Remove all documents, no exceptions } else if (item.Name == MENU_ITEM_CLOSE_ALL_BUT_THIS) { if (Factory.AGSEditor.Preferences.DialogOnMultibleTabsClose && MessageBox.Show("Are you sure you want to close all other tabs?", "Confirm close", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } RemoveAllDocuments(document); } else if (item.Name == MENU_ITEM_NAVIGATE) { Factory.GUIController.ProjectTree.SelectNode(null, document.TreeNodeID); } }
private ScriptEditor CreateOrShowEditorForScript(string scriptName, bool activateEditor) { Script chosenItem; if (!scriptName.Contains(".")) { scriptName += ".asc"; } var scriptEditor = GetScriptEditor(scriptName, out chosenItem); if (chosenItem == null) { return(null); } _lastActivated = scriptEditor; ContentDocument document = _editors[chosenItem]; document.TreeNodeID = GetNodeID(chosenItem); _guiController.AddOrShowPane(document); if (activateEditor) { // Hideous hack -- we need to allow the current message to // finish processing before setting the focus to the // script window, or it will fail _timerActivateWindow = true; _timer.Start(); } return(_lastActivated); }
public DefaultSetupComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor) { _settingsPane = new DefaultRuntimeSetupPane(); _document = new ContentDocument(_settingsPane, "Default Setup", this, ICON_KEY); _guiController.RegisterIcon(ICON_KEY, Resources.ResourceManager.GetIcon("iconsett.ico")); _guiController.ProjectTree.AddTreeRoot(this, ComponentID, "Default Setup", ICON_KEY); }
public void AddOrShowPane(ContentDocument pane) { if (!tabbedDocumentContainer1.ContainsDocument(pane)) { tabbedDocumentContainer1.AddDocument(pane); } tabbedDocumentContainer1.SetActiveDocument(pane); }
public SettingsComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor) { _settingsPane = new GeneralSettings(); _document = new ContentDocument(_settingsPane, "General Settings", this, ICON_KEY); _guiController.RegisterIcon(ICON_KEY, Resources.ResourceManager.GetIcon("iconsett.ico")); _guiController.ProjectTree.AddTreeRoot(this, "GeneralSettings", "General Settings", ICON_KEY); }
private void OpenItem(int index) { NotesPane note; ContentDocument page; IScriptEditorControl script; bool loaded; String filename; filename = title[index]; if (document[index] == null) { note = new NotesPane(editor, this); page = new ContentDocument(note, filename, this, ID_ICON_LEAF); // Uncomment this for additional menu next to File // TODO: Event bindings //page.MainMenu = GetExtraMenu(); //MethodInfo x = ((GUIController)editor.GUIController).GetType().GetMethod("RegisterMenuCommand", BindingFlags.NonPublic); //MessageBox.Show("x: {" + x + "}"); //((GUIController)editor.GUIController).GetType().GetMethod("RegisterMenuCommand", BindingFlags.NonPublic).Invoke((GUIController)editor.GUIController, new object[] { extraMenu.Commands[0].ID, this }); editor.GUIController.AddOrShowPane(page); pane[index] = note; document[index] = page; loaded = false; } else { page = document[index]; if (page.Visible) { loaded = true; } else { loaded = false; } editor.GUIController.AddOrShowPane(page); note = pane[index]; } if (!loaded) { script = note.GetEditor(); note.DockingContainer.Text = filename; if (File.Exists(filename)) { try { saved[index] = File.ReadAllText(filename); script.Text = saved[index]; script.Control.Focus(); } catch (Exception) { editor.GUIController.RemovePaneIfExists(page); editor.GUIController.ShowMessage("An error occurred while reading \"" + filename + "\".", MessageBoxIconType.Error); } } } }
public JObject SaveStateToSoupForDocTransaction(SyncState state, ContentDocument cd) { if (cd == null) { throw new SyncException("ContentDocument is required to save transaction."); } return(SaveStateToSoup(state, cd.Id, cd.LatestPublishedVersionId)); }
private void RecreateDocument() { if (_document != null) { _document.Dispose(); } _editor = new TextParserEditor(_agsEditor.CurrentGame.TextParser); _document = new ContentDocument(_editor, "Text Parser", this); }
public AndroidBuilderPlugin(IAGSEditor editor) { _editor = editor; _editor.AddComponent(AndroidBuilderComponent.Instance); _editor.GUIController.RegisterIcon(ICON_KEY, Properties.Resources.PluginIcon); _pane = new ContentDocument(AndroidBuilderPane.Instance, "Android", AndroidBuilderComponent.Instance, ICON_KEY); BuildTargetsInfo.RegisterBuildTarget(BuildTargetAndroid.Instance); AGS_VERSION_CURRENT = new AGSVersion(_editor.Version); }
private void RecreateDocument() { if (_document != null) { _document.Dispose(); } _editor = new GlobalVariablesEditor(_agsEditor.CurrentGame); _document = new ContentDocument(_editor, "Global Variables", this); }
public SpriteManagerComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor) { _sprEditor = new SpriteManager(); _editorPane = new ContentDocument(_sprEditor, "Sprites", this); _guiController.RegisterIcon("SpriteManagerIcon", Resources.ResourceManager.GetIcon("iconspr.ico")); _guiController.ProjectTree.AddTreeRoot(this, TOP_LEVEL_COMMAND_ID, "Sprites", "SpriteManagerIcon"); Factory.Events.ShowSpriteManager += new EditorEvents.ShowSpriteManagerHandler(Events_ShowSpriteManager); RefreshDataFromGame(); }
public VersionDataFileWriter(ContentDocument docMeta, long syncId) { if (docMeta == null) { throw new NullReferenceException("Parameter docMeta is null"); } _syncId = syncId; _meta = docMeta; }
private void RecreateDocument() { if (_document != null) { _document.Dispose(); } _editor = new LipSyncEditor(_agsEditor.CurrentGame.LipSync); _document = new ContentDocument(_editor, "Lip sync", this); _document.SelectedPropertyGridObject = _editor.EditingLipSync; }
private void ShowTabContextMenu(ContentDocument document, Point position) { EventHandler onClick = new EventHandler(TreeContextMenuEventHandler); ContextMenuStrip menu = new ContextMenuStrip(); menu.Tag = document; menu.Items.Add(new ToolStripMenuItem("Close", null, onClick, MENU_ITEM_CLOSE)); menu.Items.Add(new ToolStripMenuItem("Close all others", null, onClick, MENU_ITEM_CLOSE_ALL_BUT_THIS)); menu.Show(tabsPanel, position); }
public WelcomeComponent(GUIController guiController, AGSEditor agsEditor) : base(guiController, agsEditor) { _welcomePane = new WelcomePane(guiController); _document = new ContentDocument(_welcomePane, "Start Page", this, ICON_KEY); _guiController.RegisterIcon(ICON_KEY, Resources.ResourceManager.GetIcon("menu_help_showstart.ico")); _menuCommands.Commands.Add(new MenuCommand(SHOW_START_PAGE_COMMAND, "Show Start Page", ICON_KEY)); _guiController.AddMenuItems(this, _menuCommands); }
private static async Task <ContentDocument> GetScrubbedContent( Uri requestUrl, PolicyModel policy) { var proxyRequest = new HttpRequest(); var proxyResponse = await HttpHelper.GetAsync(requestUrl, proxyRequest); var document = ContentDocument.LoadHtml(proxyResponse.Payload, policy); return(document); }
public void AddDocument(ContentDocument pane) { pane.Visible = true; pane.Control.Tag = pane; if (pane.Control.DockingContainer == null || pane.Control.DockingContainer.IsDisposed) { pane.Control.DockingContainer = new DockingContainer(pane.Control); } pane.Control.DockingContainer.DockStateChanged += Document_DockStateChanged; _panes.Insert(0, pane); _panesInOrderUsed.Insert(0, pane); }
private DockData GetDockData(ContentDocument pane) { if (pane.PreferredDockData != null) { return(pane.PreferredDockData); } DockingState dockState = pane.Control.DockingContainer.DockState == DockingState.Unknown || pane.Control.DockingContainer.DockState == DockingState.Hidden ? DockingState.Document : pane.Control.DockingContainer.DockState; return(new DockData(dockState, Rectangle.Empty)); }
private void AddDocuments(List <ContentDocument> documents, ContentDocument activeDocument) { foreach (ContentDocument document in documents) { ToolStripMenuItem menuItem = new ToolStripMenuItem(document.Control.DockingContainer.Text); menuItem.CheckOnClick = false; menuItem.Checked = (document == activeDocument); menuItem.Tag = document; menuItem.Click += MenuItem_Click; _windowsMenu.DropDownItems.Add(menuItem); } }
protected void UpdateScriptWindowTitle(ScriptEditor editor) { string newTitle = editor.Script.FileName + (editor.IsModified ? " *" : ""); ContentDocument document = GetDocument(editor); if (document != null && document.Name != newTitle) { document.Name = newTitle; document.Control.DockingContainer.Text = newTitle; _guiController.DocumentTitlesChanged(); } }
private IScriptEditor GetScriptEditor(string fileName, bool showEditor) { Script script; ScriptEditor editor = GetScriptEditor(fileName, out script); if ((showEditor) && (editor != null)) { ContentDocument document = _editors[script]; document.TreeNodeID = GetNodeID(script); _guiController.AddOrShowPane(document); } return(editor); }
private void SetIcon(ContentDocument pane) { if (string.IsNullOrEmpty(pane.IconKey)) { pane.Control.DockingContainer.Icon = Factory.GUIController.MainIcon; } else { Image iconImage = Factory.GUIController.ImageList.Images[pane.IconKey]; pane.Control.DockingContainer.Icon = Utilities.ImageToIcon(iconImage); } }