mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-22 11:51:42 +00:00
Updated, Script Editor: redesigned "Find and Replace" window. It can now search/replace in all opened tabs and all detected text resources.
Fixed, Script Editor: resources list control was incorrectly positioned when using DPI scaling.
This commit is contained in:
parent
a31c6b6652
commit
5dd45ffdca
18 changed files with 1253 additions and 333 deletions
BIN
Resources/Icons/Replace.png
Normal file
BIN
Resources/Icons/Replace.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 445 B |
|
@ -113,6 +113,8 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
editor.OnOpenFindAndReplace += panel.OpenFindAndReplace;
|
editor.OnOpenFindAndReplace += panel.OpenFindAndReplace;
|
||||||
editor.OnFindNext += panel.FindNext;
|
editor.OnFindNext += panel.FindNext;
|
||||||
editor.OnFindPrevious += panel.FindPrevious; //mxd
|
editor.OnFindPrevious += panel.FindPrevious; //mxd
|
||||||
|
editor.OnFindNextWrapAround += panel.FindNextWrapAround;
|
||||||
|
editor.OnFindPreviousWrapAround += panel.FindPreviousWrapAround;
|
||||||
editor.OnTextChanged += editor_TextChanged; //mxd
|
editor.OnTextChanged += editor_TextChanged; //mxd
|
||||||
editor.OnGoToLine += panel.GoToLine; //mxd
|
editor.OnGoToLine += panel.GoToLine; //mxd
|
||||||
editor.OnCompileScript -= Compile; //mxd
|
editor.OnCompileScript -= Compile; //mxd
|
||||||
|
|
|
@ -80,8 +80,10 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
public delegate void ExplicitSaveTabDelegate();
|
public delegate void ExplicitSaveTabDelegate();
|
||||||
public delegate void OpenScriptBrowserDelegate();
|
public delegate void OpenScriptBrowserDelegate();
|
||||||
public delegate void OpenFindReplaceDelegate();
|
public delegate void OpenFindReplaceDelegate();
|
||||||
public delegate void FindNextDelegate();
|
public delegate bool FindNextDelegate();
|
||||||
public delegate void FindPreviousDelegate(); //mxd
|
public delegate bool FindPreviousDelegate(); //mxd
|
||||||
|
public delegate bool FindNextWrapAroundDelegate(FindReplaceOptions options); //mxd
|
||||||
|
public delegate bool FindPreviousWrapAroundDelegate(FindReplaceOptions options); //mxd
|
||||||
public delegate void GoToLineDelegate(); //mxd
|
public delegate void GoToLineDelegate(); //mxd
|
||||||
public delegate void CompileScriptDelegate(); //mxd
|
public delegate void CompileScriptDelegate(); //mxd
|
||||||
|
|
||||||
|
@ -90,6 +92,8 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
public event OpenFindReplaceDelegate OnOpenFindAndReplace;
|
public event OpenFindReplaceDelegate OnOpenFindAndReplace;
|
||||||
public event FindNextDelegate OnFindNext;
|
public event FindNextDelegate OnFindNext;
|
||||||
public event FindPreviousDelegate OnFindPrevious; //mxd
|
public event FindPreviousDelegate OnFindPrevious; //mxd
|
||||||
|
public event FindNextWrapAroundDelegate OnFindNextWrapAround; //mxd
|
||||||
|
public event FindPreviousWrapAroundDelegate OnFindPreviousWrapAround; //mxd
|
||||||
public new event EventHandler OnTextChanged; //mxd
|
public new event EventHandler OnTextChanged; //mxd
|
||||||
public event EventHandler OnFunctionBarDropDown; //mxd
|
public event EventHandler OnFunctionBarDropDown; //mxd
|
||||||
public event GoToLineDelegate OnGoToLine; //mxd
|
public event GoToLineDelegate OnGoToLine; //mxd
|
||||||
|
@ -114,7 +118,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
private int caretoffset; //mxd. Used to modify caret position after autogenerating stuff
|
private int caretoffset; //mxd. Used to modify caret position after autogenerating stuff
|
||||||
private bool expandcodeblock; //mxd. More gross hacks
|
private bool expandcodeblock; //mxd. More gross hacks
|
||||||
private string highlightedword; //mxd
|
private string highlightedword; //mxd
|
||||||
private Encoding encoding; //mxd
|
private static Encoding encoding = Encoding.GetEncoding(1251); //mxd. ASCII with cyrillic support...
|
||||||
|
|
||||||
//mxd. Event propagation
|
//mxd. Event propagation
|
||||||
private bool preventchanges;
|
private bool preventchanges;
|
||||||
|
@ -131,6 +135,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
public bool ShowWhitespace { get { return scriptedit.ViewWhitespace != WhitespaceMode.Invisible; } set { scriptedit.ViewWhitespace = value ? WhitespaceMode.VisibleAlways : WhitespaceMode.Invisible; } }
|
public bool ShowWhitespace { get { return scriptedit.ViewWhitespace != WhitespaceMode.Invisible; } set { scriptedit.ViewWhitespace = value ? WhitespaceMode.VisibleAlways : WhitespaceMode.Invisible; } }
|
||||||
public bool WrapLongLines { get { return scriptedit.WrapMode != WrapMode.None; } set { scriptedit.WrapMode = (value ? WrapMode.Char : WrapMode.None); } }
|
public bool WrapLongLines { get { return scriptedit.WrapMode != WrapMode.None; } set { scriptedit.WrapMode = (value ? WrapMode.Char : WrapMode.None); } }
|
||||||
internal Scintilla Scintilla { get { return scriptedit; } } //mxd
|
internal Scintilla Scintilla { get { return scriptedit; } } //mxd
|
||||||
|
internal static Encoding Encoding { get { return encoding; } } //mxd
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -142,9 +147,6 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
// Initialize
|
// Initialize
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
//mxd. ASCII with cyrillic support...
|
|
||||||
encoding = Encoding.GetEncoding(1251);
|
|
||||||
|
|
||||||
// Script editor properties
|
// Script editor properties
|
||||||
//TODO: use ScintillaNET properties instead when they become available
|
//TODO: use ScintillaNET properties instead when they become available
|
||||||
scriptedit.DirectMessage(NativeMethods.SCI_SETBACKSPACEUNINDENTS, new IntPtr(1));
|
scriptedit.DirectMessage(NativeMethods.SCI_SETBACKSPACEUNINDENTS, new IntPtr(1));
|
||||||
|
@ -655,6 +657,15 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
public bool FindNext(FindReplaceOptions options, bool useselectionstart)
|
public bool FindNext(FindReplaceOptions options, bool useselectionstart)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(options.FindText)) return false;
|
if(string.IsNullOrEmpty(options.FindText)) return false;
|
||||||
|
|
||||||
|
// Find next match/abort when trying to replace in read-only tab
|
||||||
|
if(scriptedit.ReadOnly && options.ReplaceWith != null)
|
||||||
|
{
|
||||||
|
if(options.SearchMode != FindReplaceSearchMode.CURRENT_FILE && OnFindNextWrapAround != null)
|
||||||
|
return OnFindNextWrapAround(options);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int startpos = (useselectionstart ? Math.Min(scriptedit.SelectionStart, scriptedit.SelectionEnd) : Math.Max(scriptedit.SelectionStart, scriptedit.SelectionEnd));
|
int startpos = (useselectionstart ? Math.Min(scriptedit.SelectionStart, scriptedit.SelectionEnd) : Math.Max(scriptedit.SelectionStart, scriptedit.SelectionEnd));
|
||||||
|
|
||||||
// Search the document
|
// Search the document
|
||||||
|
@ -668,6 +679,12 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
// Wrap around?
|
// Wrap around?
|
||||||
if(result == -1)
|
if(result == -1)
|
||||||
{
|
{
|
||||||
|
if(options.SearchMode != FindReplaceSearchMode.CURRENT_FILE
|
||||||
|
&& OnFindNextWrapAround != null && OnFindNextWrapAround(options))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
scriptedit.TargetStart = 0;
|
scriptedit.TargetStart = 0;
|
||||||
scriptedit.TargetEnd = startpos;
|
scriptedit.TargetEnd = startpos;
|
||||||
result = scriptedit.SearchInTarget(options.FindText);
|
result = scriptedit.SearchInTarget(options.FindText);
|
||||||
|
@ -694,6 +711,15 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
public bool FindPrevious(FindReplaceOptions options)
|
public bool FindPrevious(FindReplaceOptions options)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(options.FindText)) return false;
|
if(string.IsNullOrEmpty(options.FindText)) return false;
|
||||||
|
|
||||||
|
// Find previous match/abort when trying to replace in read-only tab
|
||||||
|
if(scriptedit.ReadOnly && options.ReplaceWith != null)
|
||||||
|
{
|
||||||
|
if(options.SearchMode != FindReplaceSearchMode.CURRENT_FILE && OnFindPreviousWrapAround != null)
|
||||||
|
return OnFindPreviousWrapAround(options);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int endpos = Math.Max(0, Math.Min(scriptedit.SelectionStart, scriptedit.SelectionEnd) - 1);
|
int endpos = Math.Max(0, Math.Min(scriptedit.SelectionStart, scriptedit.SelectionEnd) - 1);
|
||||||
|
|
||||||
// Search the document
|
// Search the document
|
||||||
|
@ -707,6 +733,12 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
// Wrap around?
|
// Wrap around?
|
||||||
if(result == -1)
|
if(result == -1)
|
||||||
{
|
{
|
||||||
|
if(options.SearchMode != FindReplaceSearchMode.CURRENT_FILE
|
||||||
|
&& OnFindPreviousWrapAround != null && OnFindPreviousWrapAround(options))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
scriptedit.TargetStart = scriptedit.TextLength;
|
scriptedit.TargetStart = scriptedit.TextLength;
|
||||||
scriptedit.TargetEnd = endpos;
|
scriptedit.TargetEnd = endpos;
|
||||||
result = scriptedit.SearchInTarget(options.FindText);
|
result = scriptedit.SearchInTarget(options.FindText);
|
||||||
|
|
|
@ -403,6 +403,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
this.searchbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
this.searchbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
this.searchbox.Name = "searchbox";
|
this.searchbox.Name = "searchbox";
|
||||||
this.searchbox.Size = new System.Drawing.Size(100, 25);
|
this.searchbox.Size = new System.Drawing.Size(100, 25);
|
||||||
|
this.searchbox.ToolTipText = "Quick search";
|
||||||
this.searchbox.TextChanged += new System.EventHandler(this.searchbox_TextChanged);
|
this.searchbox.TextChanged += new System.EventHandler(this.searchbox_TextChanged);
|
||||||
//
|
//
|
||||||
// searchprev
|
// searchprev
|
||||||
|
@ -914,7 +915,6 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
this.tabresources.ImageIndex = 0;
|
this.tabresources.ImageIndex = 0;
|
||||||
this.tabresources.Location = new System.Drawing.Point(4, 23);
|
this.tabresources.Location = new System.Drawing.Point(4, 23);
|
||||||
this.tabresources.Name = "tabresources";
|
this.tabresources.Name = "tabresources";
|
||||||
this.tabresources.Padding = new System.Windows.Forms.Padding(3);
|
|
||||||
this.tabresources.Size = new System.Drawing.Size(189, 419);
|
this.tabresources.Size = new System.Drawing.Size(189, 419);
|
||||||
this.tabresources.TabIndex = 0;
|
this.tabresources.TabIndex = 0;
|
||||||
this.tabresources.Text = " Resources ";
|
this.tabresources.Text = " Resources ";
|
||||||
|
@ -924,10 +924,11 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
//
|
//
|
||||||
this.scriptresources.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
this.scriptresources.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
this.scriptresources.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.scriptresources.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.scriptresources.Location = new System.Drawing.Point(3, 3);
|
this.scriptresources.Location = new System.Drawing.Point(0, 0);
|
||||||
this.scriptresources.Margin = new System.Windows.Forms.Padding(0);
|
this.scriptresources.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.scriptresources.Name = "scriptresources";
|
this.scriptresources.Name = "scriptresources";
|
||||||
this.scriptresources.Size = new System.Drawing.Size(183, 413);
|
this.scriptresources.Padding = new System.Windows.Forms.Padding(0, 3, 3, 0);
|
||||||
|
this.scriptresources.Size = new System.Drawing.Size(189, 419);
|
||||||
this.scriptresources.TabIndex = 0;
|
this.scriptresources.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// splitter
|
// splitter
|
||||||
|
|
|
@ -382,119 +382,440 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
#region ================== Methods
|
#region ================== Methods
|
||||||
|
|
||||||
// Find Next
|
// Find Next
|
||||||
public void FindNext(FindReplaceOptions options)
|
public bool FindNext(FindReplaceOptions options)
|
||||||
{
|
{
|
||||||
// Save the options
|
// Save the options
|
||||||
findoptions = options;
|
findoptions = options;
|
||||||
FindNext();
|
return FindNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find Next with saved options
|
// Find Next with saved options
|
||||||
public void FindNext()
|
public bool FindNext()
|
||||||
{
|
{
|
||||||
if(!string.IsNullOrEmpty(findoptions.FindText) && (ActiveTab != null))
|
if(!string.IsNullOrEmpty(findoptions.FindText) && (ActiveTab != null))
|
||||||
{
|
{
|
||||||
if(!ActiveTab.FindNext(findoptions))
|
if(!ActiveTab.FindNext(findoptions))
|
||||||
|
{
|
||||||
DisplayStatus(ScriptStatusType.Warning, "Can't find any occurrence of \"" + findoptions.FindText + "\".");
|
DisplayStatus(ScriptStatusType.Warning, "Can't find any occurrence of \"" + findoptions.FindText + "\".");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
General.MessageBeep(MessageBeepType.Default);
|
General.MessageBeep(MessageBeepType.Default);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find Previous
|
// Find Previous
|
||||||
public void FindPrevious(FindReplaceOptions options)
|
public bool FindPrevious(FindReplaceOptions options)
|
||||||
{
|
{
|
||||||
// Save the options
|
// Save the options
|
||||||
findoptions = options;
|
findoptions = options;
|
||||||
FindPrevious();
|
return FindPrevious();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find Previous with saved options (mxd)
|
// Find Previous with saved options (mxd)
|
||||||
public void FindPrevious()
|
public bool FindPrevious()
|
||||||
{
|
{
|
||||||
if(!string.IsNullOrEmpty(findoptions.FindText) && (ActiveTab != null))
|
if(!string.IsNullOrEmpty(findoptions.FindText) && (ActiveTab != null))
|
||||||
{
|
{
|
||||||
if(!ActiveTab.FindPrevious(findoptions))
|
if(!ActiveTab.FindPrevious(findoptions))
|
||||||
|
{
|
||||||
DisplayStatus(ScriptStatusType.Warning, "Can't find any occurrence of \"" + findoptions.FindText + "\".");
|
DisplayStatus(ScriptStatusType.Warning, "Can't find any occurrence of \"" + findoptions.FindText + "\".");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
General.MessageBeep(MessageBeepType.Default);
|
General.MessageBeep(MessageBeepType.Default);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
public bool FindNextWrapAround(FindReplaceOptions options)
|
||||||
|
{
|
||||||
|
var curtab = ActiveTab;
|
||||||
|
if(curtab == null) return false; // Boilerplate
|
||||||
|
switch(options.SearchMode)
|
||||||
|
{
|
||||||
|
case FindReplaceSearchMode.CURRENT_FILE: return false; // Let the tab handle wrap-around
|
||||||
|
|
||||||
|
case FindReplaceSearchMode.OPENED_TABS_CURRENT_SCRIPT_TYPE:
|
||||||
|
case FindReplaceSearchMode.OPENED_TABS_ALL_SCRIPT_TYPES:
|
||||||
|
ScriptType targettabtype = curtab.Config.ScriptType;
|
||||||
|
bool checktabtype = (options.SearchMode == FindReplaceSearchMode.OPENED_TABS_CURRENT_SCRIPT_TYPE);
|
||||||
|
|
||||||
|
// Search in processed tab only
|
||||||
|
var searchoptions = new FindReplaceOptions(options) { SearchMode = FindReplaceSearchMode.CURRENT_FILE };
|
||||||
|
|
||||||
|
// Find next suitable tab...
|
||||||
|
int start = tabs.TabPages.IndexOf(curtab);
|
||||||
|
|
||||||
|
// Search after current tab
|
||||||
|
for(int i = start + 1; i < tabs.TabPages.Count; i++)
|
||||||
|
{
|
||||||
|
var t = tabs.TabPages[i] as ScriptDocumentTab;
|
||||||
|
if(t != null && (!checktabtype || t.Config.ScriptType == targettabtype) && t.FindNext(searchoptions))
|
||||||
|
{
|
||||||
|
// Next match found!
|
||||||
|
tabs.SelectTab(t);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search before current tab
|
||||||
|
if(start > 0)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < start; i++)
|
||||||
|
{
|
||||||
|
var t = tabs.TabPages[i] as ScriptDocumentTab;
|
||||||
|
if(t != null && (!checktabtype || t.Config.ScriptType == targettabtype) && t.FindNext(searchoptions))
|
||||||
|
{
|
||||||
|
// Next match found!
|
||||||
|
tabs.SelectTab(t);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No dice
|
||||||
|
return false;
|
||||||
|
|
||||||
|
case FindReplaceSearchMode.CURRENT_PROJECT_CURRENT_SCRIPT_TYPE:
|
||||||
|
case FindReplaceSearchMode.CURRENT_PROJECT_ALL_SCRIPT_TYPES:
|
||||||
|
ScriptType targetrestype = curtab.Config.ScriptType;
|
||||||
|
bool searchallresources = (options.SearchMode == FindReplaceSearchMode.CURRENT_PROJECT_ALL_SCRIPT_TYPES);
|
||||||
|
|
||||||
|
// Search in processed tab only
|
||||||
|
var ressearchoptions = new FindReplaceOptions(options) { SearchMode = FindReplaceSearchMode.CURRENT_FILE };
|
||||||
|
bool replacemode = (options.ReplaceWith != null);
|
||||||
|
|
||||||
|
// Find current resource, then search
|
||||||
|
if(General.Map.Data.ScriptResources.ContainsKey(targetrestype))
|
||||||
|
{
|
||||||
|
var reslist = new List<ScriptResource>(General.Map.Data.ScriptResources[targetrestype]);
|
||||||
|
|
||||||
|
// Determine starting resource
|
||||||
|
int startres = -1;
|
||||||
|
if(curtab is ScriptResourceDocumentTab)
|
||||||
|
{
|
||||||
|
startres = reslist.IndexOf(((ScriptResourceDocumentTab)curtab).Resource);
|
||||||
|
}
|
||||||
|
else if(curtab is ScriptLumpDocumentTab)
|
||||||
|
{
|
||||||
|
// Only temporary map wad qualifies
|
||||||
|
var scripttab = (ScriptLumpDocumentTab)curtab;
|
||||||
|
for(int i = 0; i < reslist.Count; i++)
|
||||||
|
{
|
||||||
|
if(reslist[i].Resource == General.Map.TemporaryMapFile && reslist[i].Filename == scripttab.Filename)
|
||||||
|
{
|
||||||
|
startres = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search after current resource
|
||||||
|
// This will search among all resources of targetrestype when startres == -1
|
||||||
|
for(int i = startres + 1; i < reslist.Count; i++)
|
||||||
|
{
|
||||||
|
// Perform search...
|
||||||
|
if((!reslist[i].IsReadOnly || !replacemode) && reslist[i].ContainsText(ressearchoptions))
|
||||||
|
{
|
||||||
|
// Found it!
|
||||||
|
var newtab = OpenResource(reslist[i]);
|
||||||
|
newtab.FindNext(ressearchoptions); // Search again using actual tab...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(searchallresources)
|
||||||
|
{
|
||||||
|
// Search all script types after current ScriptType
|
||||||
|
var usedscripttypes = new List<ScriptType>(General.Map.Data.ScriptResources.Keys);
|
||||||
|
int startrestypepos = usedscripttypes.IndexOf(targetrestype);
|
||||||
|
for(int i = startrestypepos + 1; i < usedscripttypes.Count; i++)
|
||||||
|
{
|
||||||
|
foreach(ScriptResource sr in General.Map.Data.ScriptResources[usedscripttypes[i]])
|
||||||
|
{
|
||||||
|
// Perform search...
|
||||||
|
if((!sr.IsReadOnly || !replacemode) && sr.ContainsText(ressearchoptions))
|
||||||
|
{
|
||||||
|
// Found it!
|
||||||
|
var newtab = OpenResource(sr);
|
||||||
|
newtab.FindNext(ressearchoptions); // Search again using actual tab...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search all script types before current ScriptType
|
||||||
|
if(startrestypepos > 0)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < startrestypepos; i++)
|
||||||
|
{
|
||||||
|
foreach(ScriptResource sr in General.Map.Data.ScriptResources[usedscripttypes[i]])
|
||||||
|
{
|
||||||
|
// Perform search...
|
||||||
|
if((!sr.IsReadOnly || !replacemode) && sr.ContainsText(ressearchoptions))
|
||||||
|
{
|
||||||
|
// Found it!
|
||||||
|
var newtab = OpenResource(sr);
|
||||||
|
newtab.FindNext(ressearchoptions); // Search again using actual tab...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search before current resource
|
||||||
|
if(startres > 0)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < startres; i++)
|
||||||
|
{
|
||||||
|
// Perform search...
|
||||||
|
if((!reslist[i].IsReadOnly || !replacemode) && reslist[i].ContainsText(ressearchoptions))
|
||||||
|
{
|
||||||
|
// Found it!
|
||||||
|
var newtab = OpenResource(reslist[i]);
|
||||||
|
newtab.FindNext(ressearchoptions); // Search again using actual tab...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(searchallresources)
|
||||||
|
{
|
||||||
|
// Just search among all resources
|
||||||
|
var usedscripttypes = new List<ScriptType>(General.Map.Data.ScriptResources.Keys);
|
||||||
|
for(int i = 0; i < usedscripttypes.Count; i++)
|
||||||
|
{
|
||||||
|
foreach(ScriptResource sr in General.Map.Data.ScriptResources[usedscripttypes[i]])
|
||||||
|
{
|
||||||
|
// Perform search...
|
||||||
|
if((!sr.IsReadOnly || !replacemode) && sr.ContainsText(ressearchoptions))
|
||||||
|
{
|
||||||
|
// Found it!
|
||||||
|
var newtab = OpenResource(sr);
|
||||||
|
newtab.FindNext(ressearchoptions); // Search again using actual tab...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No dice
|
||||||
|
return false;
|
||||||
|
|
||||||
|
default: throw new NotImplementedException("Unknown FindReplaceSearchMode!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
public bool FindPreviousWrapAround(FindReplaceOptions options)
|
||||||
|
{
|
||||||
|
var curtab = ActiveTab;
|
||||||
|
if(curtab == null) return false; // Boilerplate
|
||||||
|
switch(options.SearchMode)
|
||||||
|
{
|
||||||
|
case FindReplaceSearchMode.CURRENT_FILE: return false; // Let the tab handle wrap-around
|
||||||
|
|
||||||
|
case FindReplaceSearchMode.OPENED_TABS_CURRENT_SCRIPT_TYPE:
|
||||||
|
case FindReplaceSearchMode.OPENED_TABS_ALL_SCRIPT_TYPES:
|
||||||
|
ScriptType targettabtype = curtab.Config.ScriptType;
|
||||||
|
bool checktabtype = (options.SearchMode == FindReplaceSearchMode.OPENED_TABS_CURRENT_SCRIPT_TYPE);
|
||||||
|
|
||||||
|
// Search in processed tab only
|
||||||
|
var searchoptions = new FindReplaceOptions(options) { SearchMode = FindReplaceSearchMode.CURRENT_FILE };
|
||||||
|
|
||||||
|
// Find previous suitable tab...
|
||||||
|
int start = tabs.TabPages.IndexOf(curtab);
|
||||||
|
|
||||||
|
// Search before current tab
|
||||||
|
for(int i = start - 1; i > -1; i--)
|
||||||
|
{
|
||||||
|
var t = tabs.TabPages[i] as ScriptDocumentTab;
|
||||||
|
if(t != null && (!checktabtype || t.Config.ScriptType == targettabtype) && t.FindPrevious(searchoptions))
|
||||||
|
{
|
||||||
|
// Previous match found!
|
||||||
|
tabs.SelectTab(t);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search after current tab
|
||||||
|
if(start < tabs.TabPages.Count - 1)
|
||||||
|
{
|
||||||
|
for(int i = tabs.TabPages.Count - 1; i > start; i--)
|
||||||
|
{
|
||||||
|
var t = tabs.TabPages[i] as ScriptDocumentTab;
|
||||||
|
if(t != null && (!checktabtype || t.Config.ScriptType == targettabtype) && t.FindPrevious(searchoptions))
|
||||||
|
{
|
||||||
|
// Previous match found!
|
||||||
|
tabs.SelectTab(t);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No dice
|
||||||
|
return false;
|
||||||
|
|
||||||
|
case FindReplaceSearchMode.CURRENT_PROJECT_CURRENT_SCRIPT_TYPE:
|
||||||
|
case FindReplaceSearchMode.CURRENT_PROJECT_ALL_SCRIPT_TYPES:
|
||||||
|
ScriptType targetrestype = curtab.Config.ScriptType;
|
||||||
|
bool searchallresources = (options.SearchMode == FindReplaceSearchMode.CURRENT_PROJECT_ALL_SCRIPT_TYPES);
|
||||||
|
|
||||||
|
// Search in processed tab only
|
||||||
|
var ressearchoptions = new FindReplaceOptions(options) { SearchMode = FindReplaceSearchMode.CURRENT_FILE };
|
||||||
|
bool replacemode = (options.ReplaceWith != null);
|
||||||
|
|
||||||
|
// Find current resource, then search
|
||||||
|
if(General.Map.Data.ScriptResources.ContainsKey(targetrestype))
|
||||||
|
{
|
||||||
|
var reslist = new List<ScriptResource>(General.Map.Data.ScriptResources[targetrestype]);
|
||||||
|
|
||||||
|
// Determine starting resource
|
||||||
|
int startres = -1;
|
||||||
|
if(curtab is ScriptResourceDocumentTab)
|
||||||
|
{
|
||||||
|
startres = reslist.IndexOf(((ScriptResourceDocumentTab)curtab).Resource);
|
||||||
|
}
|
||||||
|
else if(curtab is ScriptLumpDocumentTab)
|
||||||
|
{
|
||||||
|
// Only temporary map wad qualifies
|
||||||
|
var scripttab = (ScriptLumpDocumentTab)curtab;
|
||||||
|
for(int i = 0; i < reslist.Count; i++)
|
||||||
|
{
|
||||||
|
if(reslist[i].Resource == General.Map.TemporaryMapFile && reslist[i].Filename == scripttab.Filename)
|
||||||
|
{
|
||||||
|
startres = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search before current resource
|
||||||
|
// This will search among all resources of targetrestype when startres == -1
|
||||||
|
for(int i = startres - 1; i > -1; i--)
|
||||||
|
{
|
||||||
|
// Perform search...
|
||||||
|
if((!reslist[i].IsReadOnly || !replacemode) && reslist[i].ContainsText(ressearchoptions))
|
||||||
|
{
|
||||||
|
// Found it!
|
||||||
|
var newtab = OpenResource(reslist[i]);
|
||||||
|
newtab.FindPrevious(ressearchoptions); // Search again using actual tab...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(searchallresources)
|
||||||
|
{
|
||||||
|
// Search all script types before current ScriptType
|
||||||
|
var usedscripttypes = new List<ScriptType>(General.Map.Data.ScriptResources.Keys);
|
||||||
|
int startrestypepos = usedscripttypes.IndexOf(targetrestype);
|
||||||
|
for(int i = startrestypepos - 1; i > 0; i--)
|
||||||
|
{
|
||||||
|
foreach(ScriptResource sr in General.Map.Data.ScriptResources[usedscripttypes[i]])
|
||||||
|
{
|
||||||
|
// Perform search...
|
||||||
|
if((!sr.IsReadOnly || !replacemode) && sr.ContainsText(ressearchoptions))
|
||||||
|
{
|
||||||
|
// Found it!
|
||||||
|
var newtab = OpenResource(sr);
|
||||||
|
newtab.FindPrevious(ressearchoptions); // Search again using actual tab...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search all script types after current ScriptType
|
||||||
|
if(startrestypepos < usedscripttypes.Count)
|
||||||
|
{
|
||||||
|
for(int i = usedscripttypes.Count - 1; i > startrestypepos; i--)
|
||||||
|
{
|
||||||
|
foreach(ScriptResource sr in General.Map.Data.ScriptResources[usedscripttypes[i]])
|
||||||
|
{
|
||||||
|
// Perform search...
|
||||||
|
if((!sr.IsReadOnly || !replacemode) && sr.ContainsText(ressearchoptions))
|
||||||
|
{
|
||||||
|
// Found it!
|
||||||
|
var newtab = OpenResource(sr);
|
||||||
|
newtab.FindPrevious(ressearchoptions); // Search again using actual tab...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search after current resource
|
||||||
|
if(startres > 0)
|
||||||
|
{
|
||||||
|
for(int i = reslist.Count - 1; i > startres; i--)
|
||||||
|
{
|
||||||
|
// Perform search...
|
||||||
|
if((!reslist[i].IsReadOnly || !replacemode) && reslist[i].ContainsText(ressearchoptions))
|
||||||
|
{
|
||||||
|
// Found it!
|
||||||
|
var newtab = OpenResource(reslist[i]);
|
||||||
|
newtab.FindPrevious(ressearchoptions); // Search again using actual tab...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(searchallresources)
|
||||||
|
{
|
||||||
|
// Just search among all resources
|
||||||
|
var usedscripttypes = new List<ScriptType>(General.Map.Data.ScriptResources.Keys);
|
||||||
|
for(int i = usedscripttypes.Count - 1; i > -1; i--)
|
||||||
|
{
|
||||||
|
foreach(ScriptResource sr in General.Map.Data.ScriptResources[usedscripttypes[i]])
|
||||||
|
{
|
||||||
|
// Perform search...
|
||||||
|
if((!sr.IsReadOnly || !replacemode) && sr.ContainsText(ressearchoptions))
|
||||||
|
{
|
||||||
|
// Found it!
|
||||||
|
var newtab = OpenResource(sr);
|
||||||
|
newtab.FindPrevious(ressearchoptions); // Search again using actual tab...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No dice
|
||||||
|
return false;
|
||||||
|
|
||||||
|
default: throw new NotImplementedException("Unknown FindReplaceSearchMode!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace if possible
|
// Replace if possible
|
||||||
public void Replace(FindReplaceOptions options)
|
public bool Replace(FindReplaceOptions options)
|
||||||
{
|
{
|
||||||
if(!string.IsNullOrEmpty(findoptions.FindText) && options.ReplaceWith != null && ActiveTab != null && !ActiveTab.IsReadOnly)
|
ScriptDocumentTab curtab = ActiveTab; //mxd
|
||||||
|
if(!string.IsNullOrEmpty(options.FindText) && options.ReplaceWith != null && curtab != null && !curtab.IsReadOnly)
|
||||||
{
|
{
|
||||||
if(string.Compare(ActiveTab.SelectedText, options.FindText, !options.CaseSensitive) == 0)
|
if(string.Compare(curtab.SelectedText, options.FindText, !options.CaseSensitive) == 0)
|
||||||
{
|
{
|
||||||
// Replace selection
|
// Replace selection
|
||||||
ActiveTab.ReplaceSelection(options.ReplaceWith);
|
curtab.ReplaceSelection(options.ReplaceWith);
|
||||||
}
|
return true;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
General.MessageBeep(MessageBeepType.Default);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace all
|
return false;
|
||||||
public void ReplaceAll(FindReplaceOptions options)
|
|
||||||
{
|
|
||||||
int replacements = 0;
|
|
||||||
findoptions = options;
|
|
||||||
if(!string.IsNullOrEmpty(findoptions.FindText) && options.ReplaceWith != null && ActiveTab != null && !ActiveTab.IsReadOnly)
|
|
||||||
{
|
|
||||||
int firstfindpos = -1;
|
|
||||||
int lastpos = -1;
|
|
||||||
bool firstreplace = true;
|
|
||||||
bool wrappedaround = false;
|
|
||||||
int selectionstart = Math.Min(ActiveTab.SelectionStart, ActiveTab.SelectionEnd);
|
|
||||||
|
|
||||||
// Continue finding and replacing until nothing more found
|
|
||||||
while(ActiveTab.FindNext(findoptions))
|
|
||||||
{
|
|
||||||
int curpos = Math.Min(ActiveTab.SelectionStart, ActiveTab.SelectionEnd);
|
|
||||||
if(curpos <= lastpos)
|
|
||||||
wrappedaround = true;
|
|
||||||
|
|
||||||
if(firstreplace)
|
|
||||||
{
|
|
||||||
// Remember where we started replacing
|
|
||||||
firstfindpos = curpos;
|
|
||||||
}
|
|
||||||
else if(wrappedaround)
|
|
||||||
{
|
|
||||||
// Make sure we don't go past our start point, or we could be in an endless loop
|
|
||||||
if(curpos >= firstfindpos)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Replace(findoptions);
|
|
||||||
replacements++;
|
|
||||||
firstreplace = false;
|
|
||||||
|
|
||||||
lastpos = curpos;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore selection
|
|
||||||
ActiveTab.SelectionStart = selectionstart;
|
|
||||||
ActiveTab.SelectionEnd = selectionstart;
|
|
||||||
|
|
||||||
// Show result
|
|
||||||
if(replacements == 0)
|
|
||||||
DisplayStatus(ScriptStatusType.Warning, "Can't find any occurrence of \"" + findoptions.FindText + "\".");
|
|
||||||
else
|
|
||||||
DisplayStatus(ScriptStatusType.Info, "Replaced " + replacements + " occurrences of \"" + findoptions.FindText + "\" with \"" + findoptions.ReplaceWith + "\".");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
General.MessageBeep(MessageBeepType.Default);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This closed the Find & Replace subwindow
|
// This closed the Find & Replace subwindow
|
||||||
|
@ -1059,8 +1380,8 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. This changes status text
|
//mxd. This changes status text
|
||||||
private void DisplayStatus(ScriptStatusType type, string message) { DisplayStatus(new ScriptStatusInfo(type, message)); }
|
internal void DisplayStatus(ScriptStatusType type, string message) { DisplayStatus(new ScriptStatusInfo(type, message)); }
|
||||||
private void DisplayStatus(ScriptStatusInfo newstatus)
|
internal void DisplayStatus(ScriptStatusInfo newstatus)
|
||||||
{
|
{
|
||||||
// Stop timers
|
// Stop timers
|
||||||
if(!newstatus.displayed)
|
if(!newstatus.displayed)
|
||||||
|
|
|
@ -9,6 +9,7 @@ using System.Windows.Forms;
|
||||||
using CodeImp.DoomBuilder.Config;
|
using CodeImp.DoomBuilder.Config;
|
||||||
using CodeImp.DoomBuilder.Data;
|
using CodeImp.DoomBuilder.Data;
|
||||||
using CodeImp.DoomBuilder.Data.Scripting;
|
using CodeImp.DoomBuilder.Data.Scripting;
|
||||||
|
using CodeImp.DoomBuilder.Windows;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -452,6 +453,22 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
toselect = node;
|
toselect = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnLoad(EventArgs e)
|
||||||
|
{
|
||||||
|
// Manual reposition required...
|
||||||
|
if(MainForm.DPIScaler.Width != 1.0f || MainForm.DPIScaler.Height != 1.0f)
|
||||||
|
{
|
||||||
|
filterprojectclear.Left = this.Width - filterprojectclear.Width - filterprojectclear.Margin.Right;
|
||||||
|
filterproject.Width = filterprojectclear.Left - filterprojectclear.Margin.Left - filterproject.Left;
|
||||||
|
filterbytype.Left = filterproject.Left;
|
||||||
|
filterbytype.Width = filterprojectclear.Right - filterproject.Left;
|
||||||
|
projecttree.Width = this.Width - projecttree.Left - projecttree.Margin.Right;
|
||||||
|
projecttree.Height = this.Height - projecttree.Top - projecttree.Margin.Bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnLoad(e);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Events
|
#region ================== Events
|
||||||
|
|
|
@ -28,34 +28,19 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.projecttree = new CodeImp.DoomBuilder.Controls.BufferedTreeView();
|
|
||||||
this.filterproject = new System.Windows.Forms.TextBox();
|
this.filterproject = new System.Windows.Forms.TextBox();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.filterprojectclear = new System.Windows.Forms.Button();
|
this.filterprojectclear = new System.Windows.Forms.Button();
|
||||||
this.filterbytype = new System.Windows.Forms.ComboBox();
|
this.filterbytype = new System.Windows.Forms.ComboBox();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.projecttree = new CodeImp.DoomBuilder.Controls.BufferedTreeView();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// projecttree
|
|
||||||
//
|
|
||||||
this.projecttree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.projecttree.HideSelection = false;
|
|
||||||
this.projecttree.Location = new System.Drawing.Point(3, 56);
|
|
||||||
this.projecttree.Name = "projecttree";
|
|
||||||
this.projecttree.ShowNodeToolTips = true;
|
|
||||||
this.projecttree.Size = new System.Drawing.Size(293, 494);
|
|
||||||
this.projecttree.TabIndex = 7;
|
|
||||||
this.projecttree.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.projecttree_NodeMouseDoubleClick);
|
|
||||||
this.projecttree.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.projecttree_BeforeExpand);
|
|
||||||
this.projecttree.BeforeCollapse += new System.Windows.Forms.TreeViewCancelEventHandler(this.projecttree_BeforeCollapse);
|
|
||||||
//
|
|
||||||
// filterproject
|
// filterproject
|
||||||
//
|
//
|
||||||
this.filterproject.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.filterproject.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.filterproject.Location = new System.Drawing.Point(75, 3);
|
this.filterproject.Location = new System.Drawing.Point(76, 3);
|
||||||
this.filterproject.Name = "filterproject";
|
this.filterproject.Name = "filterproject";
|
||||||
this.filterproject.Size = new System.Drawing.Size(190, 20);
|
this.filterproject.Size = new System.Drawing.Size(190, 20);
|
||||||
this.filterproject.TabIndex = 5;
|
this.filterproject.TabIndex = 5;
|
||||||
|
@ -76,7 +61,7 @@
|
||||||
this.filterprojectclear.Image = global::CodeImp.DoomBuilder.Properties.Resources.SearchClear;
|
this.filterprojectclear.Image = global::CodeImp.DoomBuilder.Properties.Resources.SearchClear;
|
||||||
this.filterprojectclear.Location = new System.Drawing.Point(271, 1);
|
this.filterprojectclear.Location = new System.Drawing.Point(271, 1);
|
||||||
this.filterprojectclear.Name = "filterprojectclear";
|
this.filterprojectclear.Name = "filterprojectclear";
|
||||||
this.filterprojectclear.Size = new System.Drawing.Size(25, 23);
|
this.filterprojectclear.Size = new System.Drawing.Size(25, 24);
|
||||||
this.filterprojectclear.TabIndex = 6;
|
this.filterprojectclear.TabIndex = 6;
|
||||||
this.filterprojectclear.UseVisualStyleBackColor = true;
|
this.filterprojectclear.UseVisualStyleBackColor = true;
|
||||||
this.filterprojectclear.Click += new System.EventHandler(this.filterprojectclear_Click);
|
this.filterprojectclear.Click += new System.EventHandler(this.filterprojectclear_Click);
|
||||||
|
@ -102,6 +87,21 @@
|
||||||
this.label2.TabIndex = 9;
|
this.label2.TabIndex = 9;
|
||||||
this.label2.Text = "Script type:";
|
this.label2.Text = "Script type:";
|
||||||
//
|
//
|
||||||
|
// projecttree
|
||||||
|
//
|
||||||
|
this.projecttree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.projecttree.HideSelection = false;
|
||||||
|
this.projecttree.Location = new System.Drawing.Point(3, 56);
|
||||||
|
this.projecttree.Name = "projecttree";
|
||||||
|
this.projecttree.ShowNodeToolTips = true;
|
||||||
|
this.projecttree.Size = new System.Drawing.Size(293, 494);
|
||||||
|
this.projecttree.TabIndex = 7;
|
||||||
|
this.projecttree.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.projecttree_NodeMouseDoubleClick);
|
||||||
|
this.projecttree.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.projecttree_BeforeExpand);
|
||||||
|
this.projecttree.BeforeCollapse += new System.Windows.Forms.TreeViewCancelEventHandler(this.projecttree_BeforeCollapse);
|
||||||
|
//
|
||||||
// ScriptResourcesControl
|
// ScriptResourcesControl
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||||
|
|
|
@ -3,7 +3,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using CodeImp.DoomBuilder.Config;
|
using CodeImp.DoomBuilder.Config;
|
||||||
|
using CodeImp.DoomBuilder.Controls;
|
||||||
|
using CodeImp.DoomBuilder.Windows;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -67,6 +70,32 @@ namespace CodeImp.DoomBuilder.Data.Scripting
|
||||||
|
|
||||||
#region ================== Methods
|
#region ================== Methods
|
||||||
|
|
||||||
|
internal bool ContainsText(FindReplaceOptions options)
|
||||||
|
{
|
||||||
|
// Get text
|
||||||
|
DataReader res = GetResource();
|
||||||
|
if(res == null) return false;
|
||||||
|
MemoryStream stream = res.LoadFile(filename, lumpindex);
|
||||||
|
if(stream != null)
|
||||||
|
{
|
||||||
|
// Add word boundary delimiter?
|
||||||
|
string findtext = (options.WholeWord ? "\\b" + options.FindText + "\\b" : options.FindText);
|
||||||
|
RegexOptions ro = (options.CaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase);
|
||||||
|
Regex regex = new Regex(findtext, ro);
|
||||||
|
|
||||||
|
using(StreamReader reader = new StreamReader(stream, ScriptEditorControl.Encoding))
|
||||||
|
{
|
||||||
|
while(!reader.EndOfStream)
|
||||||
|
{
|
||||||
|
if(regex.IsMatch(reader.ReadLine())) return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No dice...
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private DataReader GetResource()
|
private DataReader GetResource()
|
||||||
{
|
{
|
||||||
if(resource == null || resource.IsDisposed)
|
if(resource == null || resource.IsDisposed)
|
||||||
|
|
|
@ -974,7 +974,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
public override IEnumerable<TextResourceData> GetVoxeldefData()
|
public override IEnumerable<TextResourceData> GetVoxeldefData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetAllLumps("VOXELDEF");
|
return GetAllLumpsData("VOXELDEF");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. This finds and returns a voxel stream or null if no voxel was found
|
//mxd. This finds and returns a voxel stream or null if no voxel was found
|
||||||
|
@ -1014,7 +1014,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
public override IEnumerable<TextResourceData> GetDecorateData(string pname)
|
public override IEnumerable<TextResourceData> GetDecorateData(string pname)
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
List<TextResourceData> result = GetAllLumps(pname); //mxd
|
List<TextResourceData> result = GetAllLumpsData(pname); //mxd
|
||||||
|
|
||||||
//mxd. Return ALL DECORATE lumps
|
//mxd. Return ALL DECORATE lumps
|
||||||
if(result.Count == 0 || string.Compare(pname, "DECORATE", StringComparison.OrdinalIgnoreCase) == 0)
|
if(result.Count == 0 || string.Compare(pname, "DECORATE", StringComparison.OrdinalIgnoreCase) == 0)
|
||||||
|
@ -1031,10 +1031,10 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
|
|
||||||
// First look for ZMAPINFO
|
// First look for ZMAPINFO
|
||||||
List<TextResourceData> result = new List<TextResourceData>();
|
List<TextResourceData> result = new List<TextResourceData>();
|
||||||
result.AddRange(GetLastLump("ZMAPINFO"));
|
result.AddRange(GetLastLumpData("ZMAPINFO"));
|
||||||
|
|
||||||
// Then for MAPINFO
|
// Then for MAPINFO
|
||||||
if(result.Count == 0) result.AddRange(GetLastLump("MAPINFO"));
|
if(result.Count == 0) result.AddRange(GetLastLumpData("MAPINFO"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1049,11 +1049,11 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
if(basegame != GameType.UNKNOWN)
|
if(basegame != GameType.UNKNOWN)
|
||||||
{
|
{
|
||||||
string lumpname = GameType.GldefsLumpsPerGame[basegame];
|
string lumpname = GameType.GldefsLumpsPerGame[basegame];
|
||||||
result.AddRange(GetAllLumps(lumpname));
|
result.AddRange(GetAllLumpsData(lumpname));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can be many entries per wad
|
// Can be many entries per wad
|
||||||
result.AddRange(GetAllLumps("GLDEFS"));
|
result.AddRange(GetAllLumpsData("GLDEFS"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1061,81 +1061,81 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
public override IEnumerable<TextResourceData> GetModeldefData()
|
public override IEnumerable<TextResourceData> GetModeldefData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetAllLumps("MODELDEF");
|
return GetAllLumpsData("MODELDEF");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public override IEnumerable<TextResourceData> GetReverbsData()
|
public override IEnumerable<TextResourceData> GetReverbsData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetAllLumps("REVERBS");
|
return GetAllLumpsData("REVERBS");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public override IEnumerable<TextResourceData> GetSndInfoData()
|
public override IEnumerable<TextResourceData> GetSndInfoData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetAllLumps("SNDINFO");
|
return GetAllLumpsData("SNDINFO");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public override IEnumerable<TextResourceData> GetSndSeqData()
|
public override IEnumerable<TextResourceData> GetSndSeqData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetAllLumps("SNDSEQ");
|
return GetAllLumpsData("SNDSEQ");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public override IEnumerable<TextResourceData> GetAnimdefsData()
|
public override IEnumerable<TextResourceData> GetAnimdefsData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetAllLumps("ANIMDEFS");
|
return GetAllLumpsData("ANIMDEFS");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public override IEnumerable<TextResourceData> GetTerrainData()
|
public override IEnumerable<TextResourceData> GetTerrainData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetAllLumps("TERRAIN");
|
return GetAllLumpsData("TERRAIN");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public override IEnumerable<TextResourceData> GetX11R6RGBData()
|
public override IEnumerable<TextResourceData> GetX11R6RGBData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetAllLumps("X11R6RGB");
|
return GetAllLumpsData("X11R6RGB");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public override IEnumerable<TextResourceData> GetCvarInfoData()
|
public override IEnumerable<TextResourceData> GetCvarInfoData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetAllLumps("CVARINFO");
|
return GetAllLumpsData("CVARINFO");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public override IEnumerable<TextResourceData> GetLockDefsData()
|
public override IEnumerable<TextResourceData> GetLockDefsData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetAllLumps("LOCKDEFS");
|
return GetAllLumpsData("LOCKDEFS");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public override IEnumerable<TextResourceData> GetMenuDefData()
|
public override IEnumerable<TextResourceData> GetMenuDefData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetLastLump("MENUDEF");
|
return GetLastLumpData("MENUDEF");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
public override IEnumerable<TextResourceData> GetSBarInfoData()
|
public override IEnumerable<TextResourceData> GetSBarInfoData()
|
||||||
{
|
{
|
||||||
if(issuspended) throw new Exception("Data reader is suspended");
|
if(issuspended) throw new Exception("Data reader is suspended");
|
||||||
return GetLastLump("SBARINFO");
|
return GetLastLumpData("SBARINFO");
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
private IEnumerable<TextResourceData> GetLastLump(string name)
|
private IEnumerable<TextResourceData> GetFirstLumpData(string name)
|
||||||
{
|
{
|
||||||
List<TextResourceData> result = new List<TextResourceData>();
|
List<TextResourceData> result = new List<TextResourceData>();
|
||||||
int lumpindex = file.FindLumpIndex(name);
|
int lumpindex = file.FindLumpIndex(name);
|
||||||
|
@ -1146,7 +1146,18 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
private List<TextResourceData> GetAllLumps(string name)
|
private IEnumerable<TextResourceData> GetLastLumpData(string name)
|
||||||
|
{
|
||||||
|
List<TextResourceData> result = new List<TextResourceData>();
|
||||||
|
int lumpindex = file.FindLastLumpIndex(name);
|
||||||
|
if(lumpindex != -1)
|
||||||
|
result.Add(new TextResourceData(this, file.Lumps[lumpindex].Stream, name, lumpindex, true));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
private List<TextResourceData> GetAllLumpsData(string name)
|
||||||
{
|
{
|
||||||
List<TextResourceData> result = new List<TextResourceData>();
|
List<TextResourceData> result = new List<TextResourceData>();
|
||||||
|
|
||||||
|
|
|
@ -517,8 +517,6 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
end = General.Clamp(end, 0, lumps.Count - 1);
|
end = General.Clamp(end, 0, lumps.Count - 1);
|
||||||
|
|
||||||
// Loop through the lumps
|
// Loop through the lumps
|
||||||
//TODO: ZDoom seems to prefer the last lump with the matching name,
|
|
||||||
//TODO: but our own logic (for example, WadReader.FindRanges) expect this to work as currently implemented
|
|
||||||
for(int i = start; i < end + 1; i++)
|
for(int i = start; i < end + 1; i++)
|
||||||
{
|
{
|
||||||
// Check if the lump name matches
|
// Check if the lump name matches
|
||||||
|
@ -533,6 +531,69 @@ namespace CodeImp.DoomBuilder.IO
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//mxd. Same as above, but searches in reversed order
|
||||||
|
|
||||||
|
// This finds a lump by name, returns null when not found
|
||||||
|
public Lump FindLastLump(string name)
|
||||||
|
{
|
||||||
|
int index = FindLastLumpIndex(name);
|
||||||
|
return (index == -1 ? null : lumps[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This finds a lump by name, returns null when not found
|
||||||
|
public Lump FindLastLump(string name, int start)
|
||||||
|
{
|
||||||
|
int index = FindLastLumpIndex(name, start);
|
||||||
|
return (index == -1 ? null : lumps[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This finds a lump by name, returns null when not found
|
||||||
|
public Lump FindLastLump(string name, int start, int end)
|
||||||
|
{
|
||||||
|
int index = FindLastLumpIndex(name, start, end);
|
||||||
|
return (index == -1 ? null : lumps[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This finds a lump by name, returns -1 when not found
|
||||||
|
public int FindLastLumpIndex(string name)
|
||||||
|
{
|
||||||
|
// Do search
|
||||||
|
return FindLastLumpIndex(name, 0, lumps.Count - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This finds a lump by name, returns -1 when not found
|
||||||
|
public int FindLastLumpIndex(string name, int start)
|
||||||
|
{
|
||||||
|
// Do search
|
||||||
|
return FindLastLumpIndex(name, start, lumps.Count - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This finds a lump by name, returns -1 when not found
|
||||||
|
public int FindLastLumpIndex(string name, int start, int end)
|
||||||
|
{
|
||||||
|
if(name.Length > 8 || lumps.Count == 0 || start > lumps.Count - 1) return -1; //mxd. Can't be here. Go away!
|
||||||
|
|
||||||
|
long longname = Lump.MakeLongName(name);
|
||||||
|
|
||||||
|
// Fix start/end when they exceed safe bounds
|
||||||
|
start = Math.Max(start, 0);
|
||||||
|
end = General.Clamp(end, 0, lumps.Count - 1);
|
||||||
|
|
||||||
|
// Loop through the lumps in backwards order
|
||||||
|
for(int i = end; i > start - 1; i--)
|
||||||
|
{
|
||||||
|
// Check if the lump name matches
|
||||||
|
if(lumps[i].LongName == longname)
|
||||||
|
{
|
||||||
|
// Found the lump!
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nothing found
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,32 @@
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.Windows
|
namespace CodeImp.DoomBuilder.Windows
|
||||||
{
|
{
|
||||||
|
internal enum FindReplaceSearchMode //mxd
|
||||||
|
{
|
||||||
|
CURRENT_FILE,
|
||||||
|
OPENED_TABS_CURRENT_SCRIPT_TYPE,
|
||||||
|
OPENED_TABS_ALL_SCRIPT_TYPES,
|
||||||
|
CURRENT_PROJECT_CURRENT_SCRIPT_TYPE,
|
||||||
|
CURRENT_PROJECT_ALL_SCRIPT_TYPES,
|
||||||
|
}
|
||||||
|
|
||||||
internal struct FindReplaceOptions
|
internal struct FindReplaceOptions
|
||||||
{
|
{
|
||||||
public string FindText;
|
public string FindText;
|
||||||
public bool CaseSensitive;
|
public bool CaseSensitive;
|
||||||
public bool WholeWord;
|
public bool WholeWord;
|
||||||
public string ReplaceWith;
|
public string ReplaceWith;
|
||||||
|
public FindReplaceSearchMode SearchMode; //mxd
|
||||||
|
|
||||||
|
//mxd. Copy constructor
|
||||||
|
public FindReplaceOptions(FindReplaceOptions other)
|
||||||
|
{
|
||||||
|
FindText = other.FindText;
|
||||||
|
CaseSensitive = other.CaseSensitive;
|
||||||
|
WholeWord = other.WholeWord;
|
||||||
|
ReplaceWith = other.ReplaceWith;
|
||||||
|
SearchMode = other.SearchMode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,21 +45,9 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
private bool undocreated; //mxd
|
private bool undocreated; //mxd
|
||||||
private readonly string[] renderstyles; //mxd
|
private readonly string[] renderstyles; //mxd
|
||||||
private readonly List<int> keynumbers; //mxd
|
private readonly List<int> keynumbers; //mxd
|
||||||
|
|
||||||
//mxd. Persistent settings
|
|
||||||
private static bool linkFrontTopScale;
|
|
||||||
private static bool linkFrontMidScale;
|
|
||||||
private static bool linkFrontBottomScale;
|
|
||||||
private static bool linkBackTopScale;
|
|
||||||
private static bool linkBackMidScale;
|
|
||||||
private static bool linkBackBottomScale;
|
|
||||||
|
|
||||||
private readonly List<PairedFieldsControl> frontUdmfControls; //mxd
|
private readonly List<PairedFieldsControl> frontUdmfControls; //mxd
|
||||||
private readonly List<PairedFieldsControl> backUdmfControls; //mxd
|
private readonly List<PairedFieldsControl> backUdmfControls; //mxd
|
||||||
|
|
||||||
//mxd. Window setup stuff
|
|
||||||
private static int activetab;
|
|
||||||
|
|
||||||
private struct LinedefProperties //mxd
|
private struct LinedefProperties //mxd
|
||||||
{
|
{
|
||||||
public readonly Dictionary<string, bool> Flags;
|
public readonly Dictionary<string, bool> Flags;
|
||||||
|
@ -149,8 +137,10 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
// Widow setup
|
// Widow setup
|
||||||
if(General.Settings.StoreSelectedEditTab && activetab > 0)
|
if(General.Settings.StoreSelectedEditTab)
|
||||||
{
|
{
|
||||||
|
int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0);
|
||||||
|
|
||||||
// When front or back tab was previously selected, switch to appropriate side (selectfront/selectback are set in BaseVisualGeometrySidedef.OnEditEnd)
|
// When front or back tab was previously selected, switch to appropriate side (selectfront/selectback are set in BaseVisualGeometrySidedef.OnEditEnd)
|
||||||
if((selectfront || selectback) && (activetab == 1 || activetab == 2))
|
if((selectfront || selectback) && (activetab == 1 || activetab == 2))
|
||||||
tabs.SelectTab(selectfront ? 1 : 2);
|
tabs.SelectTab(selectfront ? 1 : 2);
|
||||||
|
@ -220,12 +210,12 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
renderStyle.Items.Add(lf.Value);
|
renderStyle.Items.Add(lf.Value);
|
||||||
|
|
||||||
// Restore value linking
|
// Restore value linking
|
||||||
pfcFrontScaleTop.LinkValues = linkFrontTopScale;
|
pfcFrontScaleTop.LinkValues = General.Settings.ReadSetting("windows." + configname + ".linkfronttopscale", false);
|
||||||
pfcFrontScaleMid.LinkValues = linkFrontMidScale;
|
pfcFrontScaleMid.LinkValues = General.Settings.ReadSetting("windows." + configname + ".linkfrontmidscale", false);
|
||||||
pfcFrontScaleBottom.LinkValues = linkFrontBottomScale;
|
pfcFrontScaleBottom.LinkValues = General.Settings.ReadSetting("windows." + configname + ".linkfrontbottomscale", false);
|
||||||
pfcBackScaleTop.LinkValues = linkBackTopScale;
|
pfcBackScaleTop.LinkValues = General.Settings.ReadSetting("windows." + configname + ".linkbacktopscale", false);
|
||||||
pfcBackScaleMid.LinkValues = linkBackMidScale;
|
pfcBackScaleMid.LinkValues = General.Settings.ReadSetting("windows." + configname + ".linkbackmidscale", false);
|
||||||
pfcBackScaleBottom.LinkValues = linkBackBottomScale;
|
pfcBackScaleBottom.LinkValues = General.Settings.ReadSetting("windows." + configname + ".linkbackbottomscale", false);
|
||||||
|
|
||||||
// Disable top/mid/bottom texture offset controls?
|
// Disable top/mid/bottom texture offset controls?
|
||||||
if(!General.Map.Config.UseLocalSidedefTextureOffsets)
|
if(!General.Map.Config.UseLocalSidedefTextureOffsets)
|
||||||
|
@ -761,14 +751,6 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
//mxd. Apply tags
|
//mxd. Apply tags
|
||||||
tagsselector.ApplyTo(lines);
|
tagsselector.ApplyTo(lines);
|
||||||
|
|
||||||
//mxd. Store value linking
|
|
||||||
linkFrontTopScale = pfcFrontScaleTop.LinkValues;
|
|
||||||
linkFrontMidScale = pfcFrontScaleMid.LinkValues;
|
|
||||||
linkFrontBottomScale = pfcFrontScaleBottom.LinkValues;
|
|
||||||
linkBackTopScale = pfcBackScaleTop.LinkValues;
|
|
||||||
linkBackMidScale = pfcBackScaleMid.LinkValues;
|
|
||||||
linkBackBottomScale = pfcBackScaleBottom.LinkValues;
|
|
||||||
|
|
||||||
// Update the used textures
|
// Update the used textures
|
||||||
General.Map.Data.UpdateUsedTextures();
|
General.Map.Data.UpdateUsedTextures();
|
||||||
|
|
||||||
|
@ -845,8 +827,15 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
//mxd. Store window settings
|
//mxd. Store window settings
|
||||||
private void LinedefEditForm_FormClosing(object sender, FormClosingEventArgs e)
|
private void LinedefEditForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
// Save location and active tab
|
// Save settings
|
||||||
activetab = tabs.SelectedIndex;
|
General.Settings.WriteSetting("windows." + configname + ".activetab", tabs.SelectedIndex);
|
||||||
|
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".linkfronttopscale", pfcFrontScaleTop.LinkValues);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".linkfrontmidscale", pfcFrontScaleMid.LinkValues);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".linkfrontbottomscale", pfcFrontScaleBottom.LinkValues);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".linkbacktopscale", pfcBackScaleTop.LinkValues);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".linkbackmidscale", pfcBackScaleMid.LinkValues);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".linkbackbottomscale", pfcBackScaleBottom.LinkValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Help!
|
// Help!
|
||||||
|
|
349
Source/Core/Windows/ScriptFindReplaceForm.Designer.cs
generated
349
Source/Core/Windows/ScriptFindReplaceForm.Designer.cs
generated
|
@ -28,76 +28,70 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScriptFindReplaceForm));
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.findtext = new System.Windows.Forms.TextBox();
|
this.findmatchcase = new System.Windows.Forms.CheckBox();
|
||||||
this.casesensitive = new System.Windows.Forms.CheckBox();
|
this.findwholeword = new System.Windows.Forms.CheckBox();
|
||||||
this.wordonly = new System.Windows.Forms.CheckBox();
|
|
||||||
this.replacetext = new System.Windows.Forms.TextBox();
|
|
||||||
this.labelreplace = new System.Windows.Forms.Label();
|
|
||||||
this.findnextbutton = new System.Windows.Forms.Button();
|
this.findnextbutton = new System.Windows.Forms.Button();
|
||||||
this.replaceallbutton = new System.Windows.Forms.Button();
|
this.replaceallbutton = new System.Windows.Forms.Button();
|
||||||
this.closebutton = new System.Windows.Forms.Button();
|
|
||||||
this.replacebutton = new System.Windows.Forms.Button();
|
this.replacebutton = new System.Windows.Forms.Button();
|
||||||
this.findpreviousbutton = new System.Windows.Forms.Button();
|
this.findpreviousbutton = new System.Windows.Forms.Button();
|
||||||
|
this.tabs = new System.Windows.Forms.TabControl();
|
||||||
|
this.tabfind = new System.Windows.Forms.TabPage();
|
||||||
|
this.findinbox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.findbox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.tabreplace = new System.Windows.Forms.TabPage();
|
||||||
|
this.replacebox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
|
this.replaceinbox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
this.replacefindbox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.replacematchcase = new System.Windows.Forms.CheckBox();
|
||||||
|
this.replacewholeword = new System.Windows.Forms.CheckBox();
|
||||||
|
this.imagelist = new System.Windows.Forms.ImageList(this.components);
|
||||||
|
this.tabs.SuspendLayout();
|
||||||
|
this.tabfind.SuspendLayout();
|
||||||
|
this.tabreplace.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
this.label1.AutoSize = true;
|
||||||
this.label1.Location = new System.Drawing.Point(29, 23);
|
this.label1.Location = new System.Drawing.Point(6, 16);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(56, 13);
|
this.label1.Size = new System.Drawing.Size(56, 13);
|
||||||
this.label1.TabIndex = 0;
|
this.label1.TabIndex = 0;
|
||||||
this.label1.Text = "Find what:";
|
this.label1.Text = "Find what:";
|
||||||
//
|
//
|
||||||
// findtext
|
// findmatchcase
|
||||||
//
|
//
|
||||||
this.findtext.Location = new System.Drawing.Point(93, 20);
|
this.findmatchcase.AutoSize = true;
|
||||||
this.findtext.Name = "findtext";
|
this.findmatchcase.Location = new System.Drawing.Point(9, 116);
|
||||||
this.findtext.Size = new System.Drawing.Size(152, 20);
|
this.findmatchcase.Name = "findmatchcase";
|
||||||
this.findtext.TabIndex = 0;
|
this.findmatchcase.Size = new System.Drawing.Size(82, 17);
|
||||||
|
this.findmatchcase.TabIndex = 2;
|
||||||
|
this.findmatchcase.Text = "Match case";
|
||||||
|
this.findmatchcase.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// casesensitive
|
// findwholeword
|
||||||
//
|
//
|
||||||
this.casesensitive.AutoSize = true;
|
this.findwholeword.AutoSize = true;
|
||||||
this.casesensitive.Location = new System.Drawing.Point(93, 81);
|
this.findwholeword.Location = new System.Drawing.Point(97, 116);
|
||||||
this.casesensitive.Name = "casesensitive";
|
this.findwholeword.Name = "findwholeword";
|
||||||
this.casesensitive.Size = new System.Drawing.Size(94, 17);
|
this.findwholeword.Size = new System.Drawing.Size(113, 17);
|
||||||
this.casesensitive.TabIndex = 2;
|
this.findwholeword.TabIndex = 3;
|
||||||
this.casesensitive.Text = "Case sensitive";
|
this.findwholeword.Text = "Match whole word";
|
||||||
this.casesensitive.UseVisualStyleBackColor = true;
|
this.findwholeword.UseVisualStyleBackColor = true;
|
||||||
//
|
|
||||||
// wordonly
|
|
||||||
//
|
|
||||||
this.wordonly.AutoSize = true;
|
|
||||||
this.wordonly.Location = new System.Drawing.Point(93, 105);
|
|
||||||
this.wordonly.Name = "wordonly";
|
|
||||||
this.wordonly.Size = new System.Drawing.Size(105, 17);
|
|
||||||
this.wordonly.TabIndex = 3;
|
|
||||||
this.wordonly.Text = "Whole word only";
|
|
||||||
this.wordonly.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// replacetext
|
|
||||||
//
|
|
||||||
this.replacetext.Location = new System.Drawing.Point(93, 51);
|
|
||||||
this.replacetext.Name = "replacetext";
|
|
||||||
this.replacetext.Size = new System.Drawing.Size(152, 20);
|
|
||||||
this.replacetext.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// labelreplace
|
|
||||||
//
|
|
||||||
this.labelreplace.AutoSize = true;
|
|
||||||
this.labelreplace.Location = new System.Drawing.Point(14, 54);
|
|
||||||
this.labelreplace.Name = "labelreplace";
|
|
||||||
this.labelreplace.Size = new System.Drawing.Size(72, 13);
|
|
||||||
this.labelreplace.TabIndex = 6;
|
|
||||||
this.labelreplace.Text = "Replace with:";
|
|
||||||
//
|
//
|
||||||
// findnextbutton
|
// findnextbutton
|
||||||
//
|
//
|
||||||
this.findnextbutton.Location = new System.Drawing.Point(251, 17);
|
this.findnextbutton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.findnextbutton.Location = new System.Drawing.Point(79, 185);
|
||||||
this.findnextbutton.Name = "findnextbutton";
|
this.findnextbutton.Name = "findnextbutton";
|
||||||
this.findnextbutton.Size = new System.Drawing.Size(80, 25);
|
this.findnextbutton.Size = new System.Drawing.Size(100, 25);
|
||||||
this.findnextbutton.TabIndex = 4;
|
this.findnextbutton.TabIndex = 4;
|
||||||
this.findnextbutton.Text = "Find Next";
|
this.findnextbutton.Text = "Find Next";
|
||||||
this.findnextbutton.UseVisualStyleBackColor = true;
|
this.findnextbutton.UseVisualStyleBackColor = true;
|
||||||
|
@ -105,31 +99,19 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
//
|
//
|
||||||
// replaceallbutton
|
// replaceallbutton
|
||||||
//
|
//
|
||||||
this.replaceallbutton.Location = new System.Drawing.Point(337, 48);
|
this.replaceallbutton.Location = new System.Drawing.Point(185, 185);
|
||||||
this.replaceallbutton.Name = "replaceallbutton";
|
this.replaceallbutton.Name = "replaceallbutton";
|
||||||
this.replaceallbutton.Size = new System.Drawing.Size(86, 25);
|
this.replaceallbutton.Size = new System.Drawing.Size(100, 25);
|
||||||
this.replaceallbutton.TabIndex = 7;
|
this.replaceallbutton.TabIndex = 7;
|
||||||
this.replaceallbutton.Text = "Replace All";
|
this.replaceallbutton.Text = "Replace All";
|
||||||
this.replaceallbutton.UseVisualStyleBackColor = true;
|
this.replaceallbutton.UseVisualStyleBackColor = true;
|
||||||
this.replaceallbutton.Click += new System.EventHandler(this.replaceallbutton_Click);
|
this.replaceallbutton.Click += new System.EventHandler(this.replaceallbutton_Click);
|
||||||
//
|
//
|
||||||
// closebutton
|
|
||||||
//
|
|
||||||
this.closebutton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.closebutton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
||||||
this.closebutton.Location = new System.Drawing.Point(325, 96);
|
|
||||||
this.closebutton.Name = "closebutton";
|
|
||||||
this.closebutton.Size = new System.Drawing.Size(98, 25);
|
|
||||||
this.closebutton.TabIndex = 8;
|
|
||||||
this.closebutton.Text = "Close";
|
|
||||||
this.closebutton.UseVisualStyleBackColor = true;
|
|
||||||
this.closebutton.Click += new System.EventHandler(this.closebutton_Click);
|
|
||||||
//
|
|
||||||
// replacebutton
|
// replacebutton
|
||||||
//
|
//
|
||||||
this.replacebutton.Location = new System.Drawing.Point(251, 48);
|
this.replacebutton.Location = new System.Drawing.Point(79, 185);
|
||||||
this.replacebutton.Name = "replacebutton";
|
this.replacebutton.Name = "replacebutton";
|
||||||
this.replacebutton.Size = new System.Drawing.Size(80, 25);
|
this.replacebutton.Size = new System.Drawing.Size(100, 25);
|
||||||
this.replacebutton.TabIndex = 6;
|
this.replacebutton.TabIndex = 6;
|
||||||
this.replacebutton.Text = "Replace";
|
this.replacebutton.Text = "Replace";
|
||||||
this.replacebutton.UseVisualStyleBackColor = true;
|
this.replacebutton.UseVisualStyleBackColor = true;
|
||||||
|
@ -137,32 +119,212 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
//
|
//
|
||||||
// findpreviousbutton
|
// findpreviousbutton
|
||||||
//
|
//
|
||||||
this.findpreviousbutton.Location = new System.Drawing.Point(337, 17);
|
this.findpreviousbutton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.findpreviousbutton.Location = new System.Drawing.Point(185, 185);
|
||||||
this.findpreviousbutton.Name = "findpreviousbutton";
|
this.findpreviousbutton.Name = "findpreviousbutton";
|
||||||
this.findpreviousbutton.Size = new System.Drawing.Size(86, 25);
|
this.findpreviousbutton.Size = new System.Drawing.Size(100, 25);
|
||||||
this.findpreviousbutton.TabIndex = 5;
|
this.findpreviousbutton.TabIndex = 5;
|
||||||
this.findpreviousbutton.Text = "Find Previous";
|
this.findpreviousbutton.Text = "Find Previous";
|
||||||
this.findpreviousbutton.UseVisualStyleBackColor = true;
|
this.findpreviousbutton.UseVisualStyleBackColor = true;
|
||||||
this.findpreviousbutton.Click += new System.EventHandler(this.findpreviousbutton_Click);
|
this.findpreviousbutton.Click += new System.EventHandler(this.findpreviousbutton_Click);
|
||||||
//
|
//
|
||||||
|
// tabs
|
||||||
|
//
|
||||||
|
this.tabs.Controls.Add(this.tabfind);
|
||||||
|
this.tabs.Controls.Add(this.tabreplace);
|
||||||
|
this.tabs.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||||
|
this.tabs.ImageList = this.imagelist;
|
||||||
|
this.tabs.Location = new System.Drawing.Point(3, 3);
|
||||||
|
this.tabs.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.tabs.Name = "tabs";
|
||||||
|
this.tabs.Padding = new System.Drawing.Point(10, 3);
|
||||||
|
this.tabs.SelectedIndex = 0;
|
||||||
|
this.tabs.Size = new System.Drawing.Size(299, 242);
|
||||||
|
this.tabs.TabIndex = 9;
|
||||||
|
this.tabs.SelectedIndexChanged += new System.EventHandler(this.tabs_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// tabfind
|
||||||
|
//
|
||||||
|
this.tabfind.Controls.Add(this.findinbox);
|
||||||
|
this.tabfind.Controls.Add(this.findpreviousbutton);
|
||||||
|
this.tabfind.Controls.Add(this.label2);
|
||||||
|
this.tabfind.Controls.Add(this.findbox);
|
||||||
|
this.tabfind.Controls.Add(this.label1);
|
||||||
|
this.tabfind.Controls.Add(this.findnextbutton);
|
||||||
|
this.tabfind.Controls.Add(this.findmatchcase);
|
||||||
|
this.tabfind.Controls.Add(this.findwholeword);
|
||||||
|
this.tabfind.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||||
|
this.tabfind.ImageIndex = 0;
|
||||||
|
this.tabfind.Location = new System.Drawing.Point(4, 22);
|
||||||
|
this.tabfind.Name = "tabfind";
|
||||||
|
this.tabfind.Padding = new System.Windows.Forms.Padding(3, 16, 3, 3);
|
||||||
|
this.tabfind.Size = new System.Drawing.Size(291, 216);
|
||||||
|
this.tabfind.TabIndex = 0;
|
||||||
|
this.tabfind.Text = "Find";
|
||||||
|
this.tabfind.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// findinbox
|
||||||
|
//
|
||||||
|
this.findinbox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.findinbox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.findinbox.FormattingEnabled = true;
|
||||||
|
this.findinbox.Items.AddRange(new object[] {
|
||||||
|
"Current tab",
|
||||||
|
"All opened tabs (current script type)",
|
||||||
|
"All opened tabs (any script type)",
|
||||||
|
"All resources (current script type)",
|
||||||
|
"All resources (any script type)"});
|
||||||
|
this.findinbox.Location = new System.Drawing.Point(9, 80);
|
||||||
|
this.findinbox.Name = "findinbox";
|
||||||
|
this.findinbox.Size = new System.Drawing.Size(276, 21);
|
||||||
|
this.findinbox.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Location = new System.Drawing.Point(6, 62);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(45, 13);
|
||||||
|
this.label2.TabIndex = 2;
|
||||||
|
this.label2.Text = "Look in:";
|
||||||
|
//
|
||||||
|
// findbox
|
||||||
|
//
|
||||||
|
this.findbox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.findbox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
|
||||||
|
this.findbox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||||
|
this.findbox.FormattingEnabled = true;
|
||||||
|
this.findbox.Location = new System.Drawing.Point(9, 34);
|
||||||
|
this.findbox.Name = "findbox";
|
||||||
|
this.findbox.Size = new System.Drawing.Size(276, 21);
|
||||||
|
this.findbox.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// tabreplace
|
||||||
|
//
|
||||||
|
this.tabreplace.Controls.Add(this.replacebox);
|
||||||
|
this.tabreplace.Controls.Add(this.label5);
|
||||||
|
this.tabreplace.Controls.Add(this.replaceinbox);
|
||||||
|
this.tabreplace.Controls.Add(this.replacebutton);
|
||||||
|
this.tabreplace.Controls.Add(this.label3);
|
||||||
|
this.tabreplace.Controls.Add(this.replacefindbox);
|
||||||
|
this.tabreplace.Controls.Add(this.replaceallbutton);
|
||||||
|
this.tabreplace.Controls.Add(this.label4);
|
||||||
|
this.tabreplace.Controls.Add(this.replacematchcase);
|
||||||
|
this.tabreplace.Controls.Add(this.replacewholeword);
|
||||||
|
this.tabreplace.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||||
|
this.tabreplace.ImageIndex = 1;
|
||||||
|
this.tabreplace.Location = new System.Drawing.Point(4, 22);
|
||||||
|
this.tabreplace.Name = "tabreplace";
|
||||||
|
this.tabreplace.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tabreplace.Size = new System.Drawing.Size(291, 216);
|
||||||
|
this.tabreplace.TabIndex = 1;
|
||||||
|
this.tabreplace.Text = "Replace";
|
||||||
|
this.tabreplace.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// replacebox
|
||||||
|
//
|
||||||
|
this.replacebox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.replacebox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
|
||||||
|
this.replacebox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||||
|
this.replacebox.FormattingEnabled = true;
|
||||||
|
this.replacebox.Location = new System.Drawing.Point(9, 79);
|
||||||
|
this.replacebox.Name = "replacebox";
|
||||||
|
this.replacebox.Size = new System.Drawing.Size(276, 21);
|
||||||
|
this.replacebox.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
this.label5.AutoSize = true;
|
||||||
|
this.label5.Location = new System.Drawing.Point(6, 61);
|
||||||
|
this.label5.Name = "label5";
|
||||||
|
this.label5.Size = new System.Drawing.Size(72, 13);
|
||||||
|
this.label5.TabIndex = 10;
|
||||||
|
this.label5.Text = "Replace with:";
|
||||||
|
//
|
||||||
|
// replaceinbox
|
||||||
|
//
|
||||||
|
this.replaceinbox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.replaceinbox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.replaceinbox.FormattingEnabled = true;
|
||||||
|
this.replaceinbox.Items.AddRange(new object[] {
|
||||||
|
"Current tab",
|
||||||
|
"All opened tabs (current script type)",
|
||||||
|
"All opened tabs (any script type)",
|
||||||
|
"All resources (current script type)",
|
||||||
|
"All resources (any script type)"});
|
||||||
|
this.replaceinbox.Location = new System.Drawing.Point(9, 124);
|
||||||
|
this.replaceinbox.Name = "replaceinbox";
|
||||||
|
this.replaceinbox.Size = new System.Drawing.Size(276, 21);
|
||||||
|
this.replaceinbox.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
this.label3.AutoSize = true;
|
||||||
|
this.label3.Location = new System.Drawing.Point(6, 106);
|
||||||
|
this.label3.Name = "label3";
|
||||||
|
this.label3.Size = new System.Drawing.Size(45, 13);
|
||||||
|
this.label3.TabIndex = 7;
|
||||||
|
this.label3.Text = "Look in:";
|
||||||
|
//
|
||||||
|
// replacefindbox
|
||||||
|
//
|
||||||
|
this.replacefindbox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.replacefindbox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
|
||||||
|
this.replacefindbox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||||
|
this.replacefindbox.FormattingEnabled = true;
|
||||||
|
this.replacefindbox.Location = new System.Drawing.Point(9, 34);
|
||||||
|
this.replacefindbox.Name = "replacefindbox";
|
||||||
|
this.replacefindbox.Size = new System.Drawing.Size(276, 21);
|
||||||
|
this.replacefindbox.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
this.label4.AutoSize = true;
|
||||||
|
this.label4.Location = new System.Drawing.Point(6, 16);
|
||||||
|
this.label4.Name = "label4";
|
||||||
|
this.label4.Size = new System.Drawing.Size(56, 13);
|
||||||
|
this.label4.TabIndex = 4;
|
||||||
|
this.label4.Text = "Find what:";
|
||||||
|
//
|
||||||
|
// replacematchcase
|
||||||
|
//
|
||||||
|
this.replacematchcase.AutoSize = true;
|
||||||
|
this.replacematchcase.Location = new System.Drawing.Point(9, 160);
|
||||||
|
this.replacematchcase.Name = "replacematchcase";
|
||||||
|
this.replacematchcase.Size = new System.Drawing.Size(82, 17);
|
||||||
|
this.replacematchcase.TabIndex = 6;
|
||||||
|
this.replacematchcase.Text = "Match case";
|
||||||
|
this.replacematchcase.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// replacewholeword
|
||||||
|
//
|
||||||
|
this.replacewholeword.AutoSize = true;
|
||||||
|
this.replacewholeword.Location = new System.Drawing.Point(97, 160);
|
||||||
|
this.replacewholeword.Name = "replacewholeword";
|
||||||
|
this.replacewholeword.Size = new System.Drawing.Size(113, 17);
|
||||||
|
this.replacewholeword.TabIndex = 8;
|
||||||
|
this.replacewholeword.Text = "Match whole word";
|
||||||
|
this.replacewholeword.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// imagelist
|
||||||
|
//
|
||||||
|
this.imagelist.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imagelist.ImageStream")));
|
||||||
|
this.imagelist.TransparentColor = System.Drawing.Color.Transparent;
|
||||||
|
this.imagelist.Images.SetKeyName(0, "Search.png");
|
||||||
|
this.imagelist.Images.SetKeyName(1, "Replace.png");
|
||||||
|
//
|
||||||
// ScriptFindReplaceForm
|
// ScriptFindReplaceForm
|
||||||
//
|
//
|
||||||
this.AcceptButton = this.findnextbutton;
|
this.AcceptButton = this.findnextbutton;
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||||
this.CancelButton = this.closebutton;
|
this.ClientSize = new System.Drawing.Size(304, 247);
|
||||||
this.ClientSize = new System.Drawing.Size(436, 127);
|
this.Controls.Add(this.tabs);
|
||||||
this.Controls.Add(this.findpreviousbutton);
|
|
||||||
this.Controls.Add(this.replacebutton);
|
|
||||||
this.Controls.Add(this.closebutton);
|
|
||||||
this.Controls.Add(this.replaceallbutton);
|
|
||||||
this.Controls.Add(this.findnextbutton);
|
|
||||||
this.Controls.Add(this.labelreplace);
|
|
||||||
this.Controls.Add(this.replacetext);
|
|
||||||
this.Controls.Add(this.wordonly);
|
|
||||||
this.Controls.Add(this.casesensitive);
|
|
||||||
this.Controls.Add(this.findtext);
|
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
|
@ -172,23 +334,38 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
this.ShowInTaskbar = false;
|
this.ShowInTaskbar = false;
|
||||||
this.Text = "Find and Replace";
|
this.Text = "Find and Replace";
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScriptFindReplaceForm_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScriptFindReplaceForm_FormClosing);
|
||||||
|
this.tabs.ResumeLayout(false);
|
||||||
|
this.tabfind.ResumeLayout(false);
|
||||||
|
this.tabfind.PerformLayout();
|
||||||
|
this.tabreplace.ResumeLayout(false);
|
||||||
|
this.tabreplace.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.TextBox findtext;
|
private System.Windows.Forms.CheckBox findmatchcase;
|
||||||
private System.Windows.Forms.CheckBox casesensitive;
|
private System.Windows.Forms.CheckBox findwholeword;
|
||||||
private System.Windows.Forms.CheckBox wordonly;
|
|
||||||
private System.Windows.Forms.TextBox replacetext;
|
|
||||||
private System.Windows.Forms.Label labelreplace;
|
|
||||||
private System.Windows.Forms.Button findnextbutton;
|
private System.Windows.Forms.Button findnextbutton;
|
||||||
private System.Windows.Forms.Button replaceallbutton;
|
private System.Windows.Forms.Button replaceallbutton;
|
||||||
private System.Windows.Forms.Button closebutton;
|
|
||||||
private System.Windows.Forms.Button replacebutton;
|
private System.Windows.Forms.Button replacebutton;
|
||||||
private System.Windows.Forms.Button findpreviousbutton;
|
private System.Windows.Forms.Button findpreviousbutton;
|
||||||
|
private System.Windows.Forms.TabControl tabs;
|
||||||
|
private System.Windows.Forms.TabPage tabfind;
|
||||||
|
private System.Windows.Forms.TabPage tabreplace;
|
||||||
|
private System.Windows.Forms.ImageList imagelist;
|
||||||
|
private System.Windows.Forms.ComboBox findinbox;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.ComboBox findbox;
|
||||||
|
private System.Windows.Forms.ComboBox replacebox;
|
||||||
|
private System.Windows.Forms.Label label5;
|
||||||
|
private System.Windows.Forms.ComboBox replaceinbox;
|
||||||
|
private System.Windows.Forms.Label label3;
|
||||||
|
private System.Windows.Forms.ComboBox replacefindbox;
|
||||||
|
private System.Windows.Forms.Label label4;
|
||||||
|
private System.Windows.Forms.CheckBox replacematchcase;
|
||||||
|
private System.Windows.Forms.CheckBox replacewholeword;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,7 +17,11 @@
|
||||||
#region ================== Namespaces
|
#region ================== Namespaces
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using CodeImp.DoomBuilder.Controls;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -25,6 +29,12 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
{
|
{
|
||||||
public partial class ScriptFindReplaceForm : DelayedForm
|
public partial class ScriptFindReplaceForm : DelayedForm
|
||||||
{
|
{
|
||||||
|
#region ================== Constants
|
||||||
|
|
||||||
|
private const int MAX_DROPDOWN_ITEMS = 20;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region ================== Variables
|
#region ================== Variables
|
||||||
|
|
||||||
private bool appclose;
|
private bool appclose;
|
||||||
|
@ -40,10 +50,16 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
canreplace = value;
|
canreplace = value;
|
||||||
labelreplace.Enabled = canreplace;
|
|
||||||
replacetext.Enabled = canreplace;
|
if(!canreplace)
|
||||||
replacebutton.Enabled = canreplace;
|
{
|
||||||
replaceallbutton.Enabled = canreplace;
|
if(tabs.TabPages.Contains(tabreplace))
|
||||||
|
tabs.TabPages.Remove(tabreplace);
|
||||||
|
}
|
||||||
|
else if(!tabs.TabPages.Contains(tabreplace))
|
||||||
|
{
|
||||||
|
tabs.TabPages.Add(tabreplace);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +71,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
public ScriptFindReplaceForm()
|
public ScriptFindReplaceForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
LoadSettings(); //mxd
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -65,10 +82,28 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
private FindReplaceOptions MakeOptions()
|
private FindReplaceOptions MakeOptions()
|
||||||
{
|
{
|
||||||
FindReplaceOptions options = new FindReplaceOptions();
|
FindReplaceOptions options = new FindReplaceOptions();
|
||||||
options.FindText = findtext.Text;
|
|
||||||
options.CaseSensitive = casesensitive.Checked;
|
if(tabs.SelectedTab == tabfind)
|
||||||
options.WholeWord = wordonly.Checked;
|
{
|
||||||
options.ReplaceWith = replacetext.Text;
|
options.FindText = findbox.Text;
|
||||||
|
options.CaseSensitive = findmatchcase.Checked;
|
||||||
|
options.WholeWord = findwholeword.Checked;
|
||||||
|
options.ReplaceWith = null;
|
||||||
|
options.SearchMode = (FindReplaceSearchMode)findinbox.SelectedIndex;
|
||||||
|
}
|
||||||
|
else if(tabs.SelectedTab == tabreplace)
|
||||||
|
{
|
||||||
|
options.FindText = replacefindbox.Text;
|
||||||
|
options.CaseSensitive = replacematchcase.Checked;
|
||||||
|
options.WholeWord = replacewholeword.Checked;
|
||||||
|
options.ReplaceWith = replacebox.Text;
|
||||||
|
options.SearchMode = (FindReplaceSearchMode)replaceinbox.SelectedIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("Unsupported tab type");
|
||||||
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,8 +117,114 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
// This sets the text to find
|
// This sets the text to find
|
||||||
public void SetFindText(string text)
|
public void SetFindText(string text)
|
||||||
{
|
{
|
||||||
findtext.Text = text;
|
ComboBox target; //mxd
|
||||||
findtext.SelectAll();
|
|
||||||
|
if(tabs.SelectedTab == tabfind)
|
||||||
|
target = findbox;
|
||||||
|
else if(tabs.SelectedTab == tabreplace)
|
||||||
|
target = replacefindbox;
|
||||||
|
else
|
||||||
|
throw new NotImplementedException("Unsupported tab type");
|
||||||
|
|
||||||
|
target.Text = text;
|
||||||
|
target.SelectAll();
|
||||||
|
|
||||||
|
//mxd. Add to combobox
|
||||||
|
AddComboboxText(target, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
private static void AddComboboxText(ComboBox target, string text)
|
||||||
|
{
|
||||||
|
if(!string.IsNullOrEmpty(text) && !target.Items.Contains(text))
|
||||||
|
{
|
||||||
|
target.Items.Insert(0, text);
|
||||||
|
while(target.Items.Count > MAX_DROPDOWN_ITEMS)
|
||||||
|
{
|
||||||
|
target.Items.RemoveAt(target.Items.Count - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
private void LoadSettings()
|
||||||
|
{
|
||||||
|
// Load generic search settings
|
||||||
|
bool matchcase = General.Settings.ReadSetting("windows." + configname + ".matchcase", false);
|
||||||
|
bool matchwholeword = General.Settings.ReadSetting("windows." + configname + ".matchwholeword", false);
|
||||||
|
int searchmode = General.Settings.ReadSetting("windows." + configname + ".searchmode", (int)FindReplaceSearchMode.CURRENT_FILE);
|
||||||
|
|
||||||
|
// Load find settings
|
||||||
|
string findtext = General.Settings.ReadSetting("windows." + configname + ".findtext", string.Empty);
|
||||||
|
List<string> findtexts = new List<string>();
|
||||||
|
IDictionary findtextdic = General.Settings.ReadSetting("windows." + configname + ".findtexts", new Hashtable());
|
||||||
|
foreach(DictionaryEntry cde in findtextdic)
|
||||||
|
findtexts.Add(cde.Value.ToString());
|
||||||
|
|
||||||
|
// Load replace settings
|
||||||
|
string replacetext = General.Settings.ReadSetting("windows." + configname + ".replacetext", string.Empty);
|
||||||
|
List<string> replacetexts = new List<string>();
|
||||||
|
IDictionary replacetextdic = General.Settings.ReadSetting("windows." + configname + ".replacetexts", new Hashtable());
|
||||||
|
foreach(DictionaryEntry cde in replacetextdic)
|
||||||
|
replacetexts.Add(cde.Value.ToString());
|
||||||
|
|
||||||
|
// Apply find settings...
|
||||||
|
findbox.MaxDropDownItems = MAX_DROPDOWN_ITEMS;
|
||||||
|
findbox.Text = findtext;
|
||||||
|
findbox.SelectAll();
|
||||||
|
findbox.Items.AddRange(findtexts.ToArray());
|
||||||
|
findinbox.SelectedIndex = searchmode;
|
||||||
|
findmatchcase.Checked = matchcase;
|
||||||
|
findwholeword.Checked = matchwholeword;
|
||||||
|
|
||||||
|
// Apply replace settings...
|
||||||
|
replacefindbox.MaxDropDownItems = MAX_DROPDOWN_ITEMS;
|
||||||
|
replacefindbox.Text = findtext;
|
||||||
|
replacefindbox.SelectAll();
|
||||||
|
replacefindbox.Items.AddRange(findtexts.ToArray());
|
||||||
|
replacebox.MaxDropDownItems = MAX_DROPDOWN_ITEMS;
|
||||||
|
replacebox.Text = replacetext;
|
||||||
|
replacebox.Items.AddRange(replacetexts.ToArray());
|
||||||
|
replaceinbox.SelectedIndex = searchmode;
|
||||||
|
replacematchcase.Checked = matchcase;
|
||||||
|
replacewholeword.Checked = matchwholeword;
|
||||||
|
|
||||||
|
// Set selected tab
|
||||||
|
tabs.SelectedIndex = General.Clamp(General.Settings.ReadSetting("windows." + configname + ".selectedtab", 0), 0, tabs.TabCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
private void SaveSettings()
|
||||||
|
{
|
||||||
|
// Save generic search settings
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".matchcase", findmatchcase.Checked);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".matchwholeword", findwholeword.Checked);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".searchmode", findinbox.SelectedIndex);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".selectedtab", tabs.SelectedIndex);
|
||||||
|
|
||||||
|
// Save find settings
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".findtext", findbox.Text);
|
||||||
|
ListDictionary finddata = new ListDictionary();
|
||||||
|
for(int i = 0; i < findbox.Items.Count; i++)
|
||||||
|
{
|
||||||
|
finddata.Add("findtext" + i, findbox.Items[i].ToString());
|
||||||
|
}
|
||||||
|
if(finddata.Count > 0)
|
||||||
|
{
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".findtexts", finddata);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save replace settings
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".replacetext", replacebox.Text);
|
||||||
|
ListDictionary replacedata = new ListDictionary();
|
||||||
|
for(int i = 0; i < replacebox.Items.Count; i++)
|
||||||
|
{
|
||||||
|
replacedata.Add("replacetext" + i, replacebox.Items[i].ToString());
|
||||||
|
}
|
||||||
|
if(replacedata.Count > 0)
|
||||||
|
{
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".replacetexts", replacedata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -93,6 +234,8 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
// Form is closing
|
// Form is closing
|
||||||
private void ScriptFindReplaceForm_FormClosing(object sender, FormClosingEventArgs e)
|
private void ScriptFindReplaceForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
|
SaveSettings(); //mxd
|
||||||
|
|
||||||
if(!appclose)
|
if(!appclose)
|
||||||
{
|
{
|
||||||
General.Map.ScriptEditor.Editor.CloseFindReplace(true);
|
General.Map.ScriptEditor.Editor.CloseFindReplace(true);
|
||||||
|
@ -102,34 +245,129 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
// Find Next
|
// Find Next
|
||||||
private void findnextbutton_Click(object sender, EventArgs e)
|
private void findnextbutton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
General.Map.ScriptEditor.Editor.FindNext(MakeOptions());
|
FindReplaceOptions options = MakeOptions(); //mxd
|
||||||
|
AddComboboxText(findbox, options.FindText); //mxd
|
||||||
|
General.Map.ScriptEditor.Editor.FindNext(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find Previous (mxd)
|
// Find Previous (mxd)
|
||||||
private void findpreviousbutton_Click(object sender, EventArgs e)
|
private void findpreviousbutton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
General.Map.ScriptEditor.Editor.FindPrevious(MakeOptions());
|
FindReplaceOptions options = MakeOptions(); //mxd
|
||||||
|
AddComboboxText(findbox, options.FindText); //mxd
|
||||||
|
General.Map.ScriptEditor.Editor.FindPrevious(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace
|
//mxd. Replace
|
||||||
private void replacebutton_Click(object sender, EventArgs e)
|
private void replacebutton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FindReplaceOptions options = MakeOptions();
|
var editor = General.Map.ScriptEditor.Editor;
|
||||||
|
|
||||||
General.Map.ScriptEditor.Editor.Replace(options);
|
FindReplaceOptions options = MakeOptions();
|
||||||
General.Map.ScriptEditor.Editor.FindNext(options);
|
AddComboboxText(replacefindbox, options.FindText);
|
||||||
|
AddComboboxText(replacebox, options.ReplaceWith);
|
||||||
|
|
||||||
|
ScriptDocumentTab curtab = editor.ActiveTab;
|
||||||
|
if(curtab == null) return;
|
||||||
|
|
||||||
|
// Search from selection start, then replace
|
||||||
|
if(!curtab.FindNext(options, true) || !editor.Replace(options))
|
||||||
|
{
|
||||||
|
editor.DisplayStatus(ScriptStatusType.Warning, "Can't find any occurrence of \"" + options.FindText + "\".");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace All
|
// Find & show next match
|
||||||
|
curtab.FindNext(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
//mxd. Replace All
|
||||||
private void replaceallbutton_Click(object sender, EventArgs e)
|
private void replaceallbutton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
General.Map.ScriptEditor.Editor.ReplaceAll(MakeOptions());
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close
|
// Replace loop
|
||||||
private void closebutton_Click(object sender, EventArgs e)
|
int replacements = 0;
|
||||||
|
while(editor.FindNext(options) && editor.Replace(options))
|
||||||
|
replacements++;
|
||||||
|
|
||||||
|
// Show result
|
||||||
|
if(replacements == 0)
|
||||||
{
|
{
|
||||||
General.Map.ScriptEditor.Editor.CloseFindReplace(false);
|
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
|
||||||
|
private void tabs_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Transfer settings...
|
||||||
|
if(tabs.SelectedTab == tabfind)
|
||||||
|
{
|
||||||
|
findbox.Text = replacefindbox.Text;
|
||||||
|
findbox.Items.Clear();
|
||||||
|
if(replacefindbox.Items.Count > 0)
|
||||||
|
{
|
||||||
|
string[] items = new string[replacefindbox.Items.Count];
|
||||||
|
replacefindbox.Items.CopyTo(items, 0);
|
||||||
|
findbox.Items.AddRange(items);
|
||||||
|
}
|
||||||
|
findbox.SelectAll();
|
||||||
|
|
||||||
|
findinbox.SelectedIndex = replaceinbox.SelectedIndex;
|
||||||
|
|
||||||
|
findmatchcase.Checked = replacematchcase.Checked;
|
||||||
|
findwholeword.Checked = replacewholeword.Checked;
|
||||||
|
}
|
||||||
|
else if(tabs.SelectedTab == tabreplace)
|
||||||
|
{
|
||||||
|
replacefindbox.Text = findbox.Text;
|
||||||
|
replacefindbox.Items.Clear();
|
||||||
|
if(findbox.Items.Count > 0)
|
||||||
|
{
|
||||||
|
string[] items = new string[findbox.Items.Count];
|
||||||
|
findbox.Items.CopyTo(items, 0);
|
||||||
|
replacefindbox.Items.AddRange(items);
|
||||||
|
}
|
||||||
|
replacefindbox.SelectAll();
|
||||||
|
|
||||||
|
replaceinbox.SelectedIndex = findinbox.SelectedIndex;
|
||||||
|
|
||||||
|
replacematchcase.Checked = findmatchcase.Checked;
|
||||||
|
replacewholeword.Checked = findwholeword.Checked;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("Unsupported tab type");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -117,16 +117,53 @@
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="imagelist.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>True</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
|
||||||
<metadata name="findtext.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="replacetext.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="labelreplace.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>True</value>
|
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<data name="imagelist.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>
|
||||||
|
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
|
||||||
|
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||||
|
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAc
|
||||||
|
CQAAAk1TRnQBSQFMAgEBAgEAARgBAAEYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||||
|
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||||
|
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||||
|
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||||
|
AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm
|
||||||
|
AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM
|
||||||
|
AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA
|
||||||
|
ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz
|
||||||
|
AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQIAATMBmQEzAQABMwGZ
|
||||||
|
AWYBAAEzApkBAAEzAZkBzAEAATMBmQH/AQABMwHMAgABMwHMATMBAAEzAcwBZgEAATMBzAGZAQABMwLM
|
||||||
|
AQABMwHMAf8BAAEzAf8BMwEAATMB/wFmAQABMwH/AZkBAAEzAf8BzAEAATMC/wEAAWYDAAFmAQABMwEA
|
||||||
|
AWYBAAFmAQABZgEAAZkBAAFmAQABzAEAAWYBAAH/AQABZgEzAgABZgIzAQABZgEzAWYBAAFmATMBmQEA
|
||||||
|
AWYBMwHMAQABZgEzAf8BAAJmAgACZgEzAQADZgEAAmYBmQEAAmYBzAEAAWYBmQIAAWYBmQEzAQABZgGZ
|
||||||
|
AWYBAAFmApkBAAFmAZkBzAEAAWYBmQH/AQABZgHMAgABZgHMATMBAAFmAcwBmQEAAWYCzAEAAWYBzAH/
|
||||||
|
AQABZgH/AgABZgH/ATMBAAFmAf8BmQEAAWYB/wHMAQABzAEAAf8BAAH/AQABzAEAApkCAAGZATMBmQEA
|
||||||
|
AZkBAAGZAQABmQEAAcwBAAGZAwABmQIzAQABmQEAAWYBAAGZATMBzAEAAZkBAAH/AQABmQFmAgABmQFm
|
||||||
|
ATMBAAGZATMBZgEAAZkBZgGZAQABmQFmAcwBAAGZATMB/wEAApkBMwEAApkBZgEAA5kBAAKZAcwBAAKZ
|
||||||
|
Af8BAAGZAcwCAAGZAcwBMwEAAWYBzAFmAQABmQHMAZkBAAGZAswBAAGZAcwB/wEAAZkB/wIAAZkB/wEz
|
||||||
|
AQABmQHMAWYBAAGZAf8BmQEAAZkB/wHMAQABmQL/AQABzAMAAZkBAAEzAQABzAEAAWYBAAHMAQABmQEA
|
||||||
|
AcwBAAHMAQABmQEzAgABzAIzAQABzAEzAWYBAAHMATMBmQEAAcwBMwHMAQABzAEzAf8BAAHMAWYCAAHM
|
||||||
|
AWYBMwEAAZkCZgEAAcwBZgGZAQABzAFmAcwBAAGZAWYB/wEAAcwBmQIAAcwBmQEzAQABzAGZAWYBAAHM
|
||||||
|
ApkBAAHMAZkBzAEAAcwBmQH/AQACzAIAAswBMwEAAswBZgEAAswBmQEAA8wBAALMAf8BAAHMAf8CAAHM
|
||||||
|
Af8BMwEAAZkB/wFmAQABzAH/AZkBAAHMAf8BzAEAAcwC/wEAAcwBAAEzAQAB/wEAAWYBAAH/AQABmQEA
|
||||||
|
AcwBMwIAAf8CMwEAAf8BMwFmAQAB/wEzAZkBAAH/ATMBzAEAAf8BMwH/AQAB/wFmAgAB/wFmATMBAAHM
|
||||||
|
AmYBAAH/AWYBmQEAAf8BZgHMAQABzAFmAf8BAAH/AZkCAAH/AZkBMwEAAf8BmQFmAQAB/wKZAQAB/wGZ
|
||||||
|
AcwBAAH/AZkB/wEAAf8BzAIAAf8BzAEzAQAB/wHMAWYBAAH/AcwBmQEAAf8CzAEAAf8BzAH/AQAC/wEz
|
||||||
|
AQABzAH/AWYBAAL/AZkBAAL/AcwBAAJmAf8BAAFmAf8BZgEAAWYC/wEAAf8CZgEAAf8BZgH/AQAC/wFm
|
||||||
|
AQABIQEAAaUBAANfAQADdwEAA4YBAAOWAQADywEAA7IBAAPXAQAD3QEAA+MBAAPqAQAD8QEAA/gBAAHw
|
||||||
|
AfsB/wEAAaQCoAEAA4ADAAH/AgAB/wMAAv8BAAH/AwAB/wEAAf8BAAL/AgAD/wsAAv89AAH/Ae8B7QHz
|
||||||
|
BgAN/ygAAf8BBwEVARIB9wH/BQAD/wGnAfIB/wEHAhUB8AHrAewB/ygAAfACFAHtAQcB/wUAAf8BtAGG
|
||||||
|
Ac8BrQEAAeoB7wEAAZIB6gH/KAAB8gHqARMB7QHvAf8GAAEJAfQBAAGnAfQBAAHsAQcBAAHwAW0lAAH0
|
||||||
|
AfABvAHwAesBEwHtAe8B9AcAAfQFAAH/AuwB9wFtJAABBwHsAe8BvAHxAe8B7AHvAfIGAAH3BEMB8QQA
|
||||||
|
AfIB7wHrIwABvAHtAfcBtAIJAfIB8AG8CAABEgG8AQABkgESAgAC7wEAAe8B7CIAAf8B7AH3AbQB3AEJ
|
||||||
|
ARkBCQHyAbwIAAFtAbwBAAG8AW0CAAH0A+wB8CIAAfMBkgG7AwkB3QEZAbwB7wH/BwABbQH3AQAB8AFt
|
||||||
|
KQAB8wHvAbwBGQQJAbsB9wH/BwAB6wGSAusB8CkAAf8BBwHyAfEBGQEJAdwBtAH3AQcIAAHrAfAtAAHx
|
||||||
|
Af8B8gEJAbsBtAH3AewB9AgAAewB8C4AAvEB8gG8Ae8B7AHyCAABBwHsAZIB/y4AAfQB8QG8AfEB/3gA
|
||||||
|
AUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEBBQABgBcAA/8BAAH/Ac8C/wQAAf8BhwHgBQAB/wED
|
||||||
|
AeAFAAH/AQMB4AGRBAAB/gEHAeQBkwQAAeABDwHvAYMEAAHAAR8BgQHjBAABgAE/AckBkwUAAT8ByQGD
|
||||||
|
BQABHwHJAf8FAAEfAcEB/wUAAT8BzwH/BAABgAE/Ac8B/wQAAcABfwGHAf8EAAHgA/8EAAT/BAAL
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -40,20 +40,6 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
private readonly List<string> renderstyles; //mxd
|
private readonly List<string> renderstyles; //mxd
|
||||||
private readonly List<string> portalrenderstyles; //mxd
|
private readonly List<string> portalrenderstyles; //mxd
|
||||||
|
|
||||||
//mxd. Persistent settings
|
|
||||||
private static bool linkCeilingScale;
|
|
||||||
private static bool linkFloorScale;
|
|
||||||
private static bool useFloorLineAngles;
|
|
||||||
private static bool useCeilLineAngles;
|
|
||||||
private static bool useFloorSlopeLineAngles;
|
|
||||||
private static bool useCeilSlopeLineAngles;
|
|
||||||
private static SlopePivotMode ceilpivotmode = SlopePivotMode.LOCAL;
|
|
||||||
private static SlopePivotMode floorpivotmode = SlopePivotMode.LOCAL;
|
|
||||||
|
|
||||||
//mxd. Window setup stuff
|
|
||||||
private static Point location = Point.Empty;
|
|
||||||
private static int activetab;
|
|
||||||
|
|
||||||
//mxd. Slope pivots
|
//mxd. Slope pivots
|
||||||
private Vector2D globalslopepivot;
|
private Vector2D globalslopepivot;
|
||||||
private Dictionary<Sector, Vector2D> slopepivots;
|
private Dictionary<Sector, Vector2D> slopepivots;
|
||||||
|
@ -176,12 +162,11 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
//mxd. Widow setup
|
//mxd. Load settings
|
||||||
if(location != Point.Empty)
|
if(General.Settings.StoreSelectedEditTab)
|
||||||
{
|
{
|
||||||
this.StartPosition = FormStartPosition.Manual;
|
int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0);
|
||||||
this.Location = location;
|
tabs.SelectTab(activetab);
|
||||||
if(General.Settings.StoreSelectedEditTab && activetab > 0) tabs.SelectTab(activetab);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill flags list
|
// Fill flags list
|
||||||
|
@ -276,18 +261,18 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
// Set steps for brightness field
|
// Set steps for brightness field
|
||||||
brightness.StepValues = General.Map.Config.BrightnessLevels;
|
brightness.StepValues = General.Map.Config.BrightnessLevels;
|
||||||
|
|
||||||
// Value linking
|
// Apply settings
|
||||||
ceilScale.LinkValues = linkCeilingScale;
|
ceilScale.LinkValues = General.Settings.ReadSetting("windows." + configname + ".linkceilingscale", false);
|
||||||
floorScale.LinkValues = linkFloorScale;
|
floorScale.LinkValues = General.Settings.ReadSetting("windows." + configname + ".linkfloorscale", false);
|
||||||
|
|
||||||
cbUseCeilLineAngles.Checked = useCeilLineAngles;
|
cbUseCeilLineAngles.Checked = General.Settings.ReadSetting("windows." + configname + ".useceillineangles", false);
|
||||||
cbUseFloorLineAngles.Checked = useFloorLineAngles;
|
cbUseFloorLineAngles.Checked = General.Settings.ReadSetting("windows." + configname + ".usefloorlineangles", false);
|
||||||
|
|
||||||
floorslopecontrol.UseLineAngles = useFloorSlopeLineAngles;
|
ceilingslopecontrol.UseLineAngles = General.Settings.ReadSetting("windows." + configname + ".useceilslopelineangles", false);
|
||||||
ceilingslopecontrol.UseLineAngles = useCeilSlopeLineAngles;
|
floorslopecontrol.UseLineAngles = General.Settings.ReadSetting("windows." + configname + ".usefloorslopelineangles", false);
|
||||||
|
|
||||||
floorslopecontrol.PivotMode = floorpivotmode;
|
ceilingslopecontrol.PivotMode = (SlopePivotMode)General.Settings.ReadSetting("windows." + configname + ".ceilpivotmode", (int)SlopePivotMode.LOCAL);
|
||||||
ceilingslopecontrol.PivotMode = ceilpivotmode;
|
floorslopecontrol.PivotMode = (SlopePivotMode)General.Settings.ReadSetting("windows." + configname + ".floorpivotmode", (int)SlopePivotMode.LOCAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -562,10 +547,10 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
|
|
||||||
//mxd. Angle steps
|
//mxd. Angle steps
|
||||||
anglesteps.Sort();
|
anglesteps.Sort();
|
||||||
if(useCeilLineAngles) ceilRotation.StepValues = anglesteps;
|
if(cbUseCeilLineAngles.Checked) ceilRotation.StepValues = anglesteps;
|
||||||
if(useFloorLineAngles) floorRotation.StepValues = anglesteps;
|
if(cbUseFloorLineAngles.Checked) floorRotation.StepValues = anglesteps;
|
||||||
if(useCeilSlopeLineAngles) ceilingslopecontrol.StepValues = anglesteps;
|
if(ceilingslopecontrol.UseLineAngles) ceilingslopecontrol.StepValues = anglesteps;
|
||||||
if(useFloorSlopeLineAngles) floorslopecontrol.StepValues = anglesteps;
|
if(floorslopecontrol.UseLineAngles) floorslopecontrol.StepValues = anglesteps;
|
||||||
|
|
||||||
//mxd. Comments
|
//mxd. Comments
|
||||||
commenteditor.FinishSetup();
|
commenteditor.FinishSetup();
|
||||||
|
@ -873,16 +858,6 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
// Update the used textures
|
// Update the used textures
|
||||||
General.Map.Data.UpdateUsedTextures();
|
General.Map.Data.UpdateUsedTextures();
|
||||||
|
|
||||||
// Store value linking
|
|
||||||
linkCeilingScale = ceilScale.LinkValues;
|
|
||||||
linkFloorScale = floorScale.LinkValues;
|
|
||||||
useCeilLineAngles = cbUseCeilLineAngles.Checked;
|
|
||||||
useFloorLineAngles = cbUseFloorLineAngles.Checked;
|
|
||||||
useCeilSlopeLineAngles = ceilingslopecontrol.UseLineAngles;
|
|
||||||
useFloorSlopeLineAngles = floorslopecontrol.UseLineAngles;
|
|
||||||
floorpivotmode = floorslopecontrol.PivotMode;
|
|
||||||
ceilpivotmode = ceilingslopecontrol.PivotMode;
|
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
General.Map.IsChanged = true;
|
General.Map.IsChanged = true;
|
||||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); //mxd
|
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); //mxd
|
||||||
|
@ -908,8 +883,20 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
//mxd
|
//mxd
|
||||||
private void SectorEditFormUDMF_FormClosing(object sender, FormClosingEventArgs e)
|
private void SectorEditFormUDMF_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
location = this.Location;
|
// Save settings
|
||||||
activetab = tabs.SelectedIndex;
|
General.Settings.WriteSetting("windows." + configname + ".activetab", tabs.SelectedIndex);
|
||||||
|
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".linkceilingscale", ceilScale.LinkValues);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".linkfloorscale", floorScale.LinkValues);
|
||||||
|
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".useceillineangles", cbUseCeilLineAngles.Checked);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".usefloorlineangles", cbUseFloorLineAngles.Checked);
|
||||||
|
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".useceilslopelineangles", ceilingslopecontrol.UseLineAngles);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".usefloorslopelineangles", floorslopecontrol.UseLineAngles);
|
||||||
|
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".ceilpivotmode", (int)ceilingslopecontrol.PivotMode);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".floorpivotmode", (int)floorslopecontrol.PivotMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SectorEditFormUDMF_HelpRequested(object sender, HelpEventArgs hlpevent)
|
private void SectorEditFormUDMF_HelpRequested(object sender, HelpEventArgs hlpevent)
|
||||||
|
|
|
@ -48,16 +48,12 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
private bool preventchanges;
|
private bool preventchanges;
|
||||||
private bool preventmapchange; //mxd
|
private bool preventmapchange; //mxd
|
||||||
private bool undocreated; //mxd
|
private bool undocreated; //mxd
|
||||||
private static bool useabsoluteheight; //mxd
|
|
||||||
private List<ThingProperties> thingprops; //mxd
|
private List<ThingProperties> thingprops; //mxd
|
||||||
private readonly string[] renderstyles; //mxd
|
private readonly string[] renderstyles; //mxd
|
||||||
private Dictionary<string, string> flagsrename; //mxd
|
private Dictionary<string, string> flagsrename; //mxd
|
||||||
|
|
||||||
//mxd. Window setup stuff
|
|
||||||
private static int activetab;
|
|
||||||
|
|
||||||
//mxd. Persistent settings
|
//mxd. Persistent settings
|
||||||
private static bool linkscale;
|
private bool useabsoluteheight;
|
||||||
|
|
||||||
private struct ThingProperties //mxd
|
private struct ThingProperties //mxd
|
||||||
{
|
{
|
||||||
|
@ -99,8 +95,15 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
// Initialize
|
// Initialize
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
//mxd. Load settings
|
||||||
|
useabsoluteheight = General.Settings.ReadSetting("windows." + configname + ".useabsoluteheight", false);
|
||||||
|
|
||||||
//mxd. Widow setup
|
//mxd. Widow setup
|
||||||
if(General.Settings.StoreSelectedEditTab && activetab > 0) tabs.SelectTab(activetab);
|
if(General.Settings.StoreSelectedEditTab)
|
||||||
|
{
|
||||||
|
int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0);
|
||||||
|
tabs.SelectTab(activetab);
|
||||||
|
}
|
||||||
|
|
||||||
// Fill flags list
|
// Fill flags list
|
||||||
foreach(KeyValuePair<string, string> tf in General.Map.Config.ThingFlags)
|
foreach(KeyValuePair<string, string> tf in General.Map.Config.ThingFlags)
|
||||||
|
@ -147,7 +150,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
anglecontrol.DoomAngleClamping = General.Map.Config.DoomThingRotationAngles;
|
anglecontrol.DoomAngleClamping = General.Map.Config.DoomThingRotationAngles;
|
||||||
|
|
||||||
// Value linking
|
// Value linking
|
||||||
scale.LinkValues = linkscale;
|
scale.LinkValues = General.Settings.ReadSetting("windows." + configname + ".linkscale", false);
|
||||||
|
|
||||||
// Setup types list
|
// Setup types list
|
||||||
thingtype.Setup();
|
thingtype.Setup();
|
||||||
|
@ -571,9 +574,6 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
General.Settings.DefaultThingAngle = Angle2D.DegToRad((float)angle.GetResult((int)Angle2D.RadToDeg(General.Settings.DefaultThingAngle) - 90) + 90);
|
General.Settings.DefaultThingAngle = Angle2D.DegToRad((float)angle.GetResult((int)Angle2D.RadToDeg(General.Settings.DefaultThingAngle) - 90) + 90);
|
||||||
General.Settings.SetDefaultThingFlags(defaultflags);
|
General.Settings.SetDefaultThingFlags(defaultflags);
|
||||||
|
|
||||||
// Store value linking
|
|
||||||
linkscale = scale.LinkValues;
|
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
General.Map.IsChanged = true;
|
General.Map.IsChanged = true;
|
||||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); //mxd
|
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); //mxd
|
||||||
|
@ -632,7 +632,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
//mxd
|
//mxd
|
||||||
private void ThingEditFormUDMF_Shown(object sender, EventArgs e)
|
private void ThingEditFormUDMF_Shown(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if(activetab == 0)
|
if(tabs.SelectedIndex == 0)
|
||||||
{
|
{
|
||||||
thingtype.Focus();
|
thingtype.Focus();
|
||||||
thingtype.FocusTextbox();
|
thingtype.FocusTextbox();
|
||||||
|
@ -642,7 +642,10 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
//mxd
|
//mxd
|
||||||
private void ThingEditForm_FormClosing(object sender, FormClosingEventArgs e)
|
private void ThingEditForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
activetab = tabs.SelectedIndex;
|
// Save settings
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".activetab", tabs.SelectedIndex);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".linkscale", scale.LinkValues);
|
||||||
|
General.Settings.WriteSetting("windows." + configname + ".useabsoluteheight", useabsoluteheight);
|
||||||
General.Settings.WriteSetting("windows." + configname + ".customfieldsshowfixed", !hidefixedfields.Checked);
|
General.Settings.WriteSetting("windows." + configname + ".customfieldsshowfixed", !hidefixedfields.Checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,6 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
private bool undocreated; //mxd
|
private bool undocreated; //mxd
|
||||||
private List<VertexProperties> vertexprops; //mxd
|
private List<VertexProperties> vertexprops; //mxd
|
||||||
|
|
||||||
//mxd. Window setup stuff
|
|
||||||
private static Point location = Point.Empty;
|
|
||||||
private static int activetab;
|
|
||||||
|
|
||||||
private struct VertexProperties //mxd
|
private struct VertexProperties //mxd
|
||||||
{
|
{
|
||||||
public readonly float X;
|
public readonly float X;
|
||||||
|
@ -77,12 +73,11 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
//mxd. Widow setup
|
//mxd. Load settings
|
||||||
if(location != Point.Empty)
|
if(General.Settings.StoreSelectedEditTab)
|
||||||
{
|
{
|
||||||
this.StartPosition = FormStartPosition.Manual;
|
int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0);
|
||||||
this.Location = location;
|
tabs.SelectTab(activetab);
|
||||||
if(General.Settings.StoreSelectedEditTab && activetab > 0 && activetab < tabs.TabCount) tabs.SelectTab(activetab);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(General.Map.FormatInterface.HasCustomFields) //mxd
|
if(General.Map.FormatInterface.HasCustomFields) //mxd
|
||||||
|
@ -377,8 +372,8 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
//mxd
|
//mxd
|
||||||
private void VertexEditForm_FormClosing(object sender, FormClosingEventArgs e)
|
private void VertexEditForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
location = this.Location;
|
// Save settings
|
||||||
activetab = tabs.SelectedIndex;
|
General.Settings.WriteSetting("windows." + configname + ".activetab", tabs.SelectedIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Help requested
|
// Help requested
|
||||||
|
|
Loading…
Reference in a new issue