Skip to content

Commit

Permalink
[Gtk Pipeline] General improvements #4457
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-cpp committed Feb 11, 2016
1 parent 2aecb22 commit d538477
Show file tree
Hide file tree
Showing 24 changed files with 724 additions and 396 deletions.
15 changes: 15 additions & 0 deletions Build/Projects/Pipeline.definition
Expand Up @@ -272,6 +272,12 @@
<Compile Include="Gtk\Dialogs\TextEditorDialog.GUI.cs">
<Platforms>MacOS,Linux</Platforms>
</Compile>
<Compile Include="Gtk\Dialogs\DeleteDialog.GUI.cs">
<Platforms>MacOS,Linux</Platforms>
</Compile>
<Compile Include="Gtk\Dialogs\DeleteDialog.cs">
<Platforms>MacOS,Linux</Platforms>
</Compile>
<Compile Include="Gtk\Global.cs">
<Platforms>MacOS,Linux</Platforms>
</Compile>
Expand Down Expand Up @@ -309,6 +315,12 @@
<EmbeddedResource Include="Icons\Toolbar\Save.png">
<LogicalName>Toolbar.Save.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Icons\Toolbar\Undo.png">
<LogicalName>Toolbar.Undo.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Icons\Toolbar\Redo.png">
<LogicalName>Toolbar.Redo.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Icons\Toolbar\NewItem.png">
<LogicalName>Toolbar.NewItem.png</LogicalName>
</EmbeddedResource>
Expand All @@ -330,6 +342,9 @@
<EmbeddedResource Include="Icons\Toolbar\Clean.png">
<LogicalName>Toolbar.Clean.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Icons\Toolbar\CancelBuild.png">
<LogicalName>Toolbar.CancelBuild.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Icons\Toolbar\FilterOutput.png">
<LogicalName>Toolbar.FilterOutput.png</LogicalName>
</EmbeddedResource>
Expand Down
2 changes: 1 addition & 1 deletion Tools/Pipeline/Common/IController.cs
Expand Up @@ -106,7 +106,7 @@ interface IController : IContentItemObserver

void IncludeFolder(string initialDirectory);

void Exclude(IEnumerable<ContentItem> items, IEnumerable<string> folders);
void Exclude(IEnumerable<ContentItem> items, IEnumerable<string> folders, bool delete);

void NewItem(string name, string location, ContentItemTemplate template);

Expand Down
2 changes: 2 additions & 0 deletions Tools/Pipeline/Common/IView.cs
Expand Up @@ -37,6 +37,8 @@ interface IView

void ShowMessage(string message);

bool ShowDeleteDialog(string[] items);

void BeginTreeUpdate();

void SetTreeRoot(IProjectItem item);
Expand Down
34 changes: 32 additions & 2 deletions Tools/Pipeline/Common/PipelineController.ExcludeAction.cs
Expand Up @@ -2,6 +2,7 @@
// 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;
Expand All @@ -15,11 +16,13 @@ private class ExcludeAction : IProjectAction
private readonly PipelineController _con;
private readonly ContentItemState[] _state;
private readonly string[] _folder;
private readonly bool _delete;

public ExcludeAction(PipelineController controller, IEnumerable<ContentItem> items, IEnumerable<string> folders)
public ExcludeAction(PipelineController controller, IEnumerable<ContentItem> items, IEnumerable<string> folders, bool delete)
{
_con = controller;
_folder = (folders == null) ? new string[0] : folders.ToArray();
_delete = delete;

if(items == null)
_state = new ContentItemState[0];
Expand All @@ -44,18 +47,42 @@ public bool Do()
for (var i = 0; i < _con._project.ContentItems.Count; i++)
{
var item = _con._project.ContentItems[i];

if (item.OriginalPath == obj.SourceFile)
{
_con._project.ContentItems.Remove(item);
_con.View.RemoveTreeItem(item);

try
{
if (_delete && File.Exists(item.OriginalPath))
File.Delete(item.OriginalPath);
}
catch(Exception ex)
{
_con.View.ShowError("File could not be deleted", "File '" + item.OriginalPath + "' could not be deleted due to the following reasons: " + ex.Message);
}

break;
}
}
}

foreach(string f in _folder)
foreach (string f in _folder)
{
_con.View.RemoveTreeFolder(f);

try
{
if (_delete && Directory.Exists(f))
Directory.Delete(f);
}
catch(Exception ex)
{
_con.View.ShowError("Folder could not be deleted", "Folder '" + f + "' could not be deleted due to the following reasons: " + ex.Message);
}
}

_con.View.EndTreeUpdate();
_con.ProjectDirty = true;

Expand All @@ -64,6 +91,9 @@ public bool Do()

