//mxd. Replace All
        private void replaceallbutton_Click(object sender, EventArgs e)
        {
            var editor = General.Map.ScriptEditor.Editor;

            FindReplaceOptions options = MakeOptions();

            AddComboboxText(replacefindbox, options.FindText);
            AddComboboxText(replacebox, options.ReplaceWith);

            // Find next match
            ScriptDocumentTab curtab = editor.ActiveTab;

            if (curtab == null || !curtab.FindNext(options, true))
            {
                editor.DisplayStatus(ScriptStatusType.Warning, "Can't find any occurrence of \"" + options.FindText + "\".");
                return;
            }

            // Replace loop
            int replacements = 0;

            while (editor.FindNext(options) && editor.Replace(options))
            {
                replacements++;
            }

            // Show result
            if (replacements == 0)
            {
                editor.DisplayStatus(ScriptStatusType.Warning, "Can't find any occurrence of \"" + options.FindText + "\".");
            }
            else
            {
                editor.DisplayStatus(ScriptStatusType.Info, "Replaced " + replacements + " occurrences of \"" + options.FindText + "\" with \"" + options.ReplaceWith + "\".");

                // Find & select the last match on the now-current tab
                curtab = editor.ActiveTab;
                if (curtab != null)
                {
                    options.FindText    = options.ReplaceWith;
                    options.ReplaceWith = null;

                    curtab.SelectionStart = curtab.Text.Length;
                    curtab.SelectionEnd   = curtab.SelectionStart;
                    curtab.FindPrevious(options);
                }
            }
        }
        //mxd. Replace All
        private void replaceallbutton_Click(object sender, EventArgs e)
        {
            var editor = General.Map.ScriptEditor.Editor;

            FindReplaceOptions options = MakeOptions();

            AddComboboxText(replacefindbox, options.FindText);
            AddComboboxText(replacebox, options.ReplaceWith);

            // Find next match
            // [ZZ] why are we doing this? we aren't limited to the current tab.....

            /*
             *          ScriptDocumentTab curtab = editor.ActiveTab;
             *          if(curtab == null || !curtab.FindNext(options, true))
             *          {
             *                  editor.DisplayStatus(ScriptStatusType.Warning, "Can't find any occurrence of \"" + options.FindText + "\".");
             *                  return;
             *          }*/

            // Replace loop
            // We don't really want to do this outside of the script editor.
            int replacements = editor.FindReplace(options);

            // Show result
            if (replacements == 0)
            {
                editor.DisplayStatus(ScriptStatusType.Warning, "Can't find any occurrence of \"" + options.FindText + "\".");
            }
            else
            {
                editor.DisplayStatus(ScriptStatusType.Info, "Replaced " + replacements + " occurrences of \"" + options.FindText + "\" with \"" + options.ReplaceWith + "\".");

                // Find & select the last match on the now-current tab
                ScriptDocumentTab curtab = editor.ActiveTab;
                if (curtab != null)
                {
                    options.FindText    = options.ReplaceWith;
                    options.ReplaceWith = null;

                    curtab.SelectionStart = curtab.Text.Length;
                    curtab.SelectionEnd   = curtab.SelectionStart;
                    curtab.FindPrevious(options);
                }
            }
        }
        //mxd. Bookmark all
        private void bookmarkallbutton_Click(object sender, EventArgs e)
        {
            FindReplaceOptions options = MakeOptions();

            AddComboboxText(findbox, options.FindText);

            // Determine script type
            ScriptType scripttype = ScriptType.UNKNOWN;

            switch (options.SearchMode)
            {
            case FindReplaceSearchMode.CURRENT_FILE:
                ScriptDocumentTab t = General.Map.ScriptEditor.Editor.ActiveTab;
                if (t != null)
                {
                    scripttype = t.Config.ScriptType;
                }
                break;
            }
        }