예제 #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);
            }
        }
예제 #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");
 }
예제 #3
0
파일: frmMain.cs 프로젝트: sonneveld/agscj
 public void AddOrShowPane(ContentDocument pane)
 {
     if (!tabbedDocumentContainer1.ContainsDocument(pane))
     {
         tabbedDocumentContainer1.AddDocument(pane);
     }
     tabbedDocumentContainer1.SetActiveDocument(pane);
 }
예제 #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);
 }
예제 #5
0
 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();
 }
예제 #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;
 }
예제 #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);
        }
예제 #8
0
 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();
 }
예제 #9
0
파일: frmMain.cs 프로젝트: Aquilon96/ags
 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);
         }
     }
 }
예제 #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;
            }
        }
예제 #11
0
 private void RecreateDocument()
 {
     _document = new ContentDocument(_palEditor, "Colours", this, ICON_KEY,
         ConstructPropertyObjectList());
 }
예제 #12
0
 public void Refresh(List<ContentDocument> documents, ContentDocument activeDocument)
 {
     RemoveAllButStartupWindows();
     AddDocuments(documents, activeDocument);
 }
예제 #13
0
파일: frmMain.cs 프로젝트: sonneveld/agscj
 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;
         }
     }
 }
예제 #14
0
파일: frmMain.cs 프로젝트: sonneveld/agscj
        private void tabbedDocumentContainer1_ActiveDocumentChanged(ContentDocument newActiveDocument)
        {
            RefreshPropertyGridForDocument(newActiveDocument);

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

            if (OnActiveDocumentChanged != null)
            {
                OnActiveDocumentChanged();
            }
        }
예제 #15
0
        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;
        }
예제 #16
0
 public void AddOrShowPane(ContentDocument pane)
 {
     _mainForm.AddOrShowPane(pane);
 }
예제 #17
0
        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();
        }
예제 #18
0
 private void UpdateSize(ContentDocument pane)
 {
     pane.Control.Size = contentPane1.ClientSize;
 }
예제 #19
0
 public void RemoveDocument(ContentDocument pane)
 {
     RemoveDocument(pane, false);
 }
예제 #20
0
 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);
 }
예제 #21
0
        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);
            }
        }
예제 #22
0
        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();
        }
예제 #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;
        }
예제 #24
0
파일: frmMain.cs 프로젝트: sonneveld/agscj
 public void RemovePaneIfExists(ContentDocument pane)
 {
     if (tabbedDocumentContainer1.ContainsDocument(pane))
     {
         tabbedDocumentContainer1.RemoveDocument(pane);
     }
 }
예제 #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();
         }
     }
 }
예제 #26
0
파일: frmMain.cs 프로젝트: sonneveld/agscj
 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;
         }
     }
 }
예제 #27
0
 public void RemovePaneIfExists(ContentDocument pane)
 {
     _mainForm.RemovePaneIfExists(pane);
 }
예제 #28
0
 public void SetActiveDocument(ContentDocument pane)
 {
     SetActiveDocument(pane, true);
 }
예제 #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");
		}
예제 #30
0
 public bool ContainsDocument(ContentDocument pane)
 {
     return _panes.Contains(pane);
 }