Readd search menu to byml/aamp text editors.

This commit is contained in:
KillzXGaming 2020-03-03 17:24:59 -05:00
parent 00a48d4b4a
commit 95a462ebd3
3 changed files with 16 additions and 4 deletions

View file

@ -26,6 +26,8 @@ namespace FirstPlugin.Forms
return new List<IFileFormat>() { AampFile };
}
public void BeforeFileSaved() { }
private TextEditor textEditor;
public AampEditorBase(AAMP aamp, bool IsSaveDialog)
{
@ -48,7 +50,7 @@ namespace FirstPlugin.Forms
textEditor = new TextEditor();
textEditor.Dock = DockStyle.Fill;
textEditor.ClearContextMenus();
textEditor.ClearContextMenus(new string[] { "Search" });
textEditor.AddContextMenu("Decompile", TextEditorToYaml);
textEditor.AddContextMenu("Compile", TextEditorFromYaml);
stPanel2.Controls.Add(textEditor);

View file

@ -30,6 +30,8 @@ namespace FirstPlugin
return new List<IFileFormat>() { FileFormat };
}
public void BeforeFileSaved() { }
public ByteOrder byteOrder;
public dynamic byml
{
@ -118,7 +120,7 @@ namespace FirstPlugin
stPanel4.Controls.Clear();
textEditor = new TextEditor();
textEditor.ClearContextMenus();
textEditor.ClearContextMenus(new string[] { "Search" });
textEditor.AddContextMenu("Decompile", TextEditorToYaml);
textEditor.AddContextMenu("Compile", TextEditorFromYaml);

View file

@ -21,6 +21,8 @@ namespace Toolbox.Library.Forms
return new List<IFileFormat>() { FileFormat };
}
public void BeforeFileSaved() { }
FindReplace findReplaceDialog;
private void ResetTypes()
@ -214,9 +216,15 @@ namespace Toolbox.Library.Forms
stContextMenuStrip1.Items.Add(text, null, handler);
}
public void ClearContextMenus()
public void ClearContextMenus(string[] filter)
{
stContextMenuStrip1.Items.Clear();
var menuItemsRemove = new List<ToolStripMenuItem>();
foreach (ToolStripMenuItem item in stContextMenuStrip1.Items)
if (!filter.Contains(item.Text))
menuItemsRemove.Add(item);
foreach (var item in menuItemsRemove)
stContextMenuStrip1.Items.Remove(item);
}
public string GetText()