~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric-updates

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CombinedDesignView.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-18 08:40:51 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090218084051-gh8m6ukvokbwj7cf
Tags: 1.9.2+dfsg-1ubuntu1
* Merge from Debian Experimental (LP: #330519), remaining Ubuntu changes:
  + debian/control:
    - Update for Gnome# 2.24
    - Add libmono-cairo1.0-cil to build-deps to fool pkg-config check

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
using MonoDevelop.Components.Commands;
37
37
using MonoDevelop.Core.Execution;
38
38
using MonoDevelop.Projects.Text;
39
 
using MonoDevelop.Projects.Parser;
 
39
using MonoDevelop.Projects.Dom;
40
40
 
41
41
using Gtk;
42
42
using Gdk;
43
43
 
44
44
namespace MonoDevelop.GtkCore.GuiBuilder
45
45
{
46
 
        public class CombinedDesignView : AbstractViewContent, IPositionable
 
46
        public class CombinedDesignView : AbstractViewContent
47
47
        {
48
48
                IViewContent content;
49
49
                Gtk.Notebook notebook;
55
55
                public CombinedDesignView (IViewContent content)
56
56
                {
57
57
                        this.content = content;
58
 
                        
 
58
                        if (content is IEditableTextBuffer) {
 
59
                                ((IEditableTextBuffer)content).CaretPositionSet += delegate {
 
60
                                        ShowPage (0);
 
61
                                };
 
62
                        }
59
63
                        content.ContentChanged += new EventHandler (OnTextContentChanged);
60
64
                        content.DirtyChanged += new EventHandler (OnTextDirtyChanged);
61
65
                        
86
90
                        box.Show ();
87
91
                        
88
92
                        IdeApp.Workbench.ActiveDocumentChanged += new EventHandler (OnActiveDocumentChanged);
 
93
                        content.Control.Realized += delegate {
 
94
                                if (content != null && content.WorkbenchWindow != null) 
 
95
                                        content.WorkbenchWindow.ActiveViewContent = notebook.CurrentPageWidget == content.Control ? content : this;
 
96
                        };
 
97
                        notebook.SwitchPage += delegate {
 
98
                                if (content != null && content.WorkbenchWindow != null) 
 
99
                                        content.WorkbenchWindow.ActiveViewContent = notebook.CurrentPageWidget == content.Control ? content : this;
 
100
                        };
89
101
                }
90
102
                
91
103
                public virtual Stetic.Designer Designer {
108
120
                
109
121
                public void RemoveButton (int npage)
110
122
                {
 
123
                        if (npage >= toolbar.Children.Length)
 
124
                                return;
111
125
                        notebook.RemovePage (npage);
112
126
                        Gtk.Widget cw = toolbar.Children [npage];
113
127
                        toolbar.Remove (cw);
150
164
                                ToggleToolButton b = (ToggleToolButton) buttons [n];
151
165
                                b.Active = (n == npage);
152
166
                        }
153
 
 
154
167
                        updating = false;
155
168
                }
156
169
                
160
173
                        content.DirtyChanged -= new EventHandler (OnTextDirtyChanged);
161
174
                        IdeApp.Workbench.ActiveDocumentChanged -= new EventHandler (OnActiveDocumentChanged);
162
175
                        content.Dispose ();
163
 
        
 
176
                        
164
177
                        // Remove and destroy the contents of the Notebook, since the destroy event is
165
178
                        // not propagated to pages in some gtk versions.
166
179
                        
238
251
                
239
252
                public override object GetContent (Type type)
240
253
                {
241
 
                        if (type == typeof(IPositionable)) {
242
 
                                // Intercept the IPositionable interface, since we need to
243
 
                                // switch to the text editor when jumping to a line
244
 
                                if (content.GetContent (type) != null)
245
 
                                        return this;
246
 
                                else
247
 
                                        return null;
248
 
                        }
249
 
                        
 
254
//                      if (type == typeof(IEditableTextBuffer)) {
 
255
//                              // Intercept the IPositionable interface, since we need to
 
256
//                              // switch to the text editor when jumping to a line
 
257
//                              if (content.GetContent (type) != null)
 
258
//                                      return this;
 
259
//                              else
 
260
//                                      return null;
 
261
//                      }
 
262
//                      
250
263
                        object ob = base.GetContent (type);
251
 
                        if (ob == null)
 
264
                        if (ob != null)
 
265
                                return ob;
 
266
                        else if (content != null)
252
267
                                return content.GetContent (type);
253
268
                        else
254
 
                                return ob;
 
269
                                return null;
255
270
                }
256
271
 
257
272
                public void JumpTo (int line, int column)
258
273
                {
259
 
                        IPositionable ip = (IPositionable) content.GetContent (typeof(IPositionable));
 
274
                        IEditableTextBuffer ip = (IEditableTextBuffer) content.GetContent (typeof(IEditableTextBuffer));
260
275
                        if (ip != null) {
261
276
                                ShowPage (0);
262
 
                                ip.JumpTo (line, column);
 
277
                                ip.SetCaretTo (line, column);
263
278
                        }
264
279
                }
265
280
        }