[Monodevelop-patches-list] r2247 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Gui/Pads Internal/ProgressMonitoring Services/ProcessService Services/Project Services/Tasks
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Fri Feb 11 11:39:47 EST 2005
Author: lluis
Date: 2005-02-11 11:39:46 -0500 (Fri, 11 Feb 2005)
New Revision: 2247
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/BaseProgressMonitor.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/OutputProgressMonitor.cs
Log:
2005-02-11 Lluis Sanchez Gual <lluis at novell.com>
* Services/Project/ProjectService.cs: Fix default file formats.
2005-02-11 Ben Motmans <ben.motmans at gmail.com>
* Internal/ProgressMonitoring/BaseProgressMonitor.cs:
moved cancelRequestedEvent inside MbrWrapper
* Services/Tasks/TaskService.cs
* Services/Tasks/OutputProgressMonitor
* Services/ProcessService/ProcessService.cs
* Gui/Pads/DefaultMonitorPad.cs:
Added kill and clear button
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-02-11 01:54:00 UTC (rev 2246)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-02-11 16:39:46 UTC (rev 2247)
@@ -1,3 +1,17 @@
+2005-02-11 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Services/Project/ProjectService.cs: Fix default file formats.
+
+2005-02-11 Ben Motmans <ben.motmans at gmail.com>
+
+ * Internal/ProgressMonitoring/BaseProgressMonitor.cs:
+ moved cancelRequestedEvent inside MbrWrapper
+ * Services/Tasks/TaskService.cs
+ * Services/Tasks/OutputProgressMonitor
+ * Services/ProcessService/ProcessService.cs
+ * Gui/Pads/DefaultMonitorPad.cs:
+ Added kill and clear button
+
2005-02-10 Todd Berman <tberman at off.net>
* Internal/Project/Combine/Combine.cs: Don't generate makefiles on
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs 2005-02-11 01:54:00 UTC (rev 2246)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs 2005-02-11 16:39:46 UTC (rev 2247)
@@ -27,6 +27,10 @@
Gtk.TextBuffer buffer;
Gtk.TextView textEditorControl;
Gtk.ScrolledWindow scroller;
+ Gtk.HBox hbox;
+ ToolButton buttonStop;
+
+ private static Gtk.Tooltips tips = new Gtk.Tooltips ();
TextTag tag;
TextTag bold;
@@ -37,7 +41,9 @@
string title;
string icon;
string id;
-
+
+ private IAsyncOperation asyncOperation;
+
public DefaultMonitorPad (string title, string icon)
{
buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
@@ -46,6 +52,25 @@
scroller = new Gtk.ScrolledWindow ();
scroller.ShadowType = ShadowType.In;
scroller.Add (textEditorControl);
+
+ Toolbar toolbar = new Toolbar ();
+ toolbar.IconSize = IconSize.SmallToolbar;
+ toolbar.Orientation = Orientation.Vertical;
+ toolbar.ToolbarStyle = ToolbarStyle.Icons;
+
+ buttonStop = new ToolButton ("gtk-stop");
+ buttonStop.Clicked += new EventHandler (OnButtonStopClick);
+ buttonStop.SetTooltip (tips, "Stop", "Stop");
+ toolbar.Insert (buttonStop, -1);
+
+ ToolButton buttonClear = new ToolButton ("gtk-clear");
+ buttonClear.Clicked += new EventHandler (OnButtonClearClick);
+ buttonClear.SetTooltip (tips, "Clear console", "Clear console");
+ toolbar.Insert (buttonClear, -1);
+
+ hbox = new HBox (false, 5);
+ hbox.PackStart (scroller, true, true, 0);
+ hbox.PackEnd (toolbar, false, false, 0);
bold = new TextTag ("bold");
bold.Weight = Pango.Weight.Bold;
@@ -55,12 +80,29 @@
tag.Indent = 10;
buffer.TagTable.Add (tag);
tags.Add (tag);
-
+
this.title = title;
this.icon = icon;
this.markupTitle = title;
}
-
+
+ public IAsyncOperation AsyncOperation {
+ get {
+ return asyncOperation;
+ }
+ set {
+ asyncOperation = value;
+ }
+ }
+
+ void OnButtonClearClick (object sender, EventArgs e) {
+ buffer.Clear();
+ }
+
+ void OnButtonStopClick (object sender, EventArgs e) {
+ asyncOperation.Cancel ();
+ }
+
public void BeginProgress (string title)
{
this.title = title;
@@ -68,6 +110,7 @@
buffer.Clear ();
OnTitleChanged (null);
+ buttonStop.Sensitive = true;
}
public void BeginTask (string name, int totalWork)
@@ -91,8 +134,8 @@
textEditorControl.ScrollMarkOnscreen (buffer.InsertMark);
}
- public Gtk.Widget Control {
- get { return scroller; }
+ public virtual Gtk.Widget Control {
+ get { return hbox; }
}
public string Title {
@@ -117,6 +160,7 @@
{
markupTitle = title;
OnTitleChanged (null);
+ buttonStop.Sensitive = false;
}
void AddText (string s)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/BaseProgressMonitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/BaseProgressMonitor.cs 2005-02-11 01:54:00 UTC (rev 2246)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/BaseProgressMonitor.cs 2005-02-11 16:39:46 UTC (rev 2247)
@@ -38,6 +38,15 @@
{
class MbrWrapper {
public ManualResetEvent waitEvent;
+
+ //workaround for "** ERROR **: file icall.c: line 2419 (ves_icall_InternalExecute): assertion failed" bug when
+ //handling the CancelRequested event
+ public event MonitorHandler cancelRequestedEvent;
+
+ public void RaiseEvent (IProgressMonitor monitor) {
+ if (cancelRequestedEvent != null)
+ cancelRequestedEvent (monitor);
+ }
}
MbrWrapper c = new MbrWrapper ();
@@ -46,7 +55,6 @@
bool canceled;
event OperationHandler completedEvent;
- event MonitorHandler cancelRequestedEvent;
StringCollection errorsMessages = new StringCollection ();
StringCollection successMessages = new StringCollection ();
@@ -186,14 +194,14 @@
add {
bool alreadyCanceled = false;
lock (progressTracker) {
- cancelRequestedEvent += value;
+ c.cancelRequestedEvent += value;
alreadyCanceled = canceled;
}
if (alreadyCanceled) value (this);
}
remove {
lock (progressTracker) {
- cancelRequestedEvent -= value;
+ c.cancelRequestedEvent -= value;
}
}
}
@@ -231,17 +239,16 @@
if (completedEvent != null)
completedEvent (AsyncOperation);
}
-
+
protected virtual void OnCancelRequested ()
{
lock (progressTracker) {
canceled = true;
}
- if (cancelRequestedEvent != null)
- cancelRequestedEvent (this);
+ c.RaiseEvent(this);
}
-
+
[AsyncDispatch]
void WriteLogInternal (string text)
{
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs 2005-02-11 01:54:00 UTC (rev 2246)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs 2005-02-11 16:39:46 UTC (rev 2247)
@@ -89,19 +89,29 @@
} else {
// This should create an vte pad instead, but an output panel will be enough until we can do it
IProgressMonitor monitor = Runtime.TaskService.GetOutputProgressMonitor ("Application Output", MonoDevelop.Gui.Stock.RunProgramIcon, true, true);
+
ProcessMonitor pm = new ProcessMonitor ();
pm.Exited = exited;
pm.Monitor = monitor;
- return StartProcess (command, arguments, workingDirectory, monitor.Log, monitor.Log, new EventHandler (pm.OnExited));
+ pm.CancelHandler = new MonitorHandler(pm.OnCancelRequest);
+
+ monitor.CancelRequested += pm.CancelHandler;
+
+ ProcessWrapper pw = StartProcess (command, arguments, workingDirectory, monitor.Log, monitor.Log, new EventHandler (pm.OnExited));
+ pm.ProcessWrapper = pw;
+
+ return pw;
}
}
-
}
class ProcessMonitor
{
public IProgressMonitor Monitor;
public EventHandler Exited;
+
+ public ProcessWrapper ProcessWrapper;
+ public MonitorHandler CancelHandler;
public void OnExited (object sender, EventArgs args)
{
@@ -114,6 +124,17 @@
Monitor.Dispose ();
}
}
+
+ public void OnCancelRequest (IProgressMonitor monitor) {
+ if (ProcessWrapper != null) {
+ if (!ProcessWrapper.HasExited) {
+ ProcessWrapper.Kill();
+ monitor.Log.WriteLine("Application stopped by user.");
+ }
+ }
+ //remove the cancel handler, it will be attached again when StartConsoleProcess is called
+ monitor.CancelRequested -= CancelHandler;
+ }
}
class OutWriter
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs 2005-02-11 01:54:00 UTC (rev 2246)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs 2005-02-11 16:39:46 UTC (rev 2247)
@@ -44,8 +44,8 @@
IAsyncOperation currentRunOperation;
FileFormatManager formatManager = new FileFormatManager ();
- IFileFormat defaultProjectFormat = new MdsFileFormat ();
- IFileFormat defaultCombineFormat = new MdpFileFormat ();
+ IFileFormat defaultProjectFormat = new MdpFileFormat ();
+ IFileFormat defaultCombineFormat = new MdsFileFormat ();
ICompilerResult lastResult = new DefaultCompilerResult ();
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/OutputProgressMonitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/OutputProgressMonitor.cs 2005-02-11 01:54:00 UTC (rev 2246)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/OutputProgressMonitor.cs 2005-02-11 16:39:46 UTC (rev 2247)
@@ -28,6 +28,7 @@
public OutputProgressMonitor (DefaultMonitorPad pad, string title, string icon)
{
+ pad.AsyncOperation = this.AsyncOperation;
outputPad = pad;
outputPad.BeginProgress (title);
}
More information about the Monodevelop-patches-list
mailing list