예제 #1
0
        VBox CreateCategory(string categoryName, string categoryContentMarkup)
        {
            var vbox = new VBox();

            vbox.Spacing = 2;

            var catLabel = new MonoDevelop.Components.FixedWidthWrapLabel();

            catLabel.Text = categoryName;
            catLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());

            vbox.PackStart(catLabel, false, true, 0);

            var contentLabel = new MonoDevelop.Components.FixedWidthWrapLabel();

            contentLabel.MaxWidth           = Math.Max(440, this.Allocation.Width);
            contentLabel.Wrap               = Pango.WrapMode.WordChar;
            contentLabel.BreakOnCamelCasing = true;
            contentLabel.BreakOnPunctuation = true;
            contentLabel.Markup             = categoryContentMarkup.Trim();
            contentLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());

            vbox.PackStart(contentLabel, true, true, 0);

            return(vbox);
        }
예제 #2
0
        internal static VBox CreateCategory(string categoryName, string categoryContentMarkup, Cairo.Color foreColor)
        {
            var vbox = new VBox();

            vbox.Spacing = 8;

            if (categoryName != null)
            {
                var catLabel = new FixedWidthWrapLabel();
                catLabel.Markup = categoryName;
                catLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());
                catLabel.FontDescription = FontService.GetFontDescription("Editor");
                vbox.PackStart(catLabel, false, true, 0);
            }

            var  contentLabel = new FixedWidthWrapLabel();
            HBox hbox         = new HBox();

            // hbox.PackStart (new Label(), false, true, 10);


            contentLabel.Wrap = Pango.WrapMode.WordChar;
            contentLabel.BreakOnCamelCasing = false;
            contentLabel.BreakOnPunctuation = false;
            contentLabel.MaxWidth           = 400;
            contentLabel.Markup             = categoryContentMarkup.Trim();
            contentLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());
            contentLabel.FontDescription = FontService.GetFontDescription("Editor");

            hbox.PackStart(contentLabel, true, true, 0);
            vbox.PackStart(hbox, true, true, 0);

            return(vbox);
        }
예제 #3
0
        internal void SetDefaultScheme()
        {
            var scheme = SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme);

            Theme.SetSchemeColors(scheme);
            foreColor = scheme.PlainText.Foreground;
            headLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());
        }
        protected override void OnShown()
        {
            var scheme = SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme);

            Theme.SetSchemeColors(scheme);
            foreColor = scheme.PlainText.Foreground;
            headlabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());

            base.OnShown();
        }
        internal static VBox CreateCategory(string categoryName, string categoryContentMarkup, Cairo.Color foreColor, Pango.FontDescription font)
        {
            var vbox = new VBox();

            vbox.Spacing = 8;

            if (categoryName != null)
            {
                var catLabel = new FixedWidthWrapLabel();
                catLabel.Markup = categoryName;
                catLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());
                catLabel.FontDescription        = font.Copy();
                catLabel.FontDescription.Weight = Pango.Weight.Bold;
                catLabel.FontDescription.Size   = catLabel.FontDescription.Size + (int)(1 * Pango.Scale.PangoScale);
                vbox.PackStart(catLabel, false, true, 0);
            }

            var  contentLabel = new FixedWidthWrapLabel();
            HBox hbox         = new HBox();

            // hbox.PackStart (new Label(), false, true, 10);


            contentLabel.Wrap               = Pango.WrapMode.WordChar;
            contentLabel.Spacing            = 1;
            contentLabel.BreakOnCamelCasing = false;
            contentLabel.BreakOnPunctuation = false;
            contentLabel.MaxWidth           = 400;
            contentLabel.Markup             = categoryContentMarkup.Trim();
            contentLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());
            contentLabel.FontDescription = font;

            hbox.PackStart(contentLabel, true, true, 0);
            vbox.PackStart(hbox, true, true, 0);

            return(vbox);
        }
