Exemple #1
0
        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);
            }
        }
Exemple #2
0
 public SettingsComponent(GUIController guiController, AGSEditor agsEditor)
     : base(guiController, agsEditor)
 {
     _settingsPane = new GeneralSettings();
     _document = new ContentDocument(_settingsPane, "General Settings", this);
     _guiController.RegisterIcon("SettingsIcon", Resources.ResourceManager.GetIcon("iconsett.ico"));
     _guiController.ProjectTree.AddTreeRoot(this, "GeneralSettings", "General Settings", "SettingsIcon");
 }
Exemple #3
0
 public void AddOrShowPane(ContentDocument pane)
 {
     if (!tabbedDocumentContainer1.ContainsDocument(pane))
     {
         tabbedDocumentContainer1.AddDocument(pane);
     }
     tabbedDocumentContainer1.SetActiveDocument(pane);
 }
Exemple #4
0
 private void RecreateDocument()
 {
     if (_document != null)
     {
         _document.Dispose();
     }
     _editor = new TextParserEditor(_agsEditor.CurrentGame.TextParser);
     _document = new ContentDocument(_editor, "Text Parser", this, ICON_KEY);
 }
 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();
 }
Exemple #6
0
 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;
 }
Exemple #7
0
        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);
        }
 public void AddDocument(ContentDocument pane)
 {
     if (_panes.Count == 0)
     {
         contentPane1.Visible = true;
         tabsPanel.Visible = true;
         this.BackColor = Color.FromKnownColor(KnownColor.Control);
     }
     pane.Visible = true;
     _panes.Insert(0, pane);
     _panesInOrderUsed.Insert(0, pane);
     tabsPanel.Invalidate();
 }
Exemple #9
0
 public void RefreshPropertyGridForDocument(ContentDocument document)
 {
     if (document == null)
     {
         this.SetPropertyObjectList(null);
         this.SetPropertyObject(null);
     }
     else
     {
         this.SetPropertyObjectList(document.PropertyGridObjectList);
         if (document.SelectedPropertyGridObjects != null)
         {
             this.SetPropertyObjects(document.SelectedPropertyGridObjects);
         }
         else
         {
             this.SetPropertyObject(document.SelectedPropertyGridObject);
         }
     }
 }
Exemple #10
0
        private bool LoadDifferentRoom(UnloadedRoom newRoom)
        {
            if ((_roomSettings != null) && (_roomSettings.Visible))
            {
                // give them a chance to save the current room first
                bool cancelLoad = false;
                ((RoomSettingsEditor)_roomSettings.Control).PanelClosing(true, ref cancelLoad);
                if (cancelLoad)
                {
                    return false;
                }
            }

            // lock to stop the load proceeding until a save has finished,
            // just to make sure we don't end up with a race condition if
            // the user is madly clicking around
            lock (_roomLoadingOrSavingLock)
            {
                UnloadCurrentRoomAndGreyOutTree();

                if (!File.Exists(newRoom.FileName))
                {
                    _guiController.ShowMessage("The file '" + newRoom.FileName + "' was not found. Unable to open this room.", MessageBoxIcon.Warning);
                }
                else
                {
                    CompileMessages errors = new CompileMessages();

                    LoadNewRoomIntoMemory(newRoom, errors);

                    _loadedRoom.RoomModifiedChanged += _modifiedChangedHandler;

                    string paneTitle = "Room " + _loadedRoom.Number + (_loadedRoom.Modified ? " *" : "");

                    _roomSettings = new ContentDocument(new RoomSettingsEditor(_loadedRoom), paneTitle, this, ConstructPropertyObjectList(_loadedRoom));
                    _roomSettings.SelectedPropertyGridObject = _loadedRoom;
                    ((RoomSettingsEditor)_roomSettings.Control).SaveRoom += new RoomSettingsEditor.SaveRoomHandler(RoomEditor_SaveRoom);
                    ((RoomSettingsEditor)_roomSettings.Control).AbandonChanges += new RoomSettingsEditor.AbandonChangesHandler(RoomsComponent_AbandonChanges);

                    if (_loadedRoom.Modified)
                    {
                        CreateOrShowScript(_loadedRoom);
                    }

                    if (_roomScriptEditors.ContainsKey(_loadedRoom.Number))
                    {
                        ((ScriptEditor)_roomScriptEditors[_loadedRoom.Number].Control).Room = _loadedRoom;
                        if (_loadedRoom.Modified)
                        {
                            ((ScriptEditor)_roomScriptEditors[_loadedRoom.Number].Control).ScriptModifiedExternally();
                        }
                    }

                    ProjectTree treeController = _guiController.ProjectTree;
                    treeController.ChangeNodeIcon(this, TREE_PREFIX_ROOM_NODE + _loadedRoom.Number, ROOM_ICON_LOADED);
                    treeController.ChangeNodeIcon(this, TREE_PREFIX_ROOM_SETTINGS + _loadedRoom.Number, ROOM_ICON_LOADED);

                    _guiController.ShowOutputPanel(errors);
                }

                return true;
            }
        }