public bool Undo()
{
if (_delete)
return false;

_con.View.BeginTreeUpdate();

foreach(string f in _folder)
Expand Down
20 changes: 17 additions & 3 deletions Tools/Pipeline/Common/PipelineController.cs
Expand Up @@ -540,7 +540,7 @@ public void CancelBuild()
/// </summary>
private bool AskSaveProject()
{
// If the project is not dirty
// If the project is not dirty or open
// then we can simply skip it.
if (!ProjectDirty)
return true;
Expand Down Expand Up @@ -838,9 +838,23 @@ private List<string> GetDirectories(string folder)
return ret;
}

public void Exclude(IEnumerable<ContentItem> items, IEnumerable<string> folders)
public void Exclude(IEnumerable<ContentItem> items, IEnumerable<string> folders, bool delete)
{
var action = new ExcludeAction(this, items, folders);
if (delete)
{
var delitems = new List<string>();

foreach (var f in folders)
delitems.Add(f.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar);

foreach (var i in items)
delitems.Add(i.OriginalPath);

if (!View.ShowDeleteDialog(delitems.ToArray()))
return;
}

var action = new ExcludeAction(this, items, folders, delete);
if(action.Do())
_actionStack.Add(action);
}
Expand Down
209 changes: 56 additions & 153 deletions Tools/Pipeline/Gtk/Dialogs/CollectionEditorDialog.GUI.cs
@@ -1,163 +1,66 @@
using Gtk;

// This file has been generated by the GUI designer. Do not modify.
namespace MonoGame.Tools.Pipeline
{
public partial class CollectionEditorDialog
{
private global::Gtk.HPaned hpaned1;

private global::Gtk.VBox vbox2;

private global::Gtk.FileChooserWidget filechooserwidget1;

private global::Gtk.HBox hbox2;

private global::Gtk.Alignment alignment1;

private global::Gtk.Button button9;

private global::Gtk.VBox vbox3;

private global::Gtk.HBox hbox1;

private global::Gtk.Alignment alignment2;

private global::Gtk.Button button10;

private global::Gtk.ScrolledWindow GtkScrolledWindow2;

private global::Gtk.TreeView treeview1;
public partial class CollectionEditorDialog
{
private VBox vbox1;
private HBox hbox1;
private Button buttonAdd, buttonRemove;
private ScrolledWindow scrollView1;
private TreeView treeView1;

protected virtual void Build ()
{
global::Stetic.Gui.Initialize (this);
// Widget MonoGame.Tools.Pipeline.CollectionEditorDialog
this.Name = "MonoGame.Tools.Pipeline.CollectionEditorDialog";
this.Title = global::Mono.Unix.Catalog.GetString ("Reference Editor");
this.WindowPosition = ((global::Gtk.WindowPosition)(4));
// Internal child MonoGame.Tools.Pipeline.CollectionEditorDialog.VBox
#if GTK2
global::Gtk.VBox w1 = this.VBox;
#elif GTK3
global::Gtk.Box w1 = this.ContentArea;
#endif
w1.Name = "dialog1_VBox";
w1.BorderWidth = ((uint)(2));
// Container child dialog1_VBox.Gtk.Box+BoxChild
this.hpaned1 = new global::Gtk.HPaned ();
this.hpaned1.CanFocus = true;
this.hpaned1.Name = "hpaned1";
this.hpaned1.Position = 573;
// Container child hpaned1.Gtk.Paned+PanedChild
this.vbox2 = new global::Gtk.VBox ();
this.vbox2.Name = "vbox2";
this.vbox2.Spacing = 6;
// Container child vbox2.Gtk.Box+BoxChild
this.filechooserwidget1 = new global::Gtk.FileChooserWidget (((global::Gtk.FileChooserAction)(0)));
#if GTK3
this.filechooserwidget1.Expand = true;
#endif
this.filechooserwidget1.Name = "filechooserwidget1";
this.vbox2.Add (this.filechooserwidget1);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.filechooserwidget1]));
w2.Position = 0;
// Container child vbox2.Gtk.Box+BoxChild
this.hbox2 = new global::Gtk.HBox ();
this.hbox2.Name = "hbox2";
this.hbox2.Spacing = 6;
// Container child hbox2.Gtk.Box+BoxChild
this.alignment1 = new global::Gtk.Alignment (0.5F, 0.5F, 1F, 1F);
this.alignment1.Name = "alignment1";
this.hbox2.Add (this.alignment1);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.alignment1]));
w3.Position = 0;
// Container child hbox2.Gtk.Box+BoxChild
this.button9 = new global::Gtk.Button ();
this.button9.CanFocus = true;
this.button9.Name = "button9";
this.button9.UseStock = true;
this.button9.UseUnderline = true;
this.button9.Label = "gtk-add";
this.hbox2.Add (this.button9);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.button9]));
w4.Position = 1;
w4.Expand = false;
w4.Fill = false;
this.vbox2.Add (this.hbox2);
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox2]));
w5.Position = 1;
w5.Expand = false;
w5.Fill = false;
this.hpaned1.Add (this.vbox2);
global::Gtk.Paned.PanedChild w6 = ((global::Gtk.Paned.PanedChild)(this.hpaned1 [this.vbox2]));
w6.Resize = false;
// Container child hpaned1.Gtk.Paned+PanedChild
this.vbox3 = new global::Gtk.VBox ();
this.vbox3.Name = "vbox3";
this.vbox3.Spacing = 6;
// Container child vbox3.Gtk.Box+BoxChild
this.hbox1 = new global::Gtk.HBox ();
this.hbox1.Name = "hbox1";
this.hbox1.Spacing = 6;
// Container child hbox1.Gtk.Box+BoxChild
this.alignment2 = new global::Gtk.Alignment (0.5F, 0.5F, 1F, 1F);
this.alignment2.Name = "alignment2";
this.hbox1.Add (this.alignment2);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.alignment2]));
w7.Position = 0;
// Container child hbox1.Gtk.Box+BoxChild
this.button10 = new global::Gtk.Button ();
this.button10.CanFocus = true;
this.button10.Name = "button10";
this.button10.UseStock = true;
this.button10.UseUnderline = true;
this.button10.Label = "gtk-remove";
this.hbox1.Add (this.button10);
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.button10]));
w8.Position = 1;
w8.Expand = false;
w8.Fill = false;
this.vbox3.Add (this.hbox1);
global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.hbox1]));
w9.Position = 0;
w9.Expand = false;
w9.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
this.GtkScrolledWindow2 = new global::Gtk.ScrolledWindow ();
this.GtkScrolledWindow2.Name = "GtkScrolledWindow2";
this.GtkScrolledWindow2.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child GtkScrolledWindow2.Gtk.Container+ContainerChild
this.treeview1 = new global::Gtk.TreeView ();
this.treeview1.CanFocus = true;
this.treeview1.Name = "treeview1";
this.treeview1.EnableSearch = false;
this.treeview1.HeadersVisible = false;
this.GtkScrolledWindow2.Add (this.treeview1);
this.vbox3.Add (this.GtkScrolledWindow2);
global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.GtkScrolledWindow2]));
w11.Position = 1;
this.hpaned1.Add (this.vbox3);
w1.Add (this.hpaned1);
global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(w1 [this.hpaned1]));
w13.Position = 0;
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.DefaultWidth = 800;
this.DefaultHeight = 397;
protected virtual void Build ()
{
this.Title = "Reference Editor";
this.WindowPosition = WindowPosition.CenterOnParent;
this.DefaultWidth = 400;
this.DefaultHeight = 350;

#if GTK3
Gdk.Geometry geom = new Gdk.Geometry();
#if GTK3
var geom = new Gdk.Geometry();
geom.MinWidth = this.DefaultWidth;
geom.MinHeight = 200;
this.SetGeometryHints(this, geom, Gdk.WindowHints.MinSize);
#endif
#endif

this.Show ();
this.Response += new global::Gtk.ResponseHandler (this.OnResponse);
this.filechooserwidget1.FileActivated += new global::System.EventHandler (this.AddFileEvent);
this.button9.Clicked += new global::System.EventHandler (this.AddFileEvent);
this.button10.Clicked += new global::System.EventHandler (this.RemoveFileEvent);
}
}
hbox1 = new HBox();