예제 #6
0
        public ParameterInformationWindow()
        {
            TypeHint             = Gdk.WindowTypeHint.Tooltip;
            this.SkipTaskbarHint = true;
            this.SkipPagerHint   = true;
            if (IdeApp.Workbench != null)
            {
                this.TransientFor = IdeApp.Workbench.RootWindow;
            }
            this.AllowShrink = false;
            this.AllowGrow   = false;
            this.CanFocus    = false;
            this.CanDefault  = false;
            Mono.TextEditor.PopupWindow.WindowTransparencyDecorator.Attach(this);

            headlabel        = new MonoDevelop.Components.FixedWidthWrapLabel();
            headlabel.Indent = -20;
            var des = FontService.GetFontDescription("Editor");

            headlabel.FontDescription = des;

            headlabel.Wrap = Pango.WrapMode.WordChar;
            headlabel.BreakOnCamelCasing = false;
            headlabel.BreakOnPunctuation = false;
            descriptionBox.Spacing       = 4;
            VBox vb = new VBox(false, 0);

            vb.PackStart(headlabel, true, true, 0);
            vb.PackStart(descriptionBox, true, true, 0);

            HBox hb = new HBox(false, 0);

            hb.PackStart(vb, true, true, 0);


            vb2.Spacing = 4;
            vb2.PackStart(hb, true, true, 0);
            ContentBox.Add(vb2);
            var scheme = Mono.TextEditor.Highlighting.SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme);

            Theme.SetSchemeColors(scheme);

            foreColor = scheme.PlainText.Foreground;
            headlabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());
            ShowAll();
            DesktopService.RemoveWindowShadow(this);
        }
예제 #7
0
        void UpdateStyle()
        {
            var scheme = SyntaxHighlightingService.GetEditorTheme(IdeApp.Preferences.ColorScheme);

            if (!scheme.FitsIdeTheme(IdeApp.Preferences.UserInterfaceTheme))
            {
                scheme = SyntaxHighlightingService.GetDefaultColorStyle(IdeApp.Preferences.UserInterfaceTheme);
            }

            Theme.SetSchemeColors(scheme);
            Theme.Font        = FontService.SansFont.CopyModified(Styles.FontScale11).ToXwtFont();
            Theme.ShadowColor = Styles.PopoverWindow.ShadowColor;
            foreColor         = Styles.PopoverWindow.DefaultTextColor.ToCairoColor();

            headlabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());
            headlabel.FontDescription = FontService.GetFontDescription("Editor").CopyModified(Styles.FontScale11);

            //if (this.Visible)
            //	QueueDraw ();
        }
        internal void SetDefaultScheme()
        {
            var scheme = SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme);

            if (!scheme.FitsIdeSkin(IdeApp.Preferences.UserInterfaceSkin))
            {
                scheme = SyntaxModeService.GetDefaultColorStyle(IdeApp.Preferences.UserInterfaceSkin);
            }

            Theme.SetSchemeColors(scheme);
            foreColor = Styles.PopoverWindow.DefaultTextColor.ToCairoColor();
            headLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());
            headLabel.FontDescription = FontService.GetFontDescription("Editor").CopyModified(Styles.FontScale11);
            Theme.Font        = FontService.SansFont.CopyModified(Styles.FontScale11);
            Theme.ShadowColor = Styles.PopoverWindow.ShadowColor.ToCairoColor();
            if (this.Visible)
            {
                ShowOverload();
            }
        }
        internal void SetDefaultScheme()
        {
            var scheme = SyntaxHighlightingService.GetEditorTheme(IdeApp.Preferences.ColorScheme);

            if (!scheme.FitsIdeTheme(IdeApp.Preferences.UserInterfaceTheme))
            {
                scheme = SyntaxHighlightingService.GetDefaultColorStyle(IdeApp.Preferences.UserInterfaceTheme);
            }

            Theme.SetSchemeColors(scheme);
            foreColor = Styles.PopoverWindow.DefaultTextColor.ToCairoColor();
            headLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());
            headLabel.FontDescription = IdeServices.FontService.GetFontDescription("Editor").CopyModified(Styles.FontScale11);
            Theme.Font        = IdeServices.FontService.SansFont.CopyModified(Styles.FontScale11).ToXwtFont();
            Theme.ShadowColor = Styles.PopoverWindow.ShadowColor;
                        #pragma warning disable CS0612 // Type or member is obsolete
            if (this.Visible)
            {
                ShowOverload();
            }
                        #pragma warning restore CS0612
        }
		void UpdateStyle ()
		{
			var scheme = SyntaxModeService.GetColorStyle (IdeApp.Preferences.ColorScheme);
			if (!scheme.FitsIdeSkin (IdeApp.Preferences.UserInterfaceSkin))
				scheme = SyntaxModeService.GetDefaultColorStyle (IdeApp.Preferences.UserInterfaceSkin);
			
			Theme.SetSchemeColors (scheme);
			Theme.Font = FontService.SansFont.CopyModified (Styles.FontScale11);
			Theme.ShadowColor = Styles.PopoverWindow.ShadowColor.ToCairoColor ();
			foreColor = Styles.PopoverWindow.DefaultTextColor.ToCairoColor ();

			headlabel.ModifyFg (StateType.Normal, foreColor.ToGdkColor ());
			headlabel.FontDescription = FontService.GetFontDescription ("Editor").CopyModified (Styles.FontScale11);

			if (this.Visible)
				QueueDraw ();
		}
