void ShowSelectedPad()
 {
     Gtk.TreeIter iter;
     if (treeviewPads.Selection.GetSelected(out iter))
     {
         MonoDevelop.Ide.Gui.Pad pad = padListStore.GetValue(iter, 2) as MonoDevelop.Ide.Gui.Pad;
         ShowType(ImageService.GetPixbuf(!pad.Icon.IsNull ? pad.Icon : MonoDevelop.Ide.Gui.Stock.MiscFiles, Gtk.IconSize.Dialog),
                  pad.Title,
                  "",
                  "");
     }
 }
Esempio n. 2
0
        Pixbuf GetIconForDocument(MonoDevelop.Ide.Gui.Document document, Gtk.IconSize iconSize)
        {
            if (!string.IsNullOrEmpty(document.Window.ViewContent.StockIconId))
            {
                return(ImageService.GetPixbuf(document.Window.ViewContent.StockIconId, iconSize));
            }
            if (string.IsNullOrEmpty(document.FileName))
            {
                return(ImageService.GetPixbuf(MonoDevelop.Ide.Gui.Stock.MiscFiles, iconSize));
            }

            return(DesktopService.GetPixbufForFile(document.FileName, iconSize));
        }
        void FillLists()
        {
            foreach (Pad pad in IdeApp.Workbench.Pads)
            {
                if (!pad.Visible)
                {
                    continue;
                }
                padListStore.AppendValues(ImageService.GetPixbuf(!String.IsNullOrEmpty(pad.Icon) ? pad.Icon : MonoDevelop.Ide.Gui.Stock.MiscFiles, IconSize.Menu),
                                          pad.Title,
                                          pad);
            }

            foreach (Document doc in documents)
            {
                documentListStore.AppendValues(GetIconForDocument(doc, IconSize.Menu),
                                               doc.Window.Title,
                                               doc);
            }
        }
Esempio n. 4
0
        public DocumentSwitcher(Gtk.Window parent, bool startWithNext) : base(Gtk.WindowType.Toplevel)
        {
            IdeApp.CommandService.IsEnabled = false;
            this.documents    = new List <MonoDevelop.Ide.Gui.Document> (IdeApp.Workbench.Documents.OrderByDescending(d => d.LastTimeActive));
            this.TransientFor = parent;

            this.Decorated         = false;
            this.DestroyWithParent = true;

            this.Modal          = true;
            this.WindowPosition = Gtk.WindowPosition.CenterOnParent;
            this.TypeHint       = WindowTypeHint.Dialog;

            this.ModifyBg(StateType.Normal, this.Style.Base(StateType.Normal));

            VBox vBox = new VBox();
            HBox hBox = new HBox();

            var hBox2 = new HBox();

            hBox2.PackStart(hBox, false, false, 8);

            hBox.PackStart(imageTitle, true, false, 2);
            labelTitle.Xalign        = 0;
            labelTitle.HeightRequest = 24;
            hBox.PackStart(labelTitle, true, true, 2);
            vBox.PackStart(hBox2, false, false, 6);

            labelType.Xalign        = 0;
            labelType.HeightRequest = 16;
            hBox = new HBox();
            hBox.PackStart(labelType, false, false, 8);
            vBox.PackStart(hBox, false, false, 2);

            hBox = new HBox();
            hBox.PackStart(documentList, true, true, 1);
            vBox.PackStart(hBox, false, false, 0);

            labelFileName.Xalign    = 0;
            labelFileName.Ellipsize = Pango.EllipsizeMode.Start;
            hBox = new HBox();
            hBox.PackStart(labelFileName, true, true, 8);
            vBox.PackEnd(hBox, false, false, 6);

            Add(vBox);

            var padCategory = new  DocumentList.Category(GettextCatalog.GetString("Pads"));

            DocumentList.Item activeItem = null;

            foreach (Pad pad in IdeApp.Workbench.Pads)
            {
                if (!pad.Visible)
                {
                    continue;
                }
                var item = new DocumentList.Item()
                {
                    Icon  = ImageService.GetPixbuf(pad.Icon.Name ?? MonoDevelop.Ide.Gui.Stock.MiscFiles, IconSize.Menu),
                    Title = pad.Title,
                    Tag   = pad
                };
                if (pad.Window.Content.Control.HasFocus)
                {
                    activeItem = item;
                }
                padCategory.AddItem(item);
            }
            documentList.AddCategory(padCategory);

            var documentCategory = new  DocumentList.Category(GettextCatalog.GetString("Documents"));

            foreach (var doc in documents)
            {
                var item = new DocumentList.Item()
                {
                    Icon        = GetIconForDocument(doc, IconSize.Menu),
                    Title       = System.IO.Path.GetFileName(doc.Name),
                    ListTitle   = doc.Window.Title,
                    Description = doc.Window.DocumentType,
                    Path        = doc.Name,
                    Tag         = doc
                };
                if (doc.Window.ActiveViewContent.Control.HasFocus)
                {
                    activeItem = item;
                }
                documentCategory.AddItem(item);
            }
            documentList.AddCategory(documentCategory);

            documentList.ActiveItemChanged += delegate {
                if (documentList.ActiveItem == null)
                {
                    labelFileName.Text = labelType.Text = labelTitle.Text = "";
                    return;
                }
                imageTitle.Pixbuf  = documentList.ActiveItem.Icon;
                labelFileName.Text = documentList.ActiveItem.Path;
                labelType.Markup   = "<span size=\"small\">" + documentList.ActiveItem.Description + "</span>";
                labelTitle.Markup  = "<span size=\"xx-large\" weight=\"bold\">" + documentList.ActiveItem.Title + "</span>";
            };

            if (activeItem == null)
            {
                if (documentCategory.Items.Count > 0)
                {
                    activeItem = documentCategory.Items[0];
                }
                else if (padCategory.Items.Count > 0)
                {
                    activeItem = padCategory.Items[0];
                }
                else
                {
                    Destroy();
                    return;
                }
            }

            documentList.ActiveItem = activeItem;
            documentList.NextItem();
            documentList.RequestClose += delegate {
                if (documentList.ActiveItem.Tag is Pad)
                {
                    ((Pad)documentList.ActiveItem.Tag).BringToFront(true);
                }
                else
                {
                    ((MonoDevelop.Ide.Gui.Document)documentList.ActiveItem.Tag).Select();
                }
                Destroy();
            };

            this.ShowAll();
            documentList.GrabFocus();
            this.GrabDefault();
        }
 static void UpdateInstrumentationIcon()
 {
     if (IdeApp.Preferences.EnableInstrumentation)
     {
         if (instrumentationStatusIcon == null)
         {
             instrumentationStatusIcon         = IdeApp.Workbench.StatusBar.ShowStatusIcon(ImageService.GetPixbuf(Gtk.Stock.DialogInfo));
             instrumentationStatusIcon.ToolTip = "Instrumentation service enabled";
             instrumentationStatusIcon.EventBox.ButtonPressEvent += delegate
             {
                 InstrumentationService.StartMonitor();
             };
         }
     }
     else if (instrumentationStatusIcon != null)
     {
         instrumentationStatusIcon.Dispose();
     }
 }