Exemple #11
0
 private void RecreateDocument()
 {
     _document = new ContentDocument(_palEditor, "Colours", this, ICON_KEY,
         ConstructPropertyObjectList());
 }
Exemple #12
0
 public void Refresh(List<ContentDocument> documents, ContentDocument activeDocument)
 {
     RemoveAllButStartupWindows();
     AddDocuments(documents, activeDocument);
 }
Exemple #13
0
 private void tabbedDocumentContainer1_ActiveDocumentChanging(ContentDocument newActiveDocument)
 {
     if (tabbedDocumentContainer1.ActiveDocument != null)
     {
         // Remember which pane and item were selected on the property grid,
         // so that we can restore them later
         tabbedDocumentContainer1.ActiveDocument.SelectedPropertyGridTab = propertiesPanel.SelectedTab.TabName;
         if (propertiesPanel.SelectedGridItem != null)
         {
             tabbedDocumentContainer1.ActiveDocument.SelectedPropertyGridItem = propertiesPanel.SelectedGridItem.Label;
         }
     }
 }
Exemple #14
0
        private void tabbedDocumentContainer1_ActiveDocumentChanged(ContentDocument newActiveDocument)
        {
            RefreshPropertyGridForDocument(newActiveDocument);

            if (newActiveDocument != null)
            {
                RestoreSelectedPropertyGridItem(newActiveDocument);
            }

            if (OnActiveDocumentChanged != null)
            {
                OnActiveDocumentChanged();
            }
        }
        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;
        }
Exemple #16
0
 public void AddOrShowPane(ContentDocument pane)
 {
     _mainForm.AddOrShowPane(pane);
 }
        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 UpdateSize(ContentDocument pane)
 {
     pane.Control.Size = contentPane1.ClientSize;
 }
 public void RemoveDocument(ContentDocument pane)
 {
     RemoveDocument(pane, false);
 }
 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);
 }
        private void SetActiveDocument(ContentDocument pane, bool updatePaneOrder)
        {
            if (!_panes.Contains(pane))
            {
                AddDocument(pane);
            }
            if (_currentPane != pane)
            {
                if (ActiveDocumentChanging != null)
                {
                    ActiveDocumentChanging(pane);
                }
                if (updatePaneOrder)
                {
                    _panesInOrderUsed.Remove(pane);
                    _panesInOrderUsed.Insert(0, pane);
                }
                if ((pane != _panes[0]) && (pane.TabWidth == 0))
                {
                    // if this pane's tab is not visible, move it to the start
                    _panes.Remove(pane);
                    _panes.Insert(0, pane);
                }
                if (_currentPane != null && _currentPane.Control != null)
                {
                    _currentPane.Control.WindowDeactivated();
                }
                _currentPane = pane;
                UpdateSize(pane);
                contentPane1.Controls.Clear();
                contentPane1.Controls.Add(pane.Control);
                tabsPanel.Invalidate();
                pane.Control.Focus();
                pane.Control.WindowActivated();
            }

            // Do this even if the pane hasn't changed, to ensure
            // that the property grid is refreshed
            if (ActiveDocumentChanged != null)
            {
                ActiveDocumentChanged(pane);
            }
        }
        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();
        }