scrollView1 = new ScrolledWindow();

treeView1 = new TreeView();
treeView1.HeadersVisible = false;
treeView1.Selection.Changed += SelectionChanged;
scrollView1.Add(treeView1);

hbox1.PackStart(scrollView1, true, true, 0);

vbox1 = new VBox();

buttonAdd = new Button("Add");
buttonAdd.Clicked += AddFileEvent;
vbox1.PackStart(buttonAdd, false, true, 0);

buttonRemove = new Button("Remove");
buttonRemove.Sensitive = false;
buttonRemove.Clicked += RemoveFileEvent;
vbox1.PackStart(buttonRemove, false, true, 0);

hbox1.PackStart(vbox1, false, true, 1);

#if GTK3
this.ContentArea.PackStart(hbox1, true, true, 0);
#else
this.VBox.PackStart(hbox1, true, true, 0);
#endif

this.AddButton("Ok", ResponseType.Ok);
this.AddButton("Cancel", ResponseType.Cancel);
this.DefaultResponse = ResponseType.Ok;

this.ShowAll ();

this.Response += this.OnResponse;
}
}
}

2 comments on commit d538477

@mgbot
Copy link
Member

@mgbot mgbot commented on d538477 Feb 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity MonoGame :: Develop (Win) Build 3.5.0.1371 is now running

@mgbot
Copy link
Member

@mgbot mgbot commented on d538477 Feb 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity MonoGame :: Develop (Win) Build 3.5.0.1371 outcome was SUCCESS
Summary: Tests passed: 584, ignored: 6 Build time: 00:20:24

Please sign in to comment.