Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DebugLogWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public DebugLogWindow(Editor editor)
            : base(editor, true, ScrollBars.None)
        {
            Title = "Debug Log";
            OnEditorOptionsChanged(Editor.Options.Options);

            // Toolstrip
            var toolstrip = new ToolStrip(22.0f)
            {
                Parent = this,
            };

            toolstrip.AddButton("Clear", Clear).LinkTooltip("Clears all log entries");
            _clearOnPlayButton  = (ToolStripButton)toolstrip.AddButton("Clear on Play").SetAutoCheck(true).SetChecked(true).LinkTooltip("Clears all log entries on enter playmode");
            _pauseOnErrorButton = (ToolStripButton)toolstrip.AddButton("Pause on Error").SetAutoCheck(true).LinkTooltip("Performs auto pause on error");
            toolstrip.AddSeparator();
            _groupButtons[0] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Error32, () => UpdateLogTypeVisibility(LogGroup.Error, _groupButtons[0].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides error messages");
            _groupButtons[1] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Warning32, () => UpdateLogTypeVisibility(LogGroup.Warning, _groupButtons[1].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides warning messages");
            _groupButtons[2] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Info32, () => UpdateLogTypeVisibility(LogGroup.Info, _groupButtons[2].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides info messages");
            UpdateCount();

            // Split panel
            _split = new SplitPanel(Orientation.Vertical, ScrollBars.Vertical, ScrollBars.Both)
            {
                AnchorPreset  = AnchorPresets.StretchAll,
                Offsets       = new Margin(0, 0, toolstrip.Bottom, 0),
                SplitterValue = 0.8f,
                Parent        = this
            };

            // Info detail info
            _logInfo = new Label
            {
                Parent       = _split.Panel2,
                AutoWidth    = true,
                AutoHeight   = true,
                Margin       = new Margin(4),
                Offsets      = Margin.Zero,
                AnchorPreset = AnchorPresets.StretchAll,
            };

            // Entries panel
            _entriesPanel = new VerticalPanel
            {
                AnchorPreset = AnchorPresets.HorizontalStretchTop,
                Offsets      = Margin.Zero,
                IsScrollable = true,
                Parent       = _split.Panel1,
            };

            // Cache entries icons
            IconInfo    = Editor.Icons.Info32;
            IconWarning = Editor.Icons.Warning32;
            IconError   = Editor.Icons.Error32;

            // Bind events
            Editor.Options.OptionsChanged            += OnEditorOptionsChanged;
            Debug.Logger.LogHandler.SendLog          += LogHandlerOnSendLog;
            Debug.Logger.LogHandler.SendExceptionLog += LogHandlerOnSendExceptionLog;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContentWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public ContentWindow(Editor editor)
            : base(editor, true, ScrollBars.None)
        {
            Title = "Content";

            // Content database events
            editor.ContentDatabase.OnWorkspaceModified += () => _isWorkspaceDirty = true;
            editor.ContentDatabase.ItemRemoved         += ContentDatabaseOnItemRemoved;

            // Tool strip
            _toolStrip    = new ToolStrip();
            _importButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.Import32, () => Editor.ContentImporting.ShowImportFileDialog(CurrentViewFolder)).LinkTooltip("Import content");
            _toolStrip.AddSeparator();
            _navigateBackwardButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowLeft32, NavigateBackward).LinkTooltip("Navigate backward");
            _navigateForwardButton  = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowRight32, NavigateForward).LinkTooltip("Navigate forward");
            _nnavigateUpButton      = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowUp32, NavigateUp).LinkTooltip("Navigate up");
            _toolStrip.Parent       = this;

            // Navigation bar
            _navigationBar = new NavigationBar
            {
                Height = 32,
                Parent = this
            };

            // Split panel
            _split = new SplitPanel(Orientation.Horizontal, ScrollBars.Both, ScrollBars.Vertical)
            {
                DockStyle     = DockStyle.Fill,
                SplitterValue = 0.2f,
                Parent        = this
            };

            // Content structure tree
            _tree = new Tree(false);
            _tree.SelectedChanged += treeOnSelectedChanged;
            _tree.Parent           = _split.Panel1;

            // Content View
            _view                 = new ContentView();
            _view.OnOpen         += Open;
            _view.OnNavigateBack += NavigateBackward;
            _view.OnRename       += Rename;
            _view.OnDelete       += Delete;
            _view.OnDuplicate    += Clone;
            _view.OnPaste        += Paste;
            _view.Parent          = _split.Panel2;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DebugLogWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public DebugLogWindow(Editor editor)
            : base(editor, true, ScrollBars.None)
        {
            Title = "Debug";
            OnEditorOptionsChanged(Editor.Options.Options);

            // Toolstrip
            var toolstrip = new ToolStrip(22);

            toolstrip.AddButton("Clear", Clear).LinkTooltip("Clears all log entries");
            _clearOnPlayButton  = (ToolStripButton)toolstrip.AddButton("Clear on Play").SetAutoCheck(true).SetChecked(true).LinkTooltip("Clears all log entries on enter playmode");
            _pauseOnErrorButton = (ToolStripButton)toolstrip.AddButton("Pause on Error").SetAutoCheck(true).LinkTooltip("Performs auto pause on error");
            toolstrip.AddSeparator();
            _groupButtons[0] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Error32, () => UpdateLogTypeVisibility(LogGroup.Error, _groupButtons[0].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides error messages");
            _groupButtons[1] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Warning32, () => UpdateLogTypeVisibility(LogGroup.Warning, _groupButtons[1].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides warning messages");
            _groupButtons[2] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Info32, () => UpdateLogTypeVisibility(LogGroup.Info, _groupButtons[2].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides info messages");
            toolstrip.Parent = this;
            UpdateCount();

            // Split panel
            _split = new SplitPanel(Orientation.Vertical, ScrollBars.Vertical, ScrollBars.Both)
            {
                DockStyle     = DockStyle.Fill,
                SplitterValue = 0.8f,
                Parent        = this
            };

            // Log detail info
            _logInfo = new Label(0, 0, 120, 1)
            {
                Parent     = _split.Panel2,
                AutoWidth  = true,
                AutoHeight = true,
                Margin     = new Margin(4),
            };

            // Entries panel
            _entriesPanel = _split.Panel1;

            // Bind events
            Editor.Options.OptionsChanged            += OnEditorOptionsChanged;
            Debug.Logger.LogHandler.SendLog          += LogHandlerOnSendLog;
            Debug.Logger.LogHandler.SendExceptionLog += LogHandlerOnSendExceptionLog;
            ScriptsBuilder.CompilationBegin          += OnCompilationBegin;
            ScriptsBuilder.CompilationError          += OnCompilationError;
            ScriptsBuilder.CompilationWarning        += OnCompilationWarning;
            GameCooker.Event += OnGameCookerEvent;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DebugLogWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public DebugLogWindow(Editor editor)
            : base(editor, true, ScrollBars.None)
        {
            Title = "Debug";

            // Toolstrip
            _toolstrip = new ToolStrip(22);
            _toolstrip.ButtonClicked += OnTooltipButtonClicked;
            _toolstrip.AddButton(0, "Clear").LinkTooltip("Clears all log entries");
            _toolstrip.AddButton(1, "Clear on Play").SetAutoCheck(true).SetChecked(true).LinkTooltip("Clears all log entries on enter playmode");
            _toolstrip.AddButton(2, "Pause on Error").SetAutoCheck(true).LinkTooltip("Performs auto pause on error");
            _toolstrip.AddSeparator();
            _toolstrip.AddButton(10, Editor.UI.GetIcon("Error32")).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides error messages");
            _toolstrip.AddButton(11, Editor.UI.GetIcon("Warning32")).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides warning messages");
            _toolstrip.AddButton(12, Editor.UI.GetIcon("Info32")).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides info messages");
            _toolstrip.Parent = this;
            updateCount();

            // Split panel
            var splitPanel = new SplitPanel(Orientation.Vertical, ScrollBars.Vertical, ScrollBars.Vertical)
            {
                DockStyle     = DockStyle.Fill,
                SplitterValue = 0.8f,
                Parent        = this
            };

            // Log detail info
            _logInfo = new Label(0, 0, 120, 1)
            {
                Parent              = splitPanel.Panel2,
                AutoHeight          = true,
                Margin              = new Margin(4),
                HorizontalAlignment = TextAlignment.Near
            };

            // Entries panel
            _entriesPanel = splitPanel.Panel1;

            // Bind events
            Debug.Logger.LogHandler.SendLog          += LogHandlerOnSendLog;
            Debug.Logger.LogHandler.SendExceptionLog += LogHandlerOnSendExceptionLog;
            ScriptsBuilder.CompilationBegin          += OnCompilationBegin;
            ScriptsBuilder.CompilationError          += OnCompilationError;
            ScriptsBuilder.CompilationWarning        += OnCompilationWarning;
            GameCooker.Event += OnGameCookerEvent;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContentWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public ContentWindow(Editor editor)
            : base(editor, true, ScrollBars.None)
        {
            Title = "Content";

            // Content database events
            editor.ContentDatabase.OnWorkspaceModified += () => _isWorkspaceDirty = true;
            editor.ContentDatabase.ItemRemoved         += ContentDatabaseOnItemRemoved;

            // Tool strip
            _toolStrip    = new ToolStrip();
            _importButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.Import32, () => Editor.ContentImporting.ShowImportFileDialog(CurrentViewFolder)).LinkTooltip("Import content");
            _toolStrip.AddSeparator();
            _navigateBackwardButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowLeft32, NavigateBackward).LinkTooltip("Navigate backward");
            _navigateForwardButton  = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowRight32, NavigateForward).LinkTooltip("Navigate forward");
            _nnavigateUpButton      = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.ArrowUp32, NavigateUp).LinkTooltip("Navigate up");
            _toolStrip.Parent       = this;

            // Navigation bar
            _navigationBar = new NavigationBar
            {
                Parent = this
            };

            // Split panel
            _split = new SplitPanel(Orientation.Horizontal, ScrollBars.Both, ScrollBars.Vertical)
            {
                DockStyle     = DockStyle.Fill,
                SplitterValue = 0.2f,
                Parent        = this
            };

            // Content structure tree searching query input box
            var headerPanel = new ContainerControl();

            headerPanel.DockStyle    = DockStyle.Top;
            headerPanel.IsScrollable = true;
            headerPanel.Parent       = _split.Panel1;
            //
            _foldersSearchBox               = new TextBox(false, 4, 4, headerPanel.Width - 8);
            _foldersSearchBox.AnchorStyle   = AnchorStyle.Upper;
            _foldersSearchBox.WatermarkText = "Search...";
            _foldersSearchBox.Parent        = headerPanel;
            _foldersSearchBox.TextChanged  += OnFoldersSearchBoxTextChanged;
            //
            headerPanel.Height = _foldersSearchBox.Bottom + 6;

            // Content structure tree
            _tree   = new Tree(false);
            _tree.Y = headerPanel.Bottom;
            _tree.SelectedChanged += OnTreeSelectionChanged;
            _tree.Parent           = _split.Panel1;

            // Content items searching query input box and filters selector
            var contentItemsSearchPanel = new ContainerControl();

            contentItemsSearchPanel.DockStyle    = DockStyle.Top;
            contentItemsSearchPanel.IsScrollable = true;
            contentItemsSearchPanel.Parent       = _split.Panel2;
            //
            const float filterBoxWidth = 56.0f;

            _itemsSearchBox               = new TextBox(false, filterBoxWidth + 8, 4, contentItemsSearchPanel.Width - 8 - filterBoxWidth);
            _itemsSearchBox.AnchorStyle   = AnchorStyle.Upper;
            _itemsSearchBox.WatermarkText = "Search...";
            _itemsSearchBox.Parent        = contentItemsSearchPanel;
            _itemsSearchBox.TextChanged  += UpdateItemsSearch;
            //
            contentItemsSearchPanel.Height = _itemsSearchBox.Bottom + 4;
            //
            _itemsFilterBox        = new SearchFilterComboBox(4, (contentItemsSearchPanel.Height - ComboBox.DefaultHeight) * 0.5f, filterBoxWidth);
            _itemsFilterBox.Parent = contentItemsSearchPanel;
            _itemsFilterBox.SelectedIndexChanged += e => UpdateItemsSearch();
            _itemsFilterBox.SupportMultiSelect    = true;
            for (int i = 0; i <= (int)ContentItemSearchFilter.Other; i++)
            {
                _itemsFilterBox.Items.Add(((ContentItemSearchFilter)i).ToString());
            }

            // Content View
            _view                 = new ContentView();
            _view.OnOpen         += Open;
            _view.OnNavigateBack += NavigateBackward;
            _view.OnRename       += Rename;
            _view.OnDelete       += Delete;
            _view.OnDuplicate    += Clone;
            _view.OnPaste        += Paste;
            _view.Parent          = _split.Panel2;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContentWindow"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        public ContentWindow(Editor editor)
            : base(editor, true, ScrollBars.None)
        {
            Title = "Content";
            Icon  = editor.Icons.Folder32;

            // Content database events
            editor.ContentDatabase.WorkspaceModified += () => _isWorkspaceDirty = true;
            editor.ContentDatabase.ItemRemoved       += ContentDatabaseOnItemRemoved;

            var options = Editor.Options;

            options.OptionsChanged += OnOptionsChanged;

            // Toolstrip
            _toolStrip = new ToolStrip(34.0f)
            {
                Parent = this,
            };
            _importButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.Import64, () => Editor.ContentImporting.ShowImportFileDialog(CurrentViewFolder)).LinkTooltip("Import content");
            _toolStrip.AddSeparator();
            _navigateBackwardButton = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.Left64, NavigateBackward).LinkTooltip("Navigate backward");
            _navigateForwardButton  = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.Right64, NavigateForward).LinkTooltip("Navigate forward");
            _navigateUpButton       = (ToolStripButton)_toolStrip.AddButton(Editor.Icons.Up64, NavigateUp).LinkTooltip("Navigate up");

            // Navigation bar
            _navigationBar = new NavigationBar
            {
                Parent = this,
            };

            // Split panel
            _split = new SplitPanel(options.Options.Interface.ContentWindowOrientation, ScrollBars.Both, ScrollBars.Vertical)
            {
                AnchorPreset  = AnchorPresets.StretchAll,
                Offsets       = new Margin(0, 0, _toolStrip.Bottom, 0),
                SplitterValue = 0.2f,
                Parent        = this,
            };

            // Content structure tree searching query input box
            var headerPanel = new ContainerControl
            {
                AnchorPreset = AnchorPresets.HorizontalStretchTop,
                IsScrollable = true,
                Offsets      = new Margin(0, 0, 0, 18 + 6),
                Parent       = _split.Panel1,
            };

            _foldersSearchBox = new TextBox
            {
                AnchorPreset  = AnchorPresets.HorizontalStretchMiddle,
                WatermarkText = "Search...",
                Parent        = headerPanel,
                Bounds        = new Rectangle(4, 4, headerPanel.Width - 8, 18),
            };
            _foldersSearchBox.TextChanged += OnFoldersSearchBoxTextChanged;

            // Content structure tree
            _tree = new Tree(false)
            {
                Y      = headerPanel.Bottom,
                Parent = _split.Panel1,
            };
            _tree.SelectedChanged += OnTreeSelectionChanged;

            // Content items searching query input box and filters selector
            var contentItemsSearchPanel = new ContainerControl
            {
                AnchorPreset = AnchorPresets.HorizontalStretchTop,
                IsScrollable = true,
                Offsets      = new Margin(0, 0, 0, 18 + 8),
                Parent       = _split.Panel2,
            };
            const float viewDropdownWidth = 50.0f;

            _itemsSearchBox = new TextBox
            {
                AnchorPreset  = AnchorPresets.HorizontalStretchMiddle,
                WatermarkText = "Search...",
                Parent        = contentItemsSearchPanel,
                Bounds        = new Rectangle(viewDropdownWidth + 8, 4, contentItemsSearchPanel.Width - 12 - viewDropdownWidth, 18),
            };
            _itemsSearchBox.TextChanged += UpdateItemsSearch;
            _viewDropdown = new ViewDropdown
            {
                AnchorPreset       = AnchorPresets.MiddleLeft,
                SupportMultiSelect = true,
                TooltipText        = "Change content view and filter options",
                Parent             = contentItemsSearchPanel,
                Offsets            = new Margin(4, viewDropdownWidth, -9, 18),
            };
            _viewDropdown.SelectedIndexChanged += e => UpdateItemsSearch();
            for (int i = 0; i <= (int)ContentItemSearchFilter.Other; i++)
            {
                _viewDropdown.Items.Add(((ContentItemSearchFilter)i).ToString());
            }
            _viewDropdown.PopupCreate += OnViewDropdownPopupCreate;

            // Content View
            _view = new ContentView
            {
                AnchorPreset = AnchorPresets.HorizontalStretchTop,
                Offsets      = new Margin(0, 0, contentItemsSearchPanel.Bottom + 4, 0),
                IsScrollable = true,
                Parent       = _split.Panel2,
            };
            _view.OnOpen         += Open;
            _view.OnNavigateBack += NavigateBackward;
            _view.OnRename       += Rename;
            _view.OnDelete       += Delete;
            _view.OnDuplicate    += Duplicate;
            _view.OnPaste        += Paste;
        }