Exemple #23
0
        private void UnloadCurrentRoom()
        {
            if (_roomSettings != null)
            {
                ((RoomSettingsEditor)_roomSettings.Control).SaveRoom -= new RoomSettingsEditor.SaveRoomHandler(RoomEditor_SaveRoom);
                ((RoomSettingsEditor)_roomSettings.Control).AbandonChanges -= new RoomSettingsEditor.AbandonChangesHandler(RoomsComponent_AbandonChanges);
            }
            DisposePane(_roomSettings);
            _roomSettings = null;

            if (_loadedRoom != null)
            {
                _loadedRoom.RoomModifiedChanged -= _modifiedChangedHandler;
            }
            _loadedRoom = null;
        }
Exemple #24
0
 public void RemovePaneIfExists(ContentDocument pane)
 {
     if (tabbedDocumentContainer1.ContainsDocument(pane))
     {
         tabbedDocumentContainer1.RemoveDocument(pane);
     }
 }
Exemple #25
0
 private void DisposePane(ContentDocument doc)
 {
     if (doc != null)
     {
         if (doc.Control.InvokeRequired)
         {
             doc.Control.Invoke(new DisposePaneDelegate(DisposePane), doc);
         }
         else
         {
             _guiController.RemovePaneIfExists(doc);
             doc.Dispose();
         }
     }
 }
Exemple #26
0
 private void RestoreSelectedPropertyGridItem(ContentDocument newActiveDocument)
 {
     if (!string.IsNullOrEmpty(newActiveDocument.SelectedPropertyGridTab))
     {
         SelectTabInPropertyGrid(newActiveDocument.SelectedPropertyGridTab);
     }
     if (!string.IsNullOrEmpty(newActiveDocument.SelectedPropertyGridItem))
     {
         GridItem itemToSelect = FindPropertyGridItemForType(newActiveDocument.SelectedPropertyGridItem);
         if (itemToSelect != null)
         {
             if ((itemToSelect.Parent != null) && (!itemToSelect.Parent.Expanded))
             {
                 propertiesPanel.ExpandAllGridItems();
             }
             propertiesPanel.SelectedGridItem = itemToSelect;
         }
     }
 }
Exemple #27
0
 public void RemovePaneIfExists(ContentDocument pane)
 {
     _mainForm.RemovePaneIfExists(pane);
 }
 public void SetActiveDocument(ContentDocument pane)
 {
     SetActiveDocument(pane, true);
 }
Exemple #29
0
		private void ShowOrAddPane(AGS.Types.Font chosenFont)
		{
            ContentDocument document;
			if (!_documents.TryGetValue(chosenFont, out document)
                || document.Control.IsDisposed)
			{
				Dictionary<string, object> list = new Dictionary<string, object>();
				list.Add(chosenFont.Name + " (Font " + chosenFont.ID + ")", chosenFont);

                document = new ContentDocument(new FontEditor(chosenFont),
                    chosenFont.WindowTitle, this, ICON_KEY, list);
                _documents[chosenFont] = document;
                document.SelectedPropertyGridObject = chosenFont;
			}
            document.TreeNodeID = GetNodeID(chosenFont);
            _guiController.AddOrShowPane(document);
			_guiController.ShowCuppit("The Font Editor allows you to import fonts into your game. Windows TTF fonts are supported, as are SCI fonts which can be created with Radiant FontEdit.", "Fonts introduction");
		}
 public bool ContainsDocument(ContentDocument pane)
 {
     return _panes.Contains(pane);
 }