예제 #11
0
		internal void SetDefaultScheme ()
		{
			var scheme = Mono.TextEditor.Highlighting.SyntaxModeService.GetColorStyle (IdeApp.Preferences.ColorScheme);
			Theme.SetSchemeColors (scheme);
			foreColor = scheme.PlainText.Foreground;
			headLabel.ModifyFg (StateType.Normal, foreColor.ToGdkColor ());
		}
        public ParameterInformationWindow()
        {
            TypeHint = Gdk.WindowTypeHint.Tooltip;
            this.SkipTaskbarHint = true;
            this.SkipPagerHint = true;
            this.AllowShrink = false;
            this.AllowGrow = false;
            this.CanFocus = false;
            this.CanDefault = false;
            Mono.TextEditor.PopupWindow.WindowTransparencyDecorator.Attach (this);

            headlabel = new MonoDevelop.Components.FixedWidthWrapLabel ();
            headlabel.Indent = -20;

            headlabel.FontDescription = FontService.GetFontDescription ("Editor").CopyModified (1.1);

            headlabel.Wrap = Pango.WrapMode.WordChar;
            headlabel.BreakOnCamelCasing = false;
            headlabel.BreakOnPunctuation = false;
            descriptionBox.Spacing = 4;
            VBox vb = new VBox (false, 0);
            vb.PackStart (headlabel, true, true, 0);
            vb.PackStart (descriptionBox, true, true, 0);

            HBox hb = new HBox (false, 0);
            hb.PackStart (vb, true, true, 0);

            vb2.Spacing = 4;
            vb2.PackStart (hb, true, true, 0);
            ContentBox.Add (vb2);
            var scheme = Mono.TextEditor.Highlighting.SyntaxModeService.GetColorStyle (IdeApp.Preferences.ColorScheme);
            Theme.SetSchemeColors (scheme);

            foreColor = scheme.PlainText.Foreground;
            headlabel.ModifyFg (StateType.Normal, foreColor.ToGdkColor ());
            ShowAll ();
            DesktopService.RemoveWindowShadow (this);
        }
