~ubuntu-branches/ubuntu/natty/monodevelop/natty

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit/RegexToolkitWindow.cs

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ebner
  • Date: 2008-03-29 23:36:33 UTC
  • mto: (1.5.1 sid)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: james.westby@ubuntu.com-20080329233633-l550uuwvfh1e68at
Tags: upstream-1.0+dfsg
Import upstream version 1.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
using System.IO;
31
31
using System.Text.RegularExpressions;
32
32
using System.Xml;
 
33
using MonoDevelop.Core;
33
34
 
 
35
using Gdk;
34
36
using Gtk;
35
37
 
36
38
namespace MonoDevelop.RegexToolkit
45
47
                public RegexToolkitWindow() : base (Gtk.WindowType.Toplevel)
46
48
                {
47
49
                        this.Build();
 
50
                        this.Events = Gdk.EventMask.AllEventsMask;
48
51
                        this.TransientFor = MonoDevelop.Ide.Gui.IdeApp.Workbench.RootWindow;
49
52
                        optionsStore = new ListStore (typeof (bool), typeof (string), typeof (Options));
50
53
                        resultStore = new Gtk.TreeStore (typeof (string), typeof (string), typeof (int), typeof (int));
122
125
                        
123
126
                        elementsStore = new Gtk.TreeStore (typeof (string), typeof (string), typeof (string), typeof (string));
124
127
                        this.elementsTreeview.Model = this.elementsStore;
 
128
                        this.elementsTreeview.Events = Gdk.EventMask.AllEventsMask;
125
129
                        this.elementsTreeview.HeadersVisible = false;
126
130
                        this.elementsTreeview.AppendColumn (String.Empty, new CellRendererPixbuf (), "stock_id", 0);
127
131
                        cellRendText = new CellRendererText ();
128
132
                        cellRendText.Ellipsize = Pango.EllipsizeMode.End;
 
133
                        
129
134
                        this.elementsTreeview.AppendColumn ("", cellRendText, "text", 1);
130
135
                        this.elementsTreeview.Selection.Changed += delegate {
131
136
                                ShowTooltipForSelectedEntry ();                 
132
137
                        };
 
138
                        this.elementsTreeview.Events = Gdk.EventMask.AllEventsMask;
 
139
                        this.LeaveNotifyEvent += delegate {
 
140
                                this.HideTooltipWindow ();
 
141
                        };
133
142
                        int ox = -1 , oy = -1;
134
 
                        this.elementsTreeview.WidgetEvent += delegate {
 
143
                        this.elementsTreeview.WidgetEvent += delegate(object sender, WidgetEventArgs args) {
 
144
                                if (args.Event.Type != Gdk.EventType.MotionNotify)
 
145
                                        return;
135
146
                                if (elementsTreeview.Selection.GetSelectedRows ().Length == 0)
136
147
                                        return;
137
148
                                Gdk.Rectangle rect = elementsTreeview.GetCellArea (elementsTreeview.Selection.GetSelectedRows () [0], elementsTreeview.GetColumn (0));
139
150
                                this.GdkWindow.GetOrigin (out x, out y);
140
151
                                x += rect.X;
141
152
                                y += rect.Y;
142
 
                                if (ox != x || oy != y) {
 
153
                                if (this.tooltipWindow == null || ox != x || oy != y) {
143
154
                                        ShowTooltipForSelectedEntry ();
144
155
                                        ox = x;
145
156
                                        oy = y;
157
168
                        
158
169
                        FillElementsBox ();
159
170
                }
 
171
                
160
172
                void SetFindMode (bool findMode)
161
173
                {
162
174
                        this.notebook2.ShowTabs = !findMode;
163
175
                        if (findMode)
164
176
                                this.notebook2.Page = 0;
165
177
                }
 
178
                
166
179
                void ShowTooltipForSelectedEntry ()
167
180
                {
168
181
                        TreeIter iter;
207
220
                {
208
221
                        HideTooltipWindow (); 
209
222
                        tooltipWindow = new CustomTooltipWindow ();
 
223
                        tooltipWindow.Parent = this;
 
224
                        tooltipWindow.DestroyWithParent = true;
210
225
                        tooltipWindow.Tooltip = text;
211
226
                        int ox, oy;
212
227
                        this.GdkWindow.GetOrigin (out ox, out oy);
360
375
                                        continue;
361
376
                                switch (reader.LocalName) {
362
377
                                case "Group":
363
 
                                        TreeIter groupIter = this.elementsStore.AppendValues (Stock.Info, reader.GetAttribute ("_name"), null, null);
 
378
                                        TreeIter groupIter = this.elementsStore.AppendValues (Stock.Info,
 
379
                                                GettextCatalog.GetString (reader.GetAttribute ("_name")), null, null);
364
380
                                        while (reader.Read ()) {
365
381
                                                if (reader.NodeType == XmlNodeType.EndElement && reader.LocalName == "Group") 
366
382
                                                        break;
367
383
                                                switch (reader.LocalName) {
368
384
                                                        case "Element":
369
 
                                                                this.elementsStore.AppendValues (groupIter, null, reader.GetAttribute ("_name"), reader.GetAttribute ("_description"), reader.ReadElementString ());
 
385
                                                                this.elementsStore.AppendValues (groupIter, null, 
 
386
                                                                        GettextCatalog.GetString (reader.GetAttribute ("_name")),
 
387
                                                                        GettextCatalog.GetString (reader.GetAttribute ("_description")),
 
388
                                                                        reader.ReadElementString ());
370
389
                                                                break;
371
390
                                                }
372
391
                                        }