Author: lluis
Date: 2007-07-05 12:44:45 -0400 (Thu, 05 Jul 2007)
New Revision: 81409
Added:
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/Commands.cs
Modified:
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/ChangeLog
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/Makefile.am
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/CompactToolboxView.cs
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.addin.xml
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.mdp
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxService.cs
Log:
* MonoDevelop.DesignerSupport.addin.xml,
MonoDevelop.DesignerSupport.mdp,
MonoDevelop.DesignerSupport/Commands.cs,
MonoDevelop.DesignerSupport/ToolboxService.cs,
MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs, Makefile.am: Added
a context menu to the toolbox, which allows adding/removing items.
* MonoDevelop.DesignerSupport.Toolbox/CompactToolboxView.cs: Show the
tooltip centered. Avoid the selection to be cleared when clicking
on an item. Redraw the widget when the item list changes.
Modified: trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/ChangeLog
2007-07-05 16:40:03 UTC (rev 81408)
+++ trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/ChangeLog
2007-07-05 16:44:45 UTC (rev 81409)
@@ -1,5 +1,17 @@
2007-07-05 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+ * MonoDevelop.DesignerSupport.addin.xml,
+ MonoDevelop.DesignerSupport.mdp,
+ MonoDevelop.DesignerSupport/Commands.cs,
+ MonoDevelop.DesignerSupport/ToolboxService.cs,
+ MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs, Makefile.am: Added
+ a context menu to the toolbox, which allows adding/removing items.
+ * MonoDevelop.DesignerSupport.Toolbox/CompactToolboxView.cs: Show the
+ tooltip centered. Avoid the selection to be cleared when clicking
+ on an item. Redraw the widget when the item list changes.
+
+2007-07-05 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
* MonoDevelop.DesignerSupport.mdp,
MonoDevelop.DesignerSupport/ToolboxService.cs,
gtk-gui/generated.cs,
Modified: trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/Makefile.am
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/Makefile.am
2007-07-05 16:40:03 UTC (rev 81408)
+++ trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/Makefile.am
2007-07-05 16:44:45 UTC (rev 81409)
@@ -77,6 +77,7 @@
MonoDevelop.DesignerSupport.Toolbox/UnknownToolboxNode.cs \
MonoDevelop.DesignerSupport/BindingService.cs \
MonoDevelop.DesignerSupport/CodeBehindService.cs \
+ MonoDevelop.DesignerSupport/Commands.cs \
MonoDevelop.DesignerSupport/CustomDescriptor.cs \
MonoDevelop.DesignerSupport/DesignerSupportService.cs \
MonoDevelop.DesignerSupport/IPropertyProvider.cs \
Added:
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/Commands.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/Commands.cs
2007-07-05 16:40:03 UTC (rev 81408)
+++
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/Commands.cs
2007-07-05 16:44:45 UTC (rev 81409)
@@ -0,0 +1,49 @@
+//
+// Commands.cs
+//
+// Authors:
+// Lluis Sanchez Gual <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+//
+// This source code is licenced under The MIT License:
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using MonoDevelop.Components.Commands;
+
+namespace MonoDevelop.DesignerSupport
+{
+ public enum Commands
+ {
+ SelectItems
+ }
+
+ public class SelectItemsCommandHandler: CommandHandler
+ {
+ protected override void Run ()
+ {
+
MonoDevelop.DesignerSupport.DesignerSupport.Service.ToolboxService.AddUserItems
();
+ }
+ }
+}
Modified:
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxService.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxService.cs
2007-07-05 16:40:03 UTC (rev 81408)
+++
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/ToolboxService.cs
2007-07-05 16:44:45 UTC (rev 81409)
@@ -149,6 +149,13 @@
}
}
+ public void RemoveUserItem (ItemToolboxNode node)
+ {
+ Configuration.ItemList.Remove (node);
+ SaveConfiguration ();
+ OnToolboxContentsChanged ();
+ }
+
public void RegisterDefaultToolboxProvider
(IToolboxDefaultProvider provider)
{
string pname = provider.GetType().FullName;
Modified:
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/CompactToolboxView.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/CompactToolboxView.cs
2007-07-05 16:40:03 UTC (rev 81408)
+++
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/CompactToolboxView.cs
2007-07-05 16:44:45 UTC (rev 81409)
@@ -198,6 +198,7 @@
EventMask.EnterNotifyMask |
EventMask.LeaveNotifyMask |
EventMask.ButtonPressMask |
+ EventMask.ButtonReleaseMask |
EventMask.PointerMotionMask
;
}
@@ -226,7 +227,9 @@
protected override bool OnLeaveNotifyEvent (Gdk.EventCrossing e)
{
- ClearMouseOverItem ();
+ // Don't clear the selection when clicking on a button
+ if (e.Detail != NotifyType.Ancestor || e.Mode !=
Gdk.CrossingMode.Grab)
+ ClearMouseOverItem ();
return true;
//return OnLeaveNotifyEvent (e);
}
@@ -317,14 +320,15 @@
tooltipWindow = null;
}
}
- public void ShowTooltip (string text, int x, int y)
+ public void ShowTooltip (string text, int x, int y, int
iconWidth)
{
HideTooltipWindow ();
tooltipWindow = new CustomTooltipWindow ();
tooltipWindow.Tooltip = text;
int ox, oy;
this.GdkWindow.GetOrigin (out ox, out oy);
- tooltipWindow.Move (ox + x, oy + y);
+ int w = tooltipWindow.Child.SizeRequest().Width;
+ tooltipWindow.Move (ox + x - (w - iconWidth)/2, oy + y);
tooltipWindow.ShowAll ();
}
@@ -339,7 +343,7 @@
found = true;
if (mouseOverItem != item) {
mouseOverItem = item;
- ShowTooltip (item.Text, xpos -
2, ypos + IconSize.Height + 3);
+ ShowTooltip (item.Text, xpos -
2, ypos + IconSize.Height + 3, IconSize.Width + 4);
this.QueueDraw ();
}
}
@@ -447,6 +451,7 @@
category.Items.Add (newItem);
}
}
+ QueueDraw ();
}
protected virtual void OnSelectionChanged (EventArgs e)
Modified:
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs
2007-07-05 16:40:03 UTC (rev 81408)
+++
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs
2007-07-05 16:44:45 UTC (rev 81409)
@@ -33,7 +33,9 @@
using System.Collections;
using System.Drawing.Design;
using System.ComponentModel.Design;
-using System.ComponentModel;
+using System.ComponentModel;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Components.Commands;
namespace MonoDevelop.DesignerSupport.Toolbox
{
@@ -99,6 +101,7 @@
compactToolboxView.DragBegin += delegate(object sender,
Gtk.DragBeginArgs e) {
toolboxService.DragSelectedItem
(compactToolboxView, e.Context);
};
+ compactToolboxView.ButtonReleaseEvent +=
OnButtonRelease;
scrolledWindow = new ScrolledWindow ();
base.PackEnd (scrolledWindow, true, true, 0);
@@ -156,6 +159,7 @@
//track expanded state of nodes
nodeView.RowCollapsed += new RowCollapsedHandler
(whenRowCollapsed);
nodeView.RowExpanded += new RowExpandedHandler
(whenRowExpanded);
+ nodeView.ButtonReleaseEvent += OnButtonRelease;
//set initial state
filterToggleButton.Active = false;
@@ -210,6 +214,31 @@
toolboxService.AddUserItems ();
}
+ private void OnButtonRelease(object sender,
Gtk.ButtonReleaseEventArgs args)
+ {
+ if (args.Event.Button == 3) {
+ ShowPopup ();
+ }
+ }
+
+ void ShowPopup ()
+ {
+ CommandEntrySet eset =
IdeApp.CommandService.CreateCommandEntrySet
("/MonoDevelop/DesignerSupport/ToolboxItemContextMenu");
+ IdeApp.CommandService.ShowContextMenu (eset, this);
+ }
+
+ [CommandHandler (MonoDevelop.Ide.Commands.EditCommands.Delete)]
+ internal void OnDeleteItem ()
+ {
+ toolboxService.RemoveUserItem (selectedNode);
+ }
+
+ [CommandUpdateHandler
(MonoDevelop.Ide.Commands.EditCommands.Delete)]
+ internal void OnUpdateDeleteItem (CommandInfo info)
+ {
+ info.Enabled = selectedNode != null;
+ }
+
#endregion
#region GUI population
Modified:
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.addin.xml
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.addin.xml
2007-07-05 16:40:03 UTC (rev 81408)
+++
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.addin.xml
2007-07-05 16:44:45 UTC (rev 81409)
@@ -42,6 +42,11 @@
<ExtensionNode name="Class" />
</ExtensionPoint>
+ <ExtensionPoint path =
"/MonoDevelop/DesignerSupport/ToolboxItemContextMenu" name = "Toolbox item
context menu">
+ <Description>Context menu for toolbox items.</Description>
+ <ExtensionNodeSet id="MonoDevelop.Core.Gui.ItemSet" />
+ </ExtensionPoint>
+
<!-- Extensions -->
<Extension path = "/Workspace/Services">
@@ -105,4 +110,15 @@
<Extension path =
"/SharpDevelop/Workbench/Pads/MonoDevelop.Ide.Gui.Pads.ClassPad">
<NodeBuilder class =
"MonoDevelop.DesignerSupport.Projects.ComponentNodeBuilder"/>
</Extension>
+
+ <Extension path = "/SharpDevelop/Commands">
+ <Command id = "MonoDevelop.DesignerSupport.Commands.SelectItems"
+ defaultHandler =
"MonoDevelop.DesignerSupport.SelectItemsCommandHandler"
+ _label = "Add Items..." />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/DesignerSupport/ToolboxItemContextMenu">
+ <CommandItem id =
"MonoDevelop.DesignerSupport.Commands.SelectItems" />
+ <CommandItem id =
"MonoDevelop.Ide.Commands.EditCommands.Delete" />
+ </Extension>
</Addin>
Modified:
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.mdp
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.mdp
2007-07-05 16:40:03 UTC (rev 81408)
+++
trunk/monodevelop/Extras/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.mdp
2007-07-05 16:44:45 UTC (rev 81409)
@@ -89,6 +89,7 @@
<File name="./MonoDevelop.DesignerSupport.Toolbox/CompactToolboxView.cs"
subtype="Code" buildaction="Compile" />
<File name="./icons/md-design-listboxtoggle.png" subtype="Code"
buildaction="EmbedAsResource" />
<File name="./MonoDevelop.DesignerSupport.Toolbox/ToolboxConfiguration.cs"
subtype="Code" buildaction="Compile" />
+ <File name="./MonoDevelop.DesignerSupport/Commands.cs" subtype="Code"
buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="False" refto="System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches