[MonoDevelop] [Patch] Small fixes

Ben Motmans Ben Motmans <ben.motmans@gmail.com>
Wed, 16 Mar 2005 03:42:22 +0100


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

On Wed, 16 Mar 2005 02:46:15 +0100, Lluis Sanchez <lluis@ximian.com> wrote:
> Hi!
> 
> > * 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
> 
> This can be done in a more elegant way by subscribing the PopulatePopup
> event of TextView. You can modify the menu in the handler. There is no
> need for a subclass. The other changes look OK to me.
> 
> Lluis.
> 
fixed: Sane way to display popup

-- Ben

------=_Part_1173_11231138.1110940942384
Content-Type: text/x-patch; name="small_fixes_retry.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="small_fixes_retry.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 2358)
+++ 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 2358)
+++ 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,11 @@
 =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}
 =09=09
 =09=09void OnCombineOpen(object sender, CombineEventArgs e)
@@ -264,8 +265,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=
8)
+++ Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs=09(working copy=
)
@@ -49,6 +49,7 @@
 =09=09=09buffer =3D new Gtk.TextBuffer (new Gtk.TextTagTable ());
 =09=09=09textEditorControl =3D new Gtk.TextView (buffer);
 =09=09=09textEditorControl.Editable =3D false;
+=09=09=09textEditorControl.PopulatePopup +=3D OnPopupPopulated;
 =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,68 @@
 =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=09void OnPopupPopulated (object o, PopulatePopupArgs args)
+=09=09{
+=09=09=09Menu menu =3D args.Menu;
+=09=09=09foreach (Widget widget in menu.Children)
+=09=09=09=09menu.Remove (widget);
+=09=09=09
+=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.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;
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 2358)
+++ 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 for better view on small resolutions.
+=09* Services/StatusBar/DefaultStatusBarService.cs:
+=09Clear the statusbar when a combine closes.
+
 2005-03-15  John Luke  <john.luke@gmail.com>
=20
 =09* Gui/Workbench/Layout/SdiWorkspaceLayout.cs: add NoGrip flags

------=_Part_1173_11231138.1110940942384--