예제 #13
0
        protected override bool OnExposeEvent(Gdk.EventExpose args)
        {
            using (var context = Gdk.CairoHelper.Create(args.Window)) {
                context.LineWidth = 1;
                Gdk.Window window = args.Window;
                var        alloc  = Allocation;
                int        width  = alloc.Width;
                int        height = alloc.Height;
                context.Rectangle(args.Area.X, args.Area.Y, args.Area.Width, args.Area.Height);
                context.Color = this.backgroundColor;
                context.Fill();

                int xpos = iconTextSpacing;
                int yPos = (int)-vadj.Value;

                //when there are no matches, display a message to indicate that the completion list is still handling input
                if (filteredItems.Count == 0)
                {
                    Gdk.GC gc = new Gdk.GC(window);
                    gc.RgbFgColor = backgroundColor.ToGdkColor();
                    window.DrawRectangle(gc, true, 0, yPos, width, height - yPos);
                    noMatchLayout.SetText(win.DataProvider.ItemCount == 0 ? NoSuggestionsMsg : NoMatchesMsg);
                    int lWidth, lHeight;
                    noMatchLayout.GetPixelSize(out lWidth, out lHeight);
                    gc.RgbFgColor = (Mono.TextEditor.HslColor)textColor;
                    window.DrawLayout(gc, (width - lWidth) / 2, yPos + (height - lHeight - yPos) / 2 - lHeight, noMatchLayout);
                    gc.Dispose();

                    return(false);
                }


                var textGCNormal = new Gdk.GC(window);
                textGCNormal.RgbFgColor = (Mono.TextEditor.HslColor)textColor;
                var fgGCNormal = this.Style.ForegroundGC(StateType.Normal);
                var matcher    = CompletionMatcher.CreateCompletionMatcher(CompletionString);
                Iterate(true, ref yPos, delegate(Category category, int ypos) {
                    if (ypos >= height)
                    {
                        return;
                    }
                    if (ypos < -rowHeight)
                    {
                        return;
                    }

                    //	window.DrawRectangle (this.Style.BackgroundGC (StateType.Insensitive), true, 0, yPos, width, rowHeight);
                    int x = 2;
                    if (category.CompletionCategory != null && !string.IsNullOrEmpty(category.CompletionCategory.Icon))
                    {
                        var icon = ImageService.GetPixbuf(category.CompletionCategory.Icon, IconSize.Menu);
                        window.DrawPixbuf(fgGCNormal, icon, 0, 0, 0, ypos, icon.Width, icon.Height, Gdk.RgbDither.None, 0, 0);
                        x = icon.Width + 4;
                    }
                    context.Rectangle(0, ypos, Allocation.Width, rowHeight);
                    context.Color = backgroundColor;
                    context.Fill();


//					layout.SetMarkup ("<span weight='bold' foreground='#AAAAAA'>" + (category.CompletionCategory != null ? category.CompletionCategory.DisplayText : "Uncategorized") + "</span>");
//					window.DrawLayout (textGCInsensitive, x - 1, ypos + 1 + (rowHeight - py) / 2, layout);
//					layout.SetMarkup ("<span weight='bold'>" + (category.CompletionCategory != null ? category.CompletionCategory.DisplayText : "Uncategorized") + "</span>");
                    categoryLayout.SetMarkup((category.CompletionCategory != null ? category.CompletionCategory.DisplayText : "Uncategorized"));
                    int px, py;
                    categoryLayout.GetPixelSize(out px, out py);
                    window.DrawLayout(textGCNormal, x, ypos + (rowHeight - py) / 2, categoryLayout);
                }, delegate(Category curCategory, int item, int itemidx, int ypos) {
                    if (ypos >= height)
                    {
                        return(false);
                    }
                    if (ypos < -rowHeight)
                    {
                        return(true);
                    }
                    const int categoryModeItemIndenting = 0;
                    if (InCategoryMode && curCategory != null && curCategory.CompletionCategory != null)
                    {
                        xpos = iconTextSpacing + categoryModeItemIndenting;
                    }
                    else
                    {
                        xpos = iconTextSpacing;
                    }
                    string markup      = win.DataProvider.HasMarkup(item) ? (win.DataProvider.GetMarkup(item) ?? "&lt;null&gt;") : GLib.Markup.EscapeText(win.DataProvider.GetText(item) ?? "<null>");
                    string description = win.DataProvider.GetDescription(item);

                    if (string.IsNullOrEmpty(description))
                    {
                        layout.SetMarkup(markup);
                    }
                    else
                    {
                        if (item == SelectedItem)
                        {
                            layout.SetMarkup(markup + " " + description);
                        }
                        else
                        {
                            layout.SetMarkup(markup + " <span foreground=\"darkgray\">" + description + "</span>");
                        }
                    }

                    string text = win.DataProvider.GetText(item);

                    if (!string.IsNullOrEmpty(text))
                    {
                        int[] matchIndices = matcher.GetMatch(text);
                        if (matchIndices != null)
                        {
                            Pango.AttrList attrList = layout.Attributes ?? new Pango.AttrList();
                            for (int newSelection = 0; newSelection < matchIndices.Length; newSelection++)
                            {
                                int idx       = matchIndices [newSelection];
                                var fg        = new AttrForeground((ushort)(highlightColor.R * ushort.MaxValue), (ushort)(highlightColor.G * ushort.MaxValue), (ushort)(highlightColor.B * ushort.MaxValue));
                                fg.StartIndex = (uint)idx;
                                fg.EndIndex   = (uint)(idx + 1);
                                attrList.Insert(fg);
                            }
                            layout.Attributes = attrList;
                        }
                    }

                    Gdk.Pixbuf icon = win.DataProvider.GetIcon(item);
                    int iconHeight, iconWidth;
                    if (icon != null)
                    {
                        iconWidth  = icon.Width;
                        iconHeight = icon.Height;
                    }
                    else if (!Gtk.Icon.SizeLookup(Gtk.IconSize.Menu, out iconWidth, out iconHeight))
                    {
                        iconHeight = iconWidth = 24;
                    }

                    int wi, he, typos, iypos;
                    layout.GetPixelSize(out wi, out he);


                    typos = he < rowHeight ? ypos + (rowHeight - he) / 2 : ypos;
                    iypos = iconHeight < rowHeight ? ypos + (rowHeight - iconHeight) / 2 : ypos;
                    if (item == SelectedItem)
                    {
                        context.Rectangle(0, ypos, Allocation.Width, rowHeight / 2);
                        context.Color = SelectionEnabled ? selectedItemColor.Foreground : selectedItemInactiveColor.Background;
                        context.Fill();
                        context.Rectangle(0, ypos + rowHeight / 2, Allocation.Width, rowHeight / 2);
                        context.Color = SelectionEnabled ? selectedItemColor.Background : selectedItemInactiveColor.Background;
                        context.Fill();

                        context.Rectangle(0.5, ypos + 0.5, Allocation.Width - 1, rowHeight - 1);
                        if (!SelectionEnabled)
                        {
                            context.SetDash(new double[] { 4, 4 }, 0);
                        }
                        context.Color = SelectionEnabled ? selectionBorderColor : selectionBorderInactiveColor;
                        context.Stroke();
                    }

                    if (icon != null)
                    {
                        window.DrawPixbuf(fgGCNormal, icon, 0, 0, xpos, iypos, iconWidth, iconHeight, Gdk.RgbDither.None, 0, 0);
                        xpos += iconTextSpacing;
                    }
                    window.DrawLayout(textGCNormal, xpos + iconWidth + 2, typos, layout);

                    if (wi + xpos + iconWidth + 2 > listWidth)
                    {
                        WidthRequest = listWidth = wi + xpos + iconWidth + 2 + iconTextSpacing;
                        win.ResetSizes();
                    }
                    else
                    {
                        //workaround for the vscrollbar display - the calculated width needs to be the width ofthe render region.
                        if (Allocation.Width < listWidth)
                        {
                            if (listWidth - Allocation.Width < 30)
                            {
                                WidthRequest = listWidth + listWidth - Allocation.Width;
                                win.ResetSizes();
                            }
                        }
                    }


                    layout.SetMarkup("");
                    if (layout.Attributes != null)
                    {
                        layout.Attributes.Dispose();
                        layout.Attributes = null;
                    }
                    return(true);
                });

                /*
                 * int n = 0;
                 * while (ypos < winHeight - margin && (page + n) < filteredItems.Count) {
                 *
                 *      bool hasMarkup = win.DataProvider.HasMarkup (filteredItems[page + n]);
                 *      if (hasMarkup) {
                 *              layout.SetMarkup (win.DataProvider.GetMarkup (filteredItems[page + n]) ?? "&lt;null&gt;");
                 *      } else {
                 *              layout.SetText (win.DataProvider.GetText (filteredItems[page + n]) ?? "<null>");
                 *      }
                 *      string text = win.DataProvider.GetText (filteredItems[page + n]);
                 *      if ((!SelectionEnabled || page + n != selection) && !string.IsNullOrEmpty (text)) {
                 *              int[] matchIndices = Match (CompletionString, text);
                 *              if (matchIndices != null) {
                 *                      Pango.AttrList attrList = layout.Attributes ?? new Pango.AttrList ();
                 *                      for (int newSelection = 0; newSelection < matchIndices.Length; newSelection++) {
                 *                              int idx = matchIndices[newSelection];
                 *                              Pango.AttrForeground fg = new Pango.AttrForeground (0, 0, ushort.MaxValue);
                 *                              fg.StartIndex = (uint)idx;
                 *                              fg.EndIndex = (uint)(idx + 1);
                 *                              attrList.Insert (fg);
                 *                      }
                 *                      layout.Attributes = attrList;
                 *              }
                 *      }
                 *
                 *      Gdk.Pixbuf icon = win.DataProvider.GetIcon (filteredItems[page + n]);
                 *      int iconHeight, iconWidth;
                 *      if (icon != null) {
                 *              iconWidth = icon.Width;
                 *              iconHeight = icon.Height;
                 *      } else if (!Gtk.Icon.SizeLookup (Gtk.IconSize.Menu, out iconWidth, out iconHeight)) {
                 *              iconHeight = iconWidth = 24;
                 *      }
                 *
                 *      int wi, he, typos, iypos;
                 *      layout.GetPixelSize (out wi, out he);
                 *      typos = he < rowHeight ? ypos + (rowHeight - he) / 2 : ypos;
                 *      iypos = iconHeight < rowHeight ? ypos + (rowHeight - iconHeight) / 2 : ypos;
                 *      if (page + n == selection) {
                 *              if (SelectionEnabled) {
                 *                      window.DrawRectangle (this.Style.BaseGC (StateType.Selected), true, margin, ypos, lineWidth, he + padding);
                 *                      window.DrawLayout (this.Style.TextGC (StateType.Selected), xpos + iconWidth + 2, typos, layout);
                 *              } else {
                 *                      window.DrawRectangle (this.Style.DarkGC (StateType.Prelight), false, margin, ypos, lineWidth - 1, he + padding - 1);
                 *                      window.DrawLayout (this.Style.TextGC (StateType.Normal), xpos + iconWidth + 2, typos, layout);
                 *              }
                 *      } else
                 *              window.DrawLayout (this.Style.TextGC (StateType.Normal), xpos + iconWidth + 2, typos, layout);
                 *      if (icon != null)
                 *              window.DrawPixbuf (this.Style.ForegroundGC (StateType.Normal), icon, 0, 0, xpos, iypos, iconWidth, iconHeight, Gdk.RgbDither.None, 0, 0);
                 *      ypos += rowHeight;
                 *      n++;
                 *      if (hasMarkup)
                 *              layout.SetMarkup (string.Empty);
                 *      if (layout.Attributes != null) {
                 *              layout.Attributes.Dispose ();
                 *              layout.Attributes = null;
                 *      }
                 * }
                 */
                return(false);
            }
        }
예제 #14
0
 public HslColor(Cairo.Color color) : this(color.ToGdkColor())
 {
 }
		protected override void OnShown ()
		{
			var scheme = SyntaxModeService.GetColorStyle (IdeApp.Preferences.ColorScheme);
			Theme.SetSchemeColors (scheme);
			foreColor = scheme.PlainText.Foreground;
			headlabel.ModifyFg (StateType.Normal, foreColor.ToGdkColor ());

			base.OnShown ();
		}