(ded4a3e0a) v0.9.0.7
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using System;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class AddItemDialog : Dialog<bool>
|
||||
{
|
||||
public bool ApplyForAll { get; private set; }
|
||||
public IncludeType Responce { get; private set; }
|
||||
|
||||
public AddItemDialog(string fileloc, bool exists, FileType filetype)
|
||||
{
|
||||
InitializeComponent();
|
||||
Responce = IncludeType.Copy;
|
||||
|
||||
Title = "Add " + filetype;
|
||||
|
||||
label1.Text = "The file '" + fileloc + "' is outside of target directory. What would you like to do?";
|
||||
|
||||
radioCopy.Text = "Copy the " + filetype.ToString().ToLower() + " to the directory";
|
||||
radioLink.Text = "Add a link to the " + filetype.ToString().ToLower();
|
||||
radioSkip.Text = "Skip adding the " + filetype.ToString().ToLower();
|
||||
|
||||
checkBox1.Text = "Use the same action for all the selected " + filetype.ToString().ToLower() + "s";
|
||||
|
||||
if (exists)
|
||||
{
|
||||
radioLink.Checked = true;
|
||||
radioCopy.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void RadioButton_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (radioCopy.Checked)
|
||||
Responce = IncludeType.Copy;
|
||||
else if (radioLink.Checked)
|
||||
Responce = IncludeType.Link;
|
||||
else
|
||||
Responce = IncludeType.Skip;
|
||||
}
|
||||
|
||||
private void CheckBox1_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
ApplyForAll = (bool)checkBox1.Checked;
|
||||
}
|
||||
|
||||
private void ButtonOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
Result = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class AddItemDialog : Dialog<bool>
|
||||
{
|
||||
DynamicLayout layout1;
|
||||
Label label1;
|
||||
RadioButton radioCopy, radioLink, radioSkip;
|
||||
CheckBox checkBox1;
|
||||
Button buttonAdd, buttonCancel;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
DisplayMode = DialogDisplayMode.Attached;
|
||||
Width = 400;
|
||||
Height = 250;
|
||||
|
||||
buttonAdd = new Button();
|
||||
buttonAdd.Text = "Add";
|
||||
PositiveButtons.Add(buttonAdd);
|
||||
DefaultButton = buttonAdd;
|
||||
|
||||
buttonCancel = new Button();
|
||||
buttonCancel.Text = "Cancel";
|
||||
NegativeButtons.Add(buttonCancel);
|
||||
AbortButton = buttonCancel;
|
||||
|
||||
layout1 = new DynamicLayout();
|
||||
layout1.DefaultSpacing = new Size(8, 8);
|
||||
layout1.Padding = new Padding(6);
|
||||
layout1.BeginVertical();
|
||||
|
||||
label1 = new Label();
|
||||
label1.Wrap = WrapMode.Word;
|
||||
label1.Style = "Wrap";
|
||||
layout1.AddRow(label1);
|
||||
|
||||
radioCopy = new RadioButton();
|
||||
radioCopy.Checked = true;
|
||||
layout1.AddRow(radioCopy);
|
||||
|
||||
radioLink = new RadioButton(radioCopy);
|
||||
layout1.AddRow(radioLink);
|
||||
|
||||
radioSkip = new RadioButton(radioCopy);
|
||||
layout1.AddRow(radioSkip);
|
||||
|
||||
var spacing = new Label();
|
||||
spacing.Height = 15;
|
||||
layout1.Add(spacing, true, true);
|
||||
|
||||
checkBox1 = new CheckBox();
|
||||
layout1.AddRow(checkBox1);
|
||||
|
||||
layout1.EndVertical();
|
||||
Content = layout1;
|
||||
|
||||
radioCopy.CheckedChanged += RadioButton_CheckedChanged;
|
||||
radioLink.CheckedChanged += RadioButton_CheckedChanged;
|
||||
radioSkip.CheckedChanged += RadioButton_CheckedChanged;
|
||||
checkBox1.CheckedChanged += CheckBox1_CheckedChanged;
|
||||
buttonAdd.Click += ButtonOk_Click;
|
||||
buttonCancel.Click += ButtonAdd_Click;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class DeleteDialog : Dialog<bool>
|
||||
{
|
||||
private IController _controller;
|
||||
private TreeGridItem _treeBase;
|
||||
|
||||
public DeleteDialog(IController controller, List<IProjectItem> items)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_controller = controller;
|
||||
_treeBase = new TreeGridItem();
|
||||
|
||||
treeView1.Columns.Add(new GridColumn { DataCell = new ImageTextCell(0, 1), AutoSize = true, Resizable = true, Editable = false });
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item is DirectoryItem)
|
||||
ProcessDirectory(_controller.GetFullPath(item.OriginalPath));
|
||||
else
|
||||
Add(_treeBase, item.OriginalPath, false, _controller.GetFullPath(item.OriginalPath));
|
||||
}
|
||||
|
||||
treeView1.DataStore = _treeBase;
|
||||
}
|
||||
|
||||
private void ProcessDirectory(string directory)
|
||||
{
|
||||
Add(_treeBase, _controller.GetRelativePath(directory), true, "");
|
||||
|
||||
var dirs = Directory.GetDirectories(directory);
|
||||
var files = Directory.GetFiles(directory);
|
||||
|
||||
foreach (var dir in dirs)
|
||||
ProcessDirectory(dir);
|
||||
|
||||
foreach (var file in files)
|
||||
Add(_treeBase, _controller.GetRelativePath(file), false, file);
|
||||
}
|
||||
|
||||
public TreeGridItem GetItem(TreeGridItem root, string text, bool folder, string fullpath)
|
||||
{
|
||||
var enumerator = root.Children.GetEnumerator();
|
||||
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
var item = enumerator.Current as TreeGridItem;
|
||||
var itemtext = item.GetValue(1).ToString();
|
||||
|
||||
if (itemtext == text)
|
||||
return item;
|
||||
}
|
||||
|
||||
var ret = new TreeGridItem();
|
||||
var icon = folder ? Global.GetEtoDirectoryIcon() : Global.GetEtoFileIcon(fullpath, false);
|
||||
ret.Values = new object[] { icon, text };
|
||||
root.Children.Add(ret);
|
||||
root.Expanded = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void Add(TreeGridItem root, string path, bool folder, string fullpath)
|
||||
{
|
||||
var split = path.Split(Path.DirectorySeparatorChar);
|
||||
var file = split.Length == 1 && !folder;
|
||||
var item = GetItem(root, split[0], !file, fullpath);
|
||||
|
||||
if (path.Contains(Path.DirectorySeparatorChar.ToString()))
|
||||
Add(item, string.Join(Path.DirectorySeparatorChar.ToString(), split, 1, split.Length - 1), folder, fullpath);
|
||||
}
|
||||
|
||||
private void ButtonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
Result = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class DeleteDialog : Dialog<bool>
|
||||
{
|
||||
DynamicLayout layout1;
|
||||
Label label1;
|
||||
TreeGridView treeView1;
|
||||
Button buttonDelete, buttonCancel;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
Title = "Delete Items";
|
||||
DisplayMode = DialogDisplayMode.Attached;
|
||||
Resizable = true;
|
||||
Size = new Size(450, 300);
|
||||
MinimumSize = new Size(350, 250);
|
||||
|
||||
buttonDelete = new Button();
|
||||
buttonDelete.Text = "Delete";
|
||||
PositiveButtons.Add(buttonDelete);
|
||||
DefaultButton = buttonDelete;
|
||||
buttonDelete.Style = "Destuctive";
|
||||
|
||||
buttonCancel = new Button();
|
||||
buttonCancel.Text = "Cancel";
|
||||
NegativeButtons.Add(buttonCancel);
|
||||
AbortButton = buttonCancel;
|
||||
|
||||
layout1 = new DynamicLayout();
|
||||
layout1.DefaultSpacing = new Size(2, 2);
|
||||
layout1.BeginVertical();
|
||||
|
||||
label1 = new Label();
|
||||
label1.Wrap = WrapMode.Word;
|
||||
label1.Text = "The following items will be deleted (this action cannot be undone):";
|
||||
layout1.Add(label1, true, false);
|
||||
|
||||
treeView1 = new TreeGridView();
|
||||
treeView1.ShowHeader = false;
|
||||
layout1.Add(treeView1, true, true);
|
||||
|
||||
DefaultButton.Text = "Delete";
|
||||
|
||||
Content = layout1;
|
||||
|
||||
buttonDelete.Click += ButtonDelete_Click;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using System;
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class EditDialog : Dialog<bool>
|
||||
{
|
||||
public string Text { get; private set; }
|
||||
|
||||
private string _errInvalidName;
|
||||
private bool _file;
|
||||
|
||||
public EditDialog(string title, string label, string text, bool file)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_errInvalidName = "The following characters are not allowed:";
|
||||
for (int i = 0; i < Global.NotAllowedCharacters.Length; i++)
|
||||
_errInvalidName += " " + Global.NotAllowedCharacters[i];
|
||||
|
||||
Title = title;
|
||||
label1.Text = label;
|
||||
textBox1.Text = text;
|
||||
|
||||
Text = text;
|
||||
_file = file;
|
||||
|
||||
TextBox1_TextChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
base.OnShown(e);
|
||||
|
||||
var index = textBox1.Text.IndexOf('.');
|
||||
if (_file && index != -1)
|
||||
textBox1.Selection = new Range<int>(0, index - 1);
|
||||
}
|
||||
|
||||
private void TextBox1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_file)
|
||||
return;
|
||||
|
||||
var stringOk = Global.CheckString(textBox1.Text);
|
||||
|
||||
DefaultButton.Enabled = (stringOk && (textBox1.Text != ""));
|
||||
label2.Text = !stringOk ? _errInvalidName : "";
|
||||
|
||||
Text = textBox1.Text;
|
||||
}
|
||||
|
||||
private void ButtonOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
Result = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class EditDialog : Dialog<bool>
|
||||
{
|
||||
DynamicLayout layout1;
|
||||
Label label1, label2;
|
||||
TextBox textBox1;
|
||||
Button buttonOk, buttonCancel;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
DisplayMode = DialogDisplayMode.Attached;
|
||||
Size = new Size(400, 160);
|
||||
|
||||
buttonOk = new Button();
|
||||
buttonOk.Text = "Ok";
|
||||
PositiveButtons.Add(buttonOk);
|
||||
DefaultButton = buttonOk;
|
||||
|
||||
buttonCancel = new Button();
|
||||
buttonCancel.Text = "Cancel";
|
||||
NegativeButtons.Add(buttonCancel);
|
||||
AbortButton = buttonCancel;
|
||||
|
||||
layout1 = new DynamicLayout();
|
||||
layout1.DefaultSpacing = new Size(4, 4);
|
||||
layout1.Padding = new Padding(6);
|
||||
layout1.BeginVertical();
|
||||
|
||||
layout1.Add(null, true, true);
|
||||
|
||||
label1 = new Label();
|
||||
layout1.Add(label1);
|
||||
|
||||
textBox1 = new TextBox();
|
||||
layout1.Add(textBox1);
|
||||
|
||||
label2 = new Label();
|
||||
label2.TextColor = new Color(SystemColors.ControlText, 0.5f);
|
||||
label2.TextAlignment = TextAlignment.Center;
|
||||
layout1.Add(label2);
|
||||
|
||||
layout1.Add(null, true, true);
|
||||
|
||||
layout1.EndVertical();
|
||||
Content = layout1;
|
||||
|
||||
textBox1.TextChanged += TextBox1_TextChanged;
|
||||
buttonOk.Click += ButtonOk_Click;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class NewItemDialog : Dialog<bool>
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public ContentItemTemplate Selected { get; private set; }
|
||||
|
||||
private const string _errFileExists = "A file with the same name already exists.";
|
||||
private readonly string _errInvalidName, _dir;
|
||||
|
||||
public NewItemDialog(IEnumerator<ContentItemTemplate> enums, string dir)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_errInvalidName = "The following characters are not allowed:";
|
||||
for (int i = 0; i < Global.NotAllowedCharacters.Length; i++)
|
||||
_errInvalidName += " " + Global.NotAllowedCharacters[i];
|
||||
|
||||
_dir = dir;
|
||||
|
||||
while (enums.MoveNext())
|
||||
{
|
||||
var ret = new ImageListItem();
|
||||
ret.Text = enums.Current.Label + " (" + Path.GetExtension(enums.Current.TemplateFile) + ")";
|
||||
ret.Tag = enums.Current;
|
||||
|
||||
list1.Items.Add(ret);
|
||||
}
|
||||
|
||||
if (list1.Items.Count > 0)
|
||||
list1.SelectedIndex = 0;
|
||||
|
||||
textBox1.Text = "File";
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
base.OnShown(e);
|
||||
|
||||
// We need to delay setting of text color because
|
||||
// GTK doesn't load text color during initialization
|
||||
labelError.TextColor = new Color(labelError.TextColor, 0.5f);
|
||||
}
|
||||
|
||||
private void TextBox1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
ReloadSensitive();
|
||||
Name = textBox1.Text;
|
||||
}
|
||||
|
||||
private void ReloadSensitive()
|
||||
{
|
||||
if (!Global.CheckString(textBox1.Text))
|
||||
{
|
||||
labelError.Text = _errInvalidName;
|
||||
DefaultButton.Enabled = false;
|
||||
}
|
||||
else if (File.Exists(Path.Combine(_dir, textBox1.Text + labelExt.Text)))
|
||||
{
|
||||
labelError.Text = _errFileExists;
|
||||
DefaultButton.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
labelError.Text = "";
|
||||
DefaultButton.Enabled = (textBox1.Text != "") && (list1.SelectedIndex >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void List1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (list1.SelectedIndex < 0)
|
||||
return;
|
||||
|
||||
Selected = (ContentItemTemplate)((ImageListItem)list1.SelectedValue).Tag;
|
||||
labelExt.Text = Path.GetExtension(Selected.TemplateFile);
|
||||
ReloadSensitive();
|
||||
}
|
||||
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Result = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class NewItemDialog : Dialog<bool>
|
||||
{
|
||||
TableLayout table1;
|
||||
DynamicLayout layout1, layout2;
|
||||
Label labelName, labelType, labelExt, labelError;
|
||||
TextBox textBox1;
|
||||
ListBox list1;
|
||||
Button buttonCreate, buttonCancel;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
Title = "New File";
|
||||
DisplayMode = DialogDisplayMode.Attached;
|
||||
Size = new Size(370, 285);
|
||||
MinimumSize = new Size(370, 200);
|
||||
Resizable = true;
|
||||
|
||||
buttonCreate = new Button();
|
||||
buttonCreate.Text = "Create";
|
||||
PositiveButtons.Add(buttonCreate);
|
||||
DefaultButton = buttonCreate;
|
||||
|
||||
buttonCancel = new Button();
|
||||
buttonCancel.Text = "Cancel";
|
||||
NegativeButtons.Add(buttonCancel);
|
||||
AbortButton = buttonCancel;
|
||||
|
||||
layout1 = new DynamicLayout();
|
||||
layout1.Padding = new Padding(6);
|
||||
|
||||
table1 = new TableLayout(2, 3);
|
||||
table1.Spacing = new Size(4, 4);
|
||||
|
||||
labelName = new Label();
|
||||
labelName.Text = "Name: ";
|
||||
labelName.VerticalAlignment = VerticalAlignment.Center;
|
||||
table1.Add(labelName, 0, 0, false, false);
|
||||
|
||||
layout2 = new DynamicLayout();
|
||||
layout2.DefaultSpacing = new Size(4, 4);
|
||||
layout2.BeginHorizontal();
|
||||
|
||||
textBox1 = new TextBox();
|
||||
layout2.Add(textBox1, true, true);
|
||||
|
||||
labelExt = new Label();
|
||||
labelExt.Text = " .spriteFont";
|
||||
labelExt.VerticalAlignment = VerticalAlignment.Center;
|
||||
labelExt.Width = 80;
|
||||
layout2.Add(labelExt, false, true);
|
||||
|
||||
table1.Add(layout2, 1, 0, true, false);
|
||||
|
||||
labelType = new Label();
|
||||
labelType.Text = "Type: ";
|
||||
labelType.VerticalAlignment = VerticalAlignment.Top;
|
||||
table1.Add(labelType, 0, 1, false, true);
|
||||
|
||||
list1 = new ListBox();
|
||||
table1.Add(list1, 1, 1, true, true);
|
||||
|
||||
layout1.Add(table1, true, true);
|
||||
|
||||
labelError = new Label();
|
||||
labelError.TextAlignment = TextAlignment.Center;
|
||||
table1.Add(labelError, 1, 2, true, false);
|
||||
|
||||
layout1.Add(labelError, true, false);
|
||||
|
||||
Content = layout1;
|
||||
|
||||
textBox1.TextChanged += TextBox1_TextChanged;
|
||||
list1.SelectedIndexChanged += List1_SelectedIndexChanged;
|
||||
buttonCreate.Click += ButtonCreate_Click;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using System;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class PathDialog : Dialog<bool>
|
||||
{
|
||||
public string Path { get; set; }
|
||||
|
||||
private readonly string[] symbols = { "Platform", "Configuration", "Config", "Profile" };
|
||||
private IController _controller;
|
||||
|
||||
public PathDialog(IController controller, string path)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_controller = controller;
|
||||
textBox1.Text = path;
|
||||
}
|
||||
|
||||
private void ButtonSymbol_Click(object sender, EventArgs e)
|
||||
{
|
||||
var text = "$(" + (sender as Button).Text + ")";
|
||||
int carret;
|
||||
|
||||
if (!string.IsNullOrEmpty(textBox1.SelectedText))
|
||||
{
|
||||
carret = textBox1.Selection.Start;
|
||||
textBox1.Text = textBox1.Text.Remove(carret, textBox1.Selection.End + 1 - carret);
|
||||
}
|
||||
else
|
||||
carret = textBox1.CaretIndex;
|
||||
|
||||
textBox1.Text = textBox1.Text.Insert(carret, text);
|
||||
textBox1.Focus();
|
||||
textBox1.CaretIndex = carret + text.Length;
|
||||
}
|
||||
|
||||
private void TextBox1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Path = textBox1.Text;
|
||||
DefaultButton.Enabled = !string.IsNullOrWhiteSpace(textBox1.Text);
|
||||
}
|
||||
|
||||
private void ButtonBrowse_Click(object sender, EventArgs e)
|
||||
{
|
||||
var dialog = new SelectFolderDialog();
|
||||
dialog.Directory = _controller.GetFullPath(textBox1.Text);
|
||||
|
||||
if (dialog.ShowDialog(this) == DialogResult.Ok)
|
||||
textBox1.Text = _controller.GetRelativePath(dialog.Directory);
|
||||
}
|
||||
|
||||
private void ButtonOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
Result = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class PathDialog : Dialog<bool>
|
||||
{
|
||||
DynamicLayout layout1;
|
||||
StackLayout stack1, stack2;
|
||||
Label label1, label2;
|
||||
TextBox textBox1;
|
||||
Button buttonBrowse;
|
||||
Button buttonOk, buttonCancel;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
Title = "Select Folder";
|
||||
DisplayMode = DialogDisplayMode.Attached;
|
||||
Size = new Size(370, 200);
|
||||
|
||||
buttonOk = new Button();
|
||||
buttonOk.Text = "Ok";
|
||||
PositiveButtons.Add(buttonOk);
|
||||
DefaultButton = buttonOk;
|
||||
|
||||
buttonCancel = new Button();
|
||||
buttonCancel.Text = "Cancel";
|
||||
NegativeButtons.Add(buttonCancel);
|
||||
AbortButton = buttonCancel;
|
||||
|
||||
layout1 = new DynamicLayout();
|
||||
layout1.DefaultSpacing = new Size(4, 4);
|
||||
layout1.Padding = new Padding(6);
|
||||
layout1.BeginVertical();
|
||||
|
||||
layout1.Add(null, true, true);
|
||||
|
||||
label1 = new Label();
|
||||
label1.Text = "Path to use:";
|
||||
layout1.Add(label1);
|
||||
|
||||
stack1 = new StackLayout();
|
||||
stack1.Spacing = 4;
|
||||
stack1.Orientation = Orientation.Horizontal;
|
||||
|
||||
textBox1 = new TextBox();
|
||||
stack1.Items.Add(new StackLayoutItem(textBox1, VerticalAlignment.Center, true));
|
||||
|
||||
buttonBrowse = new Button();
|
||||
buttonBrowse.Text = "...";
|
||||
buttonBrowse.MinimumSize = new Size(1, 1);
|
||||
stack1.Items.Add(new StackLayoutItem(buttonBrowse, VerticalAlignment.Center, false));
|
||||
|
||||
layout1.Add(stack1);
|
||||
|
||||
label2 = new Label();
|
||||
label2.Text = "Macros:";
|
||||
layout1.Add(label2);
|
||||
|
||||
stack2 = new StackLayout();
|
||||
stack2.Spacing = 4;
|
||||
stack2.Orientation = Orientation.Horizontal;
|
||||
|
||||
foreach (var symbol in symbols)
|
||||
{
|
||||
var buttonSymbol = new Button();
|
||||
buttonSymbol.Text = symbol;
|
||||
buttonSymbol.Click += ButtonSymbol_Click;
|
||||
stack2.Items.Add(new StackLayoutItem(buttonSymbol, true));
|
||||
}
|
||||
|
||||
layout1.Add(stack2);
|
||||
|
||||
layout1.Add(null, true, true);
|
||||
|
||||
Content = layout1;
|
||||
|
||||
textBox1.TextChanged += TextBox1_TextChanged;
|
||||
buttonBrowse.Click += ButtonBrowse_Click;
|
||||
buttonOk.Click += ButtonOk_Click;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class ReferenceDialog : Dialog<bool>
|
||||
{
|
||||
protected class RefItem
|
||||
{
|
||||
public string Assembly { get; set; }
|
||||
public string Location { get; set; }
|
||||
|
||||
public RefItem(string assembly, string location)
|
||||
{
|
||||
Assembly = assembly;
|
||||
Location = location;
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> References { get; private set; }
|
||||
|
||||
private IController _controller;
|
||||
private FileFilter _dllFileFilter, _allFileFilter;
|
||||
private SelectableFilterCollection<RefItem> _dataStore;
|
||||
|
||||
public ReferenceDialog(IController controller, string[] refs)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_controller = controller;
|
||||
|
||||
_dllFileFilter = new FileFilter("Dll Files (*.dll)", new[] { ".dll" });
|
||||
_allFileFilter = new FileFilter("All Files (*.*)", new[] { ".*" });
|
||||
|
||||
var assemblyColumn = new GridColumn();
|
||||
assemblyColumn.HeaderText = "Assembly";
|
||||
assemblyColumn.DataCell = new TextBoxCell("Assembly");
|
||||
assemblyColumn.Sortable = true;
|
||||
grid1.Columns.Add(assemblyColumn);
|
||||
|
||||
var locationColumn = new GridColumn();
|
||||
locationColumn.HeaderText = "Location";
|
||||
locationColumn.DataCell = new TextBoxCell("Location");
|
||||
locationColumn.Sortable = true;
|
||||
grid1.Columns.Add(locationColumn);
|
||||
|
||||
grid1.DataStore = _dataStore = new SelectableFilterCollection<RefItem>(grid1);
|
||||
|
||||
foreach (var rf in refs)
|
||||
_dataStore.Add(new RefItem(Path.GetFileName(rf), _controller.GetFullPath(rf)));
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
References = new List<string>();
|
||||
|
||||
var items = _dataStore.GetEnumerator();
|
||||
while (items.MoveNext())
|
||||
References.Add(_controller.GetRelativePath(items.Current.Location));
|
||||
base.Close();
|
||||
}
|
||||
|
||||
private void Grid1_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
buttonRemove.Enabled = grid1.SelectedItems.ToList().Count > 0;
|
||||
}
|
||||
|
||||
private void Grid1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Keys.Delete)
|
||||
ButtonRemove_Click(sender, e);
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var dialog = new OpenFileDialog();
|
||||
dialog.Directory = new Uri(_controller.ProjectItem.Location);
|
||||
dialog.MultiSelect = true;
|
||||
dialog.Filters.Add(_dllFileFilter);
|
||||
dialog.Filters.Add(_allFileFilter);
|
||||
dialog.CurrentFilter = _dllFileFilter;
|
||||
|
||||
if (dialog.ShowDialog(this) == DialogResult.Ok)
|
||||
foreach (var fileName in dialog.Filenames)
|
||||
_dataStore.Add(new RefItem(Path.GetFileName(fileName), fileName));
|
||||
}
|
||||
|
||||
private void ButtonRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
var selectedItems = grid1.SelectedItems.ToArray();
|
||||
|
||||
foreach (var item in selectedItems)
|
||||
_dataStore.Remove(item as RefItem);
|
||||
}
|
||||
|
||||
private void ButtonOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
Result = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// MonoGame - Copyright (C) The MonoGame Team
|
||||
// This file is subject to the terms and conditions defined in
|
||||
// file 'LICENSE.txt', which is part of this source code package.
|
||||
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
|
||||
namespace MonoGame.Tools.Pipeline
|
||||
{
|
||||
partial class ReferenceDialog : Dialog<bool>
|
||||
{
|
||||
DynamicLayout layout1;
|
||||
StackLayout stack1;
|
||||
GridView grid1;
|
||||
Button buttonAdd, buttonRemove;
|
||||
Button buttonOk, buttonCancel;
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
Title = "Reference Editor";
|
||||
DisplayMode = DialogDisplayMode.Attached;
|
||||
Resizable = true;
|
||||
Padding = new Padding(4);
|
||||
Size = new Size(500, 400);
|
||||
MinimumSize = new Size(450, 300);
|
||||
|
||||
buttonOk = new Button();
|
||||
buttonOk.Text = "Ok";
|
||||
PositiveButtons.Add(buttonOk);
|
||||
DefaultButton = buttonOk;
|
||||
|
||||
buttonCancel = new Button();
|
||||
buttonCancel.Text = "Cancel";
|
||||
NegativeButtons.Add(buttonCancel);
|
||||
AbortButton = buttonCancel;
|
||||
|
||||
layout1 = new DynamicLayout();
|
||||
layout1.DefaultSpacing = new Size(4, 4);
|
||||
layout1.BeginHorizontal();
|
||||
|
||||
grid1 = new GridView();
|
||||
grid1.Style = "GridView";
|
||||
layout1.Add(grid1, true, true);
|
||||
|
||||
stack1 = new StackLayout();
|
||||
stack1.Orientation = Orientation.Vertical;
|
||||
stack1.Spacing = 4;
|
||||
|
||||
buttonAdd = new Button();
|
||||
buttonAdd.Text = "Add";
|
||||
stack1.Items.Add(new StackLayoutItem(buttonAdd, false));
|
||||
|
||||
buttonRemove = new Button();
|
||||
buttonRemove.Text = "Remove";
|
||||
stack1.Items.Add(new StackLayoutItem(buttonRemove, false));
|
||||
|
||||
layout1.Add(stack1, false, true);
|
||||
|
||||
Content = layout1;
|
||||
|
||||
grid1.SelectionChanged += Grid1_SelectionChanged;
|
||||
grid1.KeyDown += Grid1_KeyDown;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
buttonRemove.Click += ButtonRemove_Click;
|
||||
buttonOk.Click += ButtonOk_Click;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user