[MonoDevelop] [Patch] Small fixes

Ben Motmans Ben Motmans <ben.motmans@gmail.com>
Tue, 15 Mar 2005 15:29:19 +0100


------=_Part_444_18899379.1110896959085
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

* Clear the statusbar when a combine closes
* Clear the build output pad when a combine closes
* Custom popup menu for the build output pad
only show Copy and Select All, since all other items are allways disabled

-- Ben

------=_Part_444_18899379.1110896959085
Content-Type: text/x-patch; name="small_fixes.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="small_fixes.patch"

Index: Core/src/MonoDevelop.Base/Services/StatusBar/DefaultStatusBarService=
.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Core/src/MonoDevelop.Base/Services/StatusBar/DefaultStatusBarService.cs=
=09(revision 2351)
+++ Core/src/MonoDevelop.Base/Services/StatusBar/DefaultStatusBarService.cs=
=09(working copy)
@@ -24,6 +24,12 @@
 =09=09{
 =09=09=09statusBar =3D new SdStatusBar(this);
 =09=09}
+
+=09=09protected override void OnInitialize (EventArgs e)
+=09=09{
+=09=09=09base.OnInitialize (e);
+=09=09=09Runtime.ProjectService.CombineClosed +=3D OnCombineClosed;
+=09=09}
 =09=09
 =09=09public void Dispose()
 =09=09{
@@ -118,5 +124,10 @@
 =09=09
 =09=09bool   wasError    =3D false;
 =09=09string lastMessage =3D "";
+
+=09=09void OnCombineClosed (object sender, CombineEventArgs e)
+=09=09{
+=09=09=09SetMessage ("");
+=09=09}
 =09}
 }
Index: Core/src/MonoDevelop.Base/Gui/Pads/OpenTaskView.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Core/src/MonoDevelop.Base/Gui/Pads/OpenTaskView.cs=09(revision 2351)
+++ Core/src/MonoDevelop.Base/Gui/Pads/OpenTaskView.cs=09(working copy)
@@ -60,7 +60,7 @@
 =09=09=09// FIXME
 =09=09}
=20
-=09=09const int COL_TYPE =3D 0, COL_LINE =3D 1, COL_DESC =3D 2, COL_PATH =
=3D 3, COL_FILE =3D 4, COL_TASK =3D 5, COL_READ =3D 6, COL_MARKED =3D 7, CO=
L_READ_WEIGHT =3D 8;
+=09=09const int COL_TYPE =3D 0, COL_LINE =3D 1, COL_DESC =3D 2, COL_FILE =
=3D 3, COL_PATH =3D 4, COL_TASK =3D 5, COL_READ =3D 6, COL_MARKED =3D 7, CO=
L_READ_WEIGHT =3D 8;
 =09=09
 =09=09public OpenTaskView()
 =09=09{
@@ -68,8 +68,8 @@
 =09=09=09=09typeof (Gdk.Pixbuf), // image
 =09=09=09=09typeof (int),        // line
 =09=09=09=09typeof (string),     // desc
+=09=09=09=09typeof (string),     // file
 =09=09=09=09typeof (string),     // path
-=09=09=09=09typeof (string),     // file
 =09=09=09=09typeof (Task),       // task
 =09=09=09=09typeof (bool),       // read?
 =09=09=09=09typeof (bool),       // marked?
@@ -158,10 +158,10 @@
 =09=09=09view.AppendColumn (GettextCatalog.GetString ("Line")        , lin=
e         , "text"    , COL_LINE, "weight", COL_READ_WEIGHT);
 =09=09=09col =3D view.AppendColumn (GettextCatalog.GetString ("Description=
") , desc         , "text"    , COL_DESC, "weight", COL_READ_WEIGHT, "strik=
ethrough", COL_MARKED);
 =09=09=09col.Resizable =3D true;
+=09=09=09col =3D view.AppendColumn (GettextCatalog.GetString ("File")     =
   , file         , "text"    , COL_FILE, "weight", COL_READ_WEIGHT);
+=09=09=09col.Resizable =3D true;
 =09=09=09col =3D view.AppendColumn (GettextCatalog.GetString ("Path")     =
   , path         , "text"    , COL_PATH, "weight", COL_READ_WEIGHT);
 =09=09=09col.Resizable =3D true;
-=09=09=09col =3D view.AppendColumn (GettextCatalog.GetString ("File")     =
   , file         , "text"    , COL_FILE, "weight", COL_READ_WEIGHT);
-=09=09=09col.Resizable =3D true;
 =09=09}
 =09=09
 =09=09void OnCombineOpen(object sender, CombineEventArgs e)
@@ -264,8 +264,8 @@
 =09=09=09=09stock,
 =09=09=09=09t.Line + 1,
 =09=09=09=09t.Description,
+=09=09=09=09fileName,
 =09=09=09=09path,
-=09=09=09=09fileName,
 =09=09=09=09t, false, false, (int) Pango.Weight.Bold);
 =09=09}
 =09=09
Index: Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs=09(revision 235=
1)
+++ Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs=09(working copy=
)
@@ -25,7 +25,7 @@
 =09public class DefaultMonitorPad : IPadContent
 =09{
 =09=09Gtk.TextBuffer buffer;
-=09=09Gtk.TextView textEditorControl;
+=09=09EventTextView textEditorControl;
 =09=09Gtk.ScrolledWindow scroller;
 =09=09Gtk.HBox hbox;
 =09=09ToolButton buttonStop;
@@ -47,8 +47,9 @@
 =09=09public DefaultMonitorPad (string title, string icon)
 =09=09{
 =09=09=09buffer =3D new Gtk.TextBuffer (new Gtk.TextTagTable ());
-=09=09=09textEditorControl =3D new Gtk.TextView (buffer);
+=09=09=09textEditorControl =3D new EventTextView (buffer);
 =09=09=09textEditorControl.Editable =3D false;
+=09=09=09textEditorControl.ButtonPressEvent +=3D OnButtonPressed;
 =09=09=09scroller =3D new Gtk.ScrolledWindow ();
 =09=09=09scroller.ShadowType =3D ShadowType.In;
 =09=09=09scroller.Add (textEditorControl);
@@ -81,6 +82,9 @@
 =09=09=09buffer.TagTable.Add (tag);
 =09=09=09tags.Add (tag);
=20
+=09=09=09Runtime.ProjectService.CombineOpened +=3D (CombineEventHandler) R=
untime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineOpen)=
);
+=09=09=09Runtime.ProjectService.CombineClosed +=3D (CombineEventHandler) R=
untime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineClose=
d));
+
 =09=09=09this.title =3D title;
 =09=09=09this.icon =3D icon;
 =09=09=09this.markupTitle =3D title;
@@ -95,14 +99,71 @@
 =09=09=09}
 =09=09}
=20
-=09=09void OnButtonClearClick (object sender, EventArgs e) {
+=09=09void OnButtonClearClick (object sender, EventArgs e)
+=09=09{
 =09=09=09buffer.Clear();
 =09=09}
=20
-=09=09void OnButtonStopClick (object sender, EventArgs e) {
+=09=09void OnButtonStopClick (object sender, EventArgs e)
+=09=09{
 =09=09=09asyncOperation.Cancel ();
 =09=09}
=20
+=09=09void OnCombineOpen (object sender, CombineEventArgs e)
+=09=09{
+=09=09=09buffer.Clear ();
+=09=09}
+=09=09
+=09=09void OnCombineClosed (object sender, CombineEventArgs e)
+=09=09{
+=09=09=09buffer.Clear ();
+=09=09}
+
+=09=09[GLib.ConnectBefore]
+=09=09void OnButtonPressed (object o, ButtonPressEventArgs args)
+=09=09{
+=09=09=09if (args.Event.Button =3D=3D 3)
+=09=09=09=09ShowPopup ();
+=09=09}
+
+=09=09void ShowPopup ()
+=09=09{
+=09=09=09Menu menu =3D new Menu ();
+=09=09=09menu.AccelGroup =3D new AccelGroup ();
+=09=09=09ImageMenuItem copy =3D new ImageMenuItem (Gtk.Stock.Copy, menu.Ac=
celGroup);
+=09=09=09MenuItem selectAll =3D new MenuItem ("Select _All");
+=09=09=09copy.Activated +=3D OnOutputCopied;
+=09=09=09selectAll.Activated +=3D OnOutputSelect;
+=09=09=09copy.Sensitive =3D CanCopy;
+=09=09=09menu.Append (copy);
+=09=09=09menu.Append (new SeparatorMenuItem ());
+=09=09=09menu.Append (selectAll);
+=09=09=09menu.Popup (null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentE=
ventTime);
+=09=09=09menu.ShowAll ();
+=09=09}
+
+=09=09bool CanCopy {
+=09=09=09get {
+=09=09=09=09TextIter dummyIter;
+=09=09=09=09return buffer.GetSelectionBounds(out dummyIter, out dummyIter)=
;
+=09=09=09}
+=09=09}
+
+=09=09void OnOutputCopied (object o, EventArgs args)
+=09=09{
+=09=09=09Clipboard board;
+=09=09=09board =3D Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));
+=09=09=09buffer.CopyClipboard (board);
+=09=09=09board =3D Clipboard.Get (Gdk.Atom.Intern ("PRIMARY", false));
+=09=09=09buffer.CopyClipboard (board);
+=09=09}
+
+=09=09void OnOutputSelect (object o, EventArgs args)
+=09=09{
+=09=09=09buffer.MoveMark ("selection_bound", buffer.StartIter);
+=09=09=09buffer.MoveMark ("insert", buffer.EndIter);
+=09=09}
+
 =09=09public void BeginProgress (string title)
 =09=09{
 =09=09=09this.title =3D title;
@@ -225,4 +286,19 @@
 =09=09}
=20
 =09}
+
+=09class EventTextView : TextView {
+
+=09=09public EventTextView (TextBuffer textBuffer) : base (textBuffer)
+=09=09{
+=09=09}
+
+=09=09protected override bool OnButtonPressEvent (Gdk.EventButton e)
+=09=09{
+=09=09=09if (e.Button =3D=3D 3)
+=09=09=09=09return false;
+=09=09=09else
+=09=09=09=09return base.OnButtonPressEvent(e);
+=09=09}
+=09}
 }
Index: Core/src/MonoDevelop.Base/ChangeLog
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Core/src/MonoDevelop.Base/ChangeLog=09(revision 2351)
+++ Core/src/MonoDevelop.Base/ChangeLog=09(working copy)
@@ -1,3 +1,13 @@
+2005-03-15  Ben Motmans <ben.motmans@gmail.com>
+
+=09* Gui/Pads/DefaultMonitorPad.cs:
+=09Clear the build output when a combine closes.
+=09Custom popup menu with only the necessary items.
+=09* GUI/Pads/OpenTaskView.cs
+=09Reorder of some columns.
+=09* Services/StatusBar/DefaultStatusBarService.cs:
+=09Clear the statusbar when a combine closes.
+
 2005-03-14  Lluis Sanchez Gual <lluis@novell.com>
=20
 =09* Commands/MenuItemBuilders.cs

------=_Part_444_18899379.1110896959085--