2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System;
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
using System.Globalization;
|
2012-07-12 22:34:12 +00:00
|
|
|
using System.IO;
|
2009-04-19 18:07:22 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Drawing;
|
|
|
|
using System.Windows.Forms;
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
using CodeImp.DoomBuilder.Data;
|
2009-04-19 18:07:22 +00:00
|
|
|
using CodeImp.DoomBuilder.Windows;
|
|
|
|
using CodeImp.DoomBuilder.Config;
|
|
|
|
using CodeImp.DoomBuilder.Compilers;
|
2016-04-27 09:13:07 +00:00
|
|
|
using CodeImp.DoomBuilder.ZDoom.Scripting;
|
2017-02-20 05:07:44 +00:00
|
|
|
using System.Text;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2019-08-29 14:30:49 +00:00
|
|
|
#if NO_SCINTILLA
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Controls
|
|
|
|
{
|
|
|
|
internal abstract class ScriptDocumentTab : TabPage
|
|
|
|
{
|
|
|
|
protected readonly ScriptEditorControl editor;
|
|
|
|
protected ScriptConfiguration config;
|
|
|
|
protected readonly ScriptEditorPanel panel;
|
|
|
|
protected ScriptDocumentTabType tabtype;
|
|
|
|
|
|
|
|
public virtual bool ExplicitSave { get { return true; } }
|
|
|
|
public virtual bool IsSaveAsRequired { get { return true; } }
|
|
|
|
public virtual bool IsClosable { get { return true; } }
|
|
|
|
public virtual bool IsReconfigurable { get { return true; } }
|
|
|
|
public virtual bool IsReadOnly { get { return false; } }
|
|
|
|
public virtual string Filename { get { return ""; } }
|
|
|
|
public ScriptEditorPanel Panel { get { return panel; } }
|
|
|
|
public ScriptEditorControl Editor { get; private set; }
|
|
|
|
public string Title { get; private set; }
|
|
|
|
public bool IsChanged { get { return false; } }
|
|
|
|
public int SelectionStart { get; set; }
|
|
|
|
public int SelectionEnd { get; set; }
|
|
|
|
public bool ShowWhitespace { get; set; }
|
|
|
|
public bool WrapLongLines { get; set; }
|
|
|
|
public string SelectedText { get { return ""; } }
|
|
|
|
public ScriptConfiguration Config { get { return config; } }
|
|
|
|
|
|
|
|
public new event EventHandler OnTextChanged;
|
|
|
|
|
|
|
|
protected ScriptDocumentTab(ScriptEditorPanel panel, ScriptConfiguration config)
|
|
|
|
{
|
|
|
|
this.panel = panel;
|
|
|
|
this.config = config;
|
|
|
|
|
|
|
|
editor = new ScriptEditorControl();
|
|
|
|
this.Controls.Add(editor);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool LaunchKeywordHelp() { return false; }
|
|
|
|
public virtual void RefreshSettings() { }
|
|
|
|
public virtual void MoveToLine(int linenumber) { }
|
|
|
|
public virtual void ClearMarks() { }
|
|
|
|
public virtual void MarkScriptErrors(IEnumerable<CompilerError> errors) { }
|
|
|
|
public virtual bool VerifyErrorForScript(CompilerError e) { return false; }
|
|
|
|
public virtual void Compile() { }
|
|
|
|
public virtual bool Save() { return false; }
|
|
|
|
public virtual bool SaveAs(string filename) { return false; }
|
|
|
|
public virtual void ChangeScriptConfig(ScriptConfiguration newconfig) { }
|
|
|
|
public void Undo() { }
|
|
|
|
public void Redo() { }
|
|
|
|
public void Cut() { }
|
|
|
|
public void Copy() { }
|
|
|
|
public void Paste() { }
|
|
|
|
public bool FindNext(FindReplaceOptions options) { return false; }
|
|
|
|
public bool FindNext(FindReplaceOptions options, bool useselectionstart) { return false; }
|
|
|
|
public bool FindPrevious(FindReplaceOptions options) { return false; }
|
|
|
|
public void ReplaceSelection(string replacement) { }
|
|
|
|
|
|
|
|
internal virtual ScriptDocumentSettings GetViewSettings() { return new ScriptDocumentSettings {}; }
|
|
|
|
internal virtual void SetViewSettings(ScriptDocumentSettings settings) { }
|
|
|
|
internal void SetDefaultViewSettings() { }
|
|
|
|
|
|
|
|
internal List<CompilerError> UpdateNavigator() { return new List<CompilerError>(); }
|
|
|
|
internal ScriptType VerifyScriptType() { return ScriptType.UNKNOWN; }
|
|
|
|
internal void InsertSnippet(string name) { }
|
|
|
|
internal void IndentSelection(bool indent) { }
|
|
|
|
|
|
|
|
protected void SetTitle(string title) { }
|
|
|
|
protected void UpdateTitle() { }
|
|
|
|
protected void RemoveTrailingWhitespace() { }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
using ScintillaNET;
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
namespace CodeImp.DoomBuilder.Controls
|
|
|
|
{
|
|
|
|
internal abstract class ScriptDocumentTab : TabPage
|
|
|
|
{
|
|
|
|
#region ================== Constants
|
2012-07-10 10:20:45 +00:00
|
|
|
|
2016-01-27 14:08:15 +00:00
|
|
|
private const int EDITOR_BORDER_TOP = 4;
|
2009-04-19 18:07:22 +00:00
|
|
|
private const int EDITOR_BORDER_BOTTOM = 4;
|
|
|
|
private const int EDITOR_BORDER_LEFT = 4;
|
|
|
|
private const int EDITOR_BORDER_RIGHT = 4;
|
2018-04-14 13:55:21 +00:00
|
|
|
|
|
|
|
const int SC_FOLDLEVELBASE = 1024;
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
2018-04-14 13:55:21 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#region ================== Variables
|
2018-04-14 13:55:21 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// The script edit control
|
2014-05-13 14:41:51 +00:00
|
|
|
protected readonly ScriptEditorControl editor;
|
2015-11-30 14:18:42 +00:00
|
|
|
private string title; //mxd
|
2016-11-24 11:55:11 +00:00
|
|
|
protected ScriptDocumentTabType tabtype; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Derived classes must set this!
|
|
|
|
protected ScriptConfiguration config;
|
|
|
|
|
|
|
|
// The panel we're on
|
2014-05-13 14:41:51 +00:00
|
|
|
protected readonly ScriptEditorPanel panel;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
|
|
public virtual bool ExplicitSave { get { return true; } }
|
|
|
|
public virtual bool IsSaveAsRequired { get { return true; } }
|
|
|
|
public virtual bool IsClosable { get { return true; } }
|
|
|
|
public virtual bool IsReconfigurable { get { return true; } }
|
2016-11-24 11:55:11 +00:00
|
|
|
public virtual bool IsReadOnly { get { return false; } } //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
public virtual string Filename { get { return null; } }
|
|
|
|
public ScriptEditorPanel Panel { get { return panel; } }
|
2016-11-24 11:55:11 +00:00
|
|
|
public ScriptEditorControl Editor { get { return editor; } } //mxd
|
2016-01-27 14:08:15 +00:00
|
|
|
public string Title { get { return title; } } //mxd
|
|
|
|
public bool IsChanged { get { return editor.IsChanged; } }
|
2010-08-02 06:11:35 +00:00
|
|
|
public int SelectionStart { get { return editor.SelectionStart; } set { editor.SelectionStart = value; } }
|
|
|
|
public int SelectionEnd { get { return editor.SelectionEnd; } set { editor.SelectionEnd = value; } }
|
2016-01-27 14:08:15 +00:00
|
|
|
public bool ShowWhitespace { get { return editor.ShowWhitespace; } set { editor.ShowWhitespace = value; } } //mxd
|
|
|
|
public bool WrapLongLines { get { return editor.WrapLongLines; } set { editor.WrapLongLines = value; } } //mxd
|
|
|
|
public string SelectedText { get { return editor.SelectedText; } } //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
public ScriptConfiguration Config { get { return config; } }
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2015-11-30 14:18:42 +00:00
|
|
|
#region ================== Events (mxd)
|
|
|
|
|
|
|
|
public new event EventHandler OnTextChanged; //mxd
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#region ================== Constructor
|
|
|
|
|
|
|
|
// Constructor
|
2016-04-28 14:02:24 +00:00
|
|
|
protected ScriptDocumentTab(ScriptEditorPanel panel, ScriptConfiguration config)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
2016-04-28 14:02:24 +00:00
|
|
|
// Keep panel and config
|
2009-04-19 18:07:22 +00:00
|
|
|
this.panel = panel;
|
2016-04-28 14:02:24 +00:00
|
|
|
this.config = config; //mxd
|
2016-11-24 11:55:11 +00:00
|
|
|
this.BackColor = SystemColors.ControlLightLight; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// 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;
|
2012-07-10 10:20:45 +00:00
|
|
|
editor.TabIndex = 1;
|
2009-04-19 18:07:22 +00:00
|
|
|
this.Controls.Add(editor);
|
|
|
|
|
|
|
|
// Bind events
|
|
|
|
editor.OnExplicitSaveTab += panel.ExplicitSaveCurrentTab;
|
|
|
|
editor.OnOpenScriptBrowser += panel.OpenBrowseScript;
|
|
|
|
editor.OnOpenFindAndReplace += panel.OpenFindAndReplace;
|
|
|
|
editor.OnFindNext += panel.FindNext;
|
2014-12-10 13:15:23 +00:00
|
|
|
editor.OnFindPrevious += panel.FindPrevious; //mxd
|
2016-12-02 13:45:03 +00:00
|
|
|
editor.OnFindNextWrapAround += panel.FindNextWrapAround;
|
|
|
|
editor.OnFindPreviousWrapAround += panel.FindPreviousWrapAround;
|
2015-11-30 14:18:42 +00:00
|
|
|
editor.OnTextChanged += editor_TextChanged; //mxd
|
2016-11-24 11:55:11 +00:00
|
|
|
editor.OnGoToLine += panel.GoToLine; //mxd
|
|
|
|
editor.OnCompileScript -= Compile; //mxd
|
2016-01-27 14:08:15 +00:00
|
|
|
|
|
|
|
//mxd. Bind functionbar events
|
2016-04-28 14:02:24 +00:00
|
|
|
editor.OnFunctionBarDropDown += functionbar_DropDown;
|
|
|
|
|
|
|
|
//mxd. Setup styles
|
|
|
|
editor.SetupStyles(config);
|
2016-11-24 11:55:11 +00:00
|
|
|
|
|
|
|
//mxd. Apply panel settings
|
|
|
|
editor.ShowWhitespace = panel.ShowWhitespace;
|
|
|
|
editor.WrapLongLines = panel.WrapLongLines;
|
|
|
|
|
|
|
|
//mxd. Set icon
|
|
|
|
this.ImageIndex = panel.Icons.GetScriptIcon(config.ScriptType);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Disposer
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
{
|
|
|
|
// Remove events
|
|
|
|
editor.OnExplicitSaveTab -= panel.ExplicitSaveCurrentTab;
|
|
|
|
editor.OnOpenScriptBrowser -= panel.OpenBrowseScript;
|
|
|
|
editor.OnOpenFindAndReplace -= panel.OpenFindAndReplace;
|
|
|
|
editor.OnFindNext -= panel.FindNext;
|
2014-12-10 13:15:23 +00:00
|
|
|
editor.OnFindPrevious -= panel.FindPrevious; //mxd
|
2015-11-30 14:18:42 +00:00
|
|
|
editor.OnTextChanged -= editor_TextChanged; //mxd
|
2016-11-24 11:55:11 +00:00
|
|
|
editor.OnGoToLine -= panel.GoToLine; //mxd
|
|
|
|
editor.OnCompileScript -= Compile; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
base.Dispose(disposing);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
2009-05-10 17:02:47 +00:00
|
|
|
// This launches keyword help website
|
2013-08-08 11:04:13 +00:00
|
|
|
public bool LaunchKeywordHelp()
|
2009-05-10 17:02:47 +00:00
|
|
|
{
|
2013-08-08 11:04:13 +00:00
|
|
|
return editor.LaunchKeywordHelp();
|
2009-05-10 17:02:47 +00:00
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// This refreshes the style settings
|
|
|
|
public virtual void RefreshSettings()
|
|
|
|
{
|
|
|
|
editor.RefreshStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
// This moves the caret to the given line
|
|
|
|
public virtual void MoveToLine(int linenumber)
|
|
|
|
{
|
|
|
|
editor.MoveToLine(linenumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
// This clears all marks
|
|
|
|
public virtual void ClearMarks()
|
|
|
|
{
|
|
|
|
editor.ClearMarks();
|
|
|
|
}
|
|
|
|
|
|
|
|
// This creates error marks for errors that apply to this file
|
|
|
|
public virtual void MarkScriptErrors(IEnumerable<CompilerError> errors)
|
|
|
|
{
|
|
|
|
// Clear all marks
|
|
|
|
ClearMarks();
|
|
|
|
|
|
|
|
// Go for all errors that apply to this script
|
|
|
|
foreach(CompilerError e in errors)
|
|
|
|
{
|
|
|
|
if(VerifyErrorForScript(e))
|
|
|
|
{
|
|
|
|
// Add a mark on the line where this error occurred
|
|
|
|
editor.AddMark(e.linenumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// This verifies if the specified error applies to this script
|
|
|
|
public virtual bool VerifyErrorForScript(CompilerError e)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This compiles the script
|
2012-07-23 21:28:23 +00:00
|
|
|
public virtual void Compile() { }
|
2009-04-19 18:07:22 +00:00
|
|
|
|
2018-04-14 13:55:21 +00:00
|
|
|
// [ZZ] this removes trailing whitespace from every line
|
|
|
|
protected void RemoveTrailingWhitespace()
|
|
|
|
{
|
|
|
|
// after changing the contents, selection should stay on the same line, and just move to the end of that line if it was on the trailing space.
|
|
|
|
int vscroll = editor.Scintilla.FirstVisibleLine;
|
|
|
|
int selectionStart = editor.SelectionStart;
|
|
|
|
int selectionEnd = editor.SelectionEnd;
|
|
|
|
|
|
|
|
int offset = 0;
|
|
|
|
string text = editor.Text;
|
|
|
|
string[] atext = text.Split(new char[] { '\n' });
|
|
|
|
for (int i = 0; i < atext.Length; i++)
|
|
|
|
{
|
|
|
|
string oldtext = atext[i];
|
|
|
|
string newtext = oldtext.TrimEnd();
|
|
|
|
int lendiff = oldtext.Length - newtext.Length;
|
|
|
|
|
|
|
|
bool selectioninline1 = selectionStart >= offset && selectionStart < offset + oldtext.Length;
|
|
|
|
bool selectioninline2 = selectionEnd >= offset && selectionEnd < offset + oldtext.Length;
|
|
|
|
|
|
|
|
if (selectioninline1 && selectionStart > offset + newtext.Length)
|
|
|
|
selectionStart = offset + newtext.Length;
|
|
|
|
|
|
|
|
if (selectioninline2 && selectionEnd > offset + newtext.Length)
|
|
|
|
selectionEnd = offset + newtext.Length;
|
|
|
|
|
|
|
|
atext[i] = newtext;
|
|
|
|
offset += newtext.Length + 1; // include \n
|
|
|
|
if (selectionStart > offset)
|
|
|
|
selectionStart -= lendiff;
|
|
|
|
if (selectionEnd > offset)
|
|
|
|
selectionEnd -= lendiff;
|
|
|
|
}
|
|
|
|
|
|
|
|
editor.Text = string.Join("\n", atext);
|
|
|
|
editor.SelectionStart = selectionStart;
|
|
|
|
editor.SelectionEnd = selectionEnd;
|
|
|
|
editor.Scintilla.FirstVisibleLine = vscroll;
|
|
|
|
}
|
2017-02-20 05:07:44 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// This saves the document (used for both explicit and implicit)
|
|
|
|
// Return true when successfully saved
|
|
|
|
public virtual bool Save()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This saves the document to a new file
|
|
|
|
// Return true when successfully saved
|
|
|
|
public virtual bool SaveAs(string filename)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This changes the script configurations
|
|
|
|
public virtual void ChangeScriptConfig(ScriptConfiguration newconfig)
|
|
|
|
{
|
2016-04-28 14:02:24 +00:00
|
|
|
config = newconfig; //mxd
|
|
|
|
editor.SetupStyles(newconfig); //mxd
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
List<CompilerError> errors = UpdateNavigator(); //mxd
|
2016-05-12 13:56:25 +00:00
|
|
|
if(panel.ActiveTab == this) panel.ShowErrors(errors, true); //mxd
|
2016-11-24 11:55:11 +00:00
|
|
|
this.ImageIndex = panel.Icons.GetScriptIcon(config.ScriptType); //mxd. Set icon
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Call this to set the tab title
|
|
|
|
protected void SetTitle(string title)
|
|
|
|
{
|
2015-11-30 14:18:42 +00:00
|
|
|
this.title = title; //mxd
|
|
|
|
base.Text = (editor.IsChanged ? "\u25CF " + title : title); //mxd
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
protected void UpdateTitle()
|
|
|
|
{
|
|
|
|
SetTitle(title);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Perform undo
|
|
|
|
public void Undo()
|
|
|
|
{
|
|
|
|
editor.Undo();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Perform redo
|
|
|
|
public void Redo()
|
|
|
|
{
|
|
|
|
editor.Redo();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Perform cut
|
|
|
|
public void Cut()
|
|
|
|
{
|
|
|
|
editor.Cut();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Perform copy
|
|
|
|
public void Copy()
|
|
|
|
{
|
|
|
|
editor.Copy();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Perform paste
|
|
|
|
public void Paste()
|
|
|
|
{
|
|
|
|
editor.Paste();
|
|
|
|
}
|
2014-12-10 13:15:23 +00:00
|
|
|
|
|
|
|
// Find next result (mxd)
|
|
|
|
public bool FindNext(FindReplaceOptions options)
|
|
|
|
{
|
|
|
|
return FindNext(options, false);
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Find next result
|
2014-12-10 13:15:23 +00:00
|
|
|
public bool FindNext(FindReplaceOptions options, bool useselectionstart)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
2016-01-27 14:08:15 +00:00
|
|
|
return editor.FindNext(options, useselectionstart);
|
2014-12-10 13:15:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Find previous result (mxd)
|
2016-01-27 14:08:15 +00:00
|
|
|
public bool FindPrevious(FindReplaceOptions options)
|
|
|
|
{
|
|
|
|
return editor.FindPrevious(options);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This replaces the selection with the given text
|
|
|
|
public void ReplaceSelection(string replacement)
|
|
|
|
{
|
|
|
|
editor.ReplaceSelection(replacement);
|
|
|
|
}
|
2012-07-12 22:34:12 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
internal List<CompilerError> UpdateNavigator()
|
2014-05-13 09:43:58 +00:00
|
|
|
{
|
2016-04-28 14:02:24 +00:00
|
|
|
return editor.UpdateNavigator(this);
|
2013-09-11 09:47:53 +00:00
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
2016-04-28 14:02:24 +00:00
|
|
|
//mxd. TODO: remove this
|
2014-05-13 09:43:58 +00:00
|
|
|
internal ScriptType VerifyScriptType()
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
ScriptTypeParserSE parser = new ScriptTypeParserSE();
|
2016-11-24 21:09:24 +00:00
|
|
|
TextResourceData data = new TextResourceData(new MemoryStream(editor.GetText()), new DataLocation(), config.Description);
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
|
|
|
|
if(parser.Parse(data, false))
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2015-12-17 10:07:28 +00:00
|
|
|
if(parser.ScriptType != ScriptType.UNKNOWN && config.ScriptType != parser.ScriptType)
|
2013-09-11 09:47:53 +00:00
|
|
|
return parser.ScriptType;
|
|
|
|
}
|
2015-12-17 10:07:28 +00:00
|
|
|
|
|
|
|
if(parser.HasError)
|
2016-05-12 13:56:25 +00:00
|
|
|
panel.ShowErrors(new List<CompilerError> { new CompilerError(parser.ErrorDescription, parser.ErrorSource, parser.ErrorLine) }, true);
|
2015-12-17 10:07:28 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
return ScriptType.UNKNOWN;
|
|
|
|
}
|
2012-07-16 09:45:21 +00:00
|
|
|
|
2014-05-13 09:43:58 +00:00
|
|
|
//mxd
|
2016-01-27 14:08:15 +00:00
|
|
|
internal void InsertSnippet(string name)
|
|
|
|
{
|
|
|
|
string[] lines = config.GetSnippet(name);
|
|
|
|
if(lines != null) editor.InsertSnippet(lines);
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
internal void IndentSelection(bool indent)
|
2014-05-13 09:43:58 +00:00
|
|
|
{
|
2016-01-27 14:08:15 +00:00
|
|
|
editor.IndentSelection(indent);
|
2014-05-13 09:43:58 +00:00
|
|
|
}
|
|
|
|
|
2016-02-05 15:21:58 +00:00
|
|
|
//mxd
|
2016-11-24 11:55:11 +00:00
|
|
|
internal virtual void SetViewSettings(ScriptDocumentSettings settings)
|
2016-02-05 15:21:58 +00:00
|
|
|
{
|
2016-11-24 11:55:11 +00:00
|
|
|
if(settings.TabType != tabtype) throw new Exception("TabType mismatch!");
|
|
|
|
|
2016-02-05 15:21:58 +00:00
|
|
|
// Text must be exactly the same
|
|
|
|
long hash = MurmurHash2.Hash(Text);
|
2018-04-14 13:55:21 +00:00
|
|
|
bool applyfolding = General.Settings.ScriptShowFolding && (editor.Scintilla.Lexer == Lexer.Cpp /*|| editor.Scintilla.Lexer == Lexer.CppNoCase*/);
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
if(hash == settings.Hash)
|
|
|
|
{
|
|
|
|
// Restore fold levels
|
|
|
|
if(applyfolding) ApplyFolding(settings.FoldLevels ?? GetFoldLevels());
|
|
|
|
|
|
|
|
// Restore scroll
|
2016-11-24 11:55:11 +00:00
|
|
|
editor.Scintilla.FirstVisibleLine = settings.FirstVisibleLine;
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
|
|
|
|
// Restore caret position
|
2016-11-24 11:55:11 +00:00
|
|
|
editor.Scintilla.SetEmptySelection(settings.CaretPosition);
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
}
|
|
|
|
// Do what Visual Studio does: fold all #regions
|
|
|
|
else if(applyfolding)
|
|
|
|
{
|
|
|
|
ApplyFolding(GetFoldLevels());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal void SetDefaultViewSettings()
|
|
|
|
{
|
2018-04-14 13:55:21 +00:00
|
|
|
if(General.Settings.ScriptShowFolding && (editor.Scintilla.Lexer == Lexer.Cpp /*|| editor.Scintilla.Lexer == Lexer.CppNoCase*/))
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
ApplyFolding(GetFoldLevels());
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ApplyFolding(Dictionary<int, HashSet<int>> foldlevelsarr)
|
|
|
|
{
|
|
|
|
// We'll want to fold deeper levels first...
|
|
|
|
int[] fl = new int[foldlevelsarr.Keys.Count];
|
|
|
|
foldlevelsarr.Keys.CopyTo(fl, 0);
|
|
|
|
|
|
|
|
List<int> foldlevels = new List<int>(fl);
|
|
|
|
foldlevels.Sort((a, b) => -1 * a.CompareTo(b)); // Sort in descending order
|
|
|
|
|
|
|
|
foreach(int level in foldlevels)
|
2016-02-05 15:21:58 +00:00
|
|
|
{
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
foreach(int line in foldlevelsarr[level])
|
2016-11-24 11:55:11 +00:00
|
|
|
editor.Scintilla.Lines[line].FoldLine(FoldAction.Contract);
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
}
|
|
|
|
}
|
2016-02-05 15:21:58 +00:00
|
|
|
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
private Dictionary<int, HashSet<int>> GetFoldLevels()
|
|
|
|
{
|
|
|
|
Dictionary<int, HashSet<int>> foldlevels = new Dictionary<int, HashSet<int>>();
|
2018-04-14 13:55:21 +00:00
|
|
|
int foldlevel = SC_FOLDLEVELBASE;
|
2016-02-05 15:21:58 +00:00
|
|
|
|
2016-11-24 11:55:11 +00:00
|
|
|
for(int i = 0; i < editor.Scintilla.Lines.Count; i++)
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
{
|
2016-11-24 11:55:11 +00:00
|
|
|
string line = editor.Scintilla.Lines[i].Text.TrimStart();
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
if(line.StartsWith("#region", true, CultureInfo.InvariantCulture))
|
2016-02-05 15:21:58 +00:00
|
|
|
{
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
foldlevel++;
|
|
|
|
if(!foldlevels.ContainsKey(foldlevel)) foldlevels.Add(foldlevel, new HashSet<int>());
|
|
|
|
foldlevels[foldlevel].Add(i);
|
|
|
|
}
|
2018-04-14 13:55:21 +00:00
|
|
|
else if(line.StartsWith("#endregion", true, CultureInfo.InvariantCulture) && foldlevel > SC_FOLDLEVELBASE)
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
{
|
|
|
|
foldlevel--;
|
2016-02-05 15:21:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Added, Sector Edit window, UDMF: added UI for sector damage-realted properties.
Added, DECORATE parser: damage types are now parsed.
Added: the editor now reports duplicate textures/flats/patches/sprites/colormaps/voxels in the loaded wads.
Added, all text parsers: added #region/#endregion support.
Added TERRAIN parser.
Added, Script Editor: added special handling for DECORATE special comments.
Added, Sector Edit window, UDMF: Soundsequence value was setup incorrectly when showing the window for multiple sectors with mixed Soundsequence value.
Fixed, Map Options window: "Strictly load patches between P_START and P_END" was not applied when applying the changes.
Fixed, MAPINFO parser: MapInfo should be treated as defined when a map MAPINFO block corresponding to current map is encountered even if it doesn't define any properties recognized by the editor.
Fixed, all text parsers: in some cases error line was calculated incorrectly when reporting an error detected by a text parser.
Cosmetic: changed ' to " in the rest of Error and Warning messages.
Internal: added text resource tracking.
Updated ZDoom_DECORATE.cfg.
Updated documentation ("Game Configuration - Basic Settings" page).
2016-02-22 12:33:19 +00:00
|
|
|
return foldlevels;
|
2016-02-05 15:21:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
2016-11-24 11:55:11 +00:00
|
|
|
internal virtual ScriptDocumentSettings GetViewSettings()
|
2016-02-05 15:21:58 +00:00
|
|
|
{
|
|
|
|
Dictionary<int, HashSet<int>> foldlevels = new Dictionary<int, HashSet<int>>();
|
|
|
|
|
2016-11-24 11:55:11 +00:00
|
|
|
for(int i = 0; i < editor.Scintilla.Lines.Count; i++)
|
2016-02-05 15:21:58 +00:00
|
|
|
{
|
2016-11-24 11:55:11 +00:00
|
|
|
if(!editor.Scintilla.Lines[i].Expanded)
|
2016-02-05 15:21:58 +00:00
|
|
|
{
|
2016-11-24 11:55:11 +00:00
|
|
|
if(!foldlevels.ContainsKey(editor.Scintilla.Lines[i].FoldLevel))
|
|
|
|
foldlevels.Add(editor.Scintilla.Lines[i].FoldLevel, new HashSet<int>());
|
|
|
|
foldlevels[editor.Scintilla.Lines[i].FoldLevel].Add(i);
|
2016-02-05 15:21:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return new ScriptDocumentSettings
|
|
|
|
{
|
|
|
|
Filename = this.Filename,
|
|
|
|
FoldLevels = foldlevels,
|
2016-11-24 11:55:11 +00:00
|
|
|
ScriptType = config.ScriptType,
|
|
|
|
CaretPosition = editor.Scintilla.SelectionStart,
|
|
|
|
TabType = tabtype,
|
2016-02-05 15:21:58 +00:00
|
|
|
IsActiveTab = (this.Panel.ActiveTab == this),
|
2016-11-24 11:55:11 +00:00
|
|
|
FirstVisibleLine = editor.Scintilla.FirstVisibleLine,
|
2016-02-05 15:21:58 +00:00
|
|
|
Hash = MurmurHash2.Hash(Text),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Events
|
|
|
|
|
|
|
|
// Mouse released
|
|
|
|
protected override void OnMouseUp(MouseEventArgs e)
|
|
|
|
{
|
|
|
|
base.OnMouseUp(e);
|
|
|
|
|
|
|
|
// Focus to the editor!
|
|
|
|
editor.Focus();
|
|
|
|
editor.GrabFocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Receiving focus?
|
|
|
|
protected override void OnGotFocus(EventArgs e)
|
|
|
|
{
|
|
|
|
base.OnGotFocus(e);
|
|
|
|
|
|
|
|
// Focus to the editor!
|
|
|
|
editor.Focus();
|
|
|
|
editor.GrabFocus();
|
|
|
|
}
|
2012-07-12 22:34:12 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
2016-01-27 14:08:15 +00:00
|
|
|
private void functionbar_DropDown(object sender, EventArgs e)
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2016-05-12 13:56:25 +00:00
|
|
|
if(editor.IsChanged) panel.ShowErrors(UpdateNavigator(), true);
|
2015-11-30 14:18:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
|
|
|
private void editor_TextChanged(object sender, EventArgs eventArgs)
|
|
|
|
{
|
|
|
|
UpdateTitle();
|
|
|
|
if(OnTextChanged != null) OnTextChanged(this, EventArgs.Empty);
|
2013-09-11 09:47:53 +00:00
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
2019-08-29 14:30:49 +00:00
|
|
|
|
|
|
|
#endif
|