public new event EventHandler OnTextChanged;         //mxd

        #endregion

        #region ================== Constructor

        // Constructor
        protected ScriptDocumentTab(ScriptEditorPanel panel, ScriptConfiguration config)
        {
            // Keep panel and config
            this.panel  = panel;
            this.config = config;             //mxd

            // Make the script control
            editor          = new ScriptEditorControl();
            editor.Location = new Point(EDITOR_BORDER_LEFT, EDITOR_BORDER_TOP);
            editor.Size     = new Size(this.ClientSize.Width - EDITOR_BORDER_LEFT - EDITOR_BORDER_RIGHT,
                                       this.ClientSize.Height - EDITOR_BORDER_TOP - EDITOR_BORDER_BOTTOM);
            editor.Anchor   = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            editor.Name     = "editor";
            editor.TabStop  = true;
            editor.TabIndex = 1;
            this.Controls.Add(editor);

            // Bind events
            editor.OnExplicitSaveTab    += panel.ExplicitSaveCurrentTab;
            editor.OnOpenScriptBrowser  += panel.OpenBrowseScript;
            editor.OnOpenFindAndReplace += panel.OpenFindAndReplace;
            editor.OnFindNext           += panel.FindNext;
            editor.OnFindPrevious       += panel.FindPrevious;      //mxd
            editor.OnTextChanged        += editor_TextChanged;      //mxd

            //mxd. Bind functionbar events
            editor.OnFunctionBarDropDown += functionbar_DropDown;

            //mxd. Setup styles
            editor.SetupStyles(config);
        }
        // This changes the script configurations
        public virtual void ChangeScriptConfig(ScriptConfiguration newconfig)
        {
            config = newconfig;                              //mxd
            editor.SetupStyles(newconfig);                   //mxd
            List <CompilerError> errors = UpdateNavigator(); //mxd

            if (panel.ActiveTab == this)
            {
                panel.ShowErrors(errors, true);                                     //mxd
            }
        }
        // This changes the script configurations
        public virtual void ChangeScriptConfig(ScriptConfiguration newconfig)
        {
            config = newconfig;                              //mxd
            editor.SetupStyles(newconfig);                   //mxd
            List <CompilerError> errors = UpdateNavigator(); //mxd

            if (panel.ActiveTab == this)
            {
                panel.ShowErrors(errors, true);                                     //mxd
            }
            this.ImageIndex = panel.Icons.GetScriptIcon(config.ScriptType);         //mxd. Set icon
        }
示例#4
0
        public new event EventHandler OnTextChanged;         //mxd

        #endregion

        #region ================== Constructor

        // Constructor
        protected ScriptDocumentTab(ScriptEditorPanel panel, ScriptConfiguration config)
        {
            // Keep panel and config
            this.panel     = panel;
            this.config    = config;                         //mxd
            this.BackColor = SystemColors.ControlLightLight; //mxd

            // Make the script control
            editor          = new ScriptEditorControl();
            editor.Location = new Point(EDITOR_BORDER_LEFT, EDITOR_BORDER_TOP);
            editor.Size     = new Size(this.ClientSize.Width - EDITOR_BORDER_LEFT - EDITOR_BORDER_RIGHT,
                                       this.ClientSize.Height - EDITOR_BORDER_TOP - EDITOR_BORDER_BOTTOM);
            editor.Anchor   = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            editor.Name     = "editor";
            editor.TabStop  = true;
            editor.TabIndex = 1;
            this.Controls.Add(editor);

            // Bind events
            editor.OnExplicitSaveTab        += panel.ExplicitSaveCurrentTab;
            editor.OnOpenScriptBrowser      += panel.OpenBrowseScript;
            editor.OnOpenFindAndReplace     += panel.OpenFindAndReplace;
            editor.OnFindNext               += panel.FindNext;
            editor.OnFindPrevious           += panel.FindPrevious;   //mxd
            editor.OnFindNextWrapAround     += panel.FindNextWrapAround;
            editor.OnFindPreviousWrapAround += panel.FindPreviousWrapAround;
            editor.OnTextChanged            += editor_TextChanged; //mxd
            editor.OnGoToLine               += panel.GoToLine;     //mxd
            editor.OnCompileScript          -= Compile;            //mxd

            //mxd. Bind functionbar events
            editor.OnFunctionBarDropDown += functionbar_DropDown;

            //mxd. Setup styles
            editor.SetupStyles(config);

            //mxd. Apply panel settings
            editor.ShowWhitespace = panel.ShowWhitespace;
            editor.WrapLongLines  = panel.WrapLongLines;

            //mxd. Set icon
            this.ImageIndex = panel.Icons.GetScriptIcon(config.ScriptType);
        }