~ubuntu-branches/ubuntu/feisty/monodevelop/feisty

« back to all changes in this revision

Viewing changes to Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-08-18 00:51:23 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060818005123-5iit07y0j7wjg55f
Tags: 0.11+svn20060818-0ubuntu1
* New SVN snapshot
  + Works with Gtk# 2.9.0
* debian/control:
  + Updated Build-Depends
* debian/patches/use_nunit2.2.dpatch,
  debian/patches/use_real_libs.dpatch:
  + Updated
* debian/patches/versioncontrol_buildfix.dpatch:
  + Fix build failure in the version control addin

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
                        
91
91
                        IViewContent content = window.ActiveViewContent as IViewContent;
92
92
                        if (content != null)
93
 
                                info.Enabled = content.IsDirty;
 
93
                                info.Enabled = !content.IsViewOnly && content.IsDirty;
94
94
                        else
95
95
                                info.Enabled = false;
96
96
                }
101
101
                        IdeApp.Workbench.FindDocument (window).SaveAs ();
102
102
                }
103
103
                
 
104
                [CommandUpdateHandler (FileCommands.SaveAs)]
 
105
                protected void OnUpdateSaveFileAs (CommandInfo info)
 
106
                {
 
107
                        IViewContent content = window.ActiveViewContent as IViewContent;
 
108
                        if (content != null)
 
109
                                info.Enabled = !content.IsViewOnly;
 
110
                        else
 
111
                                info.Enabled = false;
 
112
                }
 
113
                
104
114
                [CommandHandler (FileCommands.ReloadFile)]
105
115
                protected void OnReloadFile ()
106
116
                {
292
302
                {
293
303
                        info.Enabled = window.ActiveViewContent is ICodeStyleOperations;
294
304
                }
 
305
                
 
306
                [CommandHandler (EditCommands.UppercaseSelection)]
 
307
                public void OnUppercaseSelection ()
 
308
                {
 
309
                        IEditableTextBuffer buffer = window.ActiveViewContent as IEditableTextBuffer;
 
310
                        if (buffer != null)
 
311
                        {
 
312
                                if (buffer.SelectedText == String.Empty)
 
313
                                {
 
314
                                        int pos = buffer.CursorPosition;
 
315
                                        string ch = buffer.GetText (pos, pos + 1);
 
316
                                        buffer.DeleteText (pos, 1);
 
317
                                        buffer.InsertText (pos, ch.ToUpper ());
 
318
                                        buffer.CursorPosition = pos + 1;
 
319
                                } else
 
320
                                {
 
321
                                        string newText = buffer.SelectedText.ToUpper ();
 
322
                                        int startPos = buffer.SelectionStartPosition;
 
323
                                        buffer.DeleteText (startPos, buffer.SelectedText.Length);
 
324
                                        buffer.InsertText (startPos, newText);
 
325
                                }
 
326
                        }
 
327
                }
 
328
                
 
329
                [CommandUpdateHandler (EditCommands.UnIndentSelection)]
 
330
                protected void OnUppercaseSelection (CommandInfo info)
 
331
                {
 
332
                        info.Enabled = window.ActiveViewContent is IEditableTextBuffer;
 
333
                }
 
334
                
 
335
                [CommandHandler (EditCommands.LowercaseSelection)]
 
336
                public void OnLowercaseSelection ()
 
337
                {
 
338
                        IEditableTextBuffer buffer = window.ActiveViewContent as IEditableTextBuffer;
 
339
                        if (buffer != null)
 
340
                        {
 
341
                                if (buffer.SelectedText == String.Empty)
 
342
                                {
 
343
                                        int pos = buffer.CursorPosition;
 
344
                                        string ch = buffer.GetText (pos, pos + 1);
 
345
                                        buffer.DeleteText (pos, 1);
 
346
                                        buffer.InsertText (pos, ch.ToLower ());
 
347
                                        buffer.CursorPosition = pos + 1;
 
348
                                } else
 
349
                                {
 
350
                                        string newText = buffer.SelectedText.ToLower ();
 
351
                                        int startPos = buffer.SelectionStartPosition;
 
352
                                        buffer.DeleteText (startPos, buffer.SelectedText.Length);
 
353
                                        buffer.InsertText (startPos, newText);
 
354
                                }
 
355
                        }
 
356
                }
 
357
                
 
358
                [CommandUpdateHandler (EditCommands.LowercaseSelection)]
 
359
                protected void OnLowercaseSelection (CommandInfo info)
 
360
                {
 
361
                        info.Enabled = window.ActiveViewContent is IEditableTextBuffer;
 
362
                }
295
363
        }
296
364
}