public override Control GetVisualizerWidget (ObjectValue val)
		{
			string value = val.Value;
			Gdk.Color col = new Gdk.Color (85, 85, 85);

			if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]"))
				value = '"' + GetString (val) + '"';
			if (DebuggingService.HasInlineVisualizer (val))
				value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);

			var label = new Gtk.Label ();
			label.Text = value;
			var font = label.Style.FontDescription.Copy ();

			if (font.SizeIsAbsolute) {
				font.AbsoluteSize = font.Size - 1;
			} else {
				font.Size -= (int)(Pango.Scale.PangoScale);
			}

			label.ModifyFont (font);
			label.ModifyFg (StateType.Normal, col);
			label.SetPadding (4, 4);

			if (label.SizeRequest ().Width > 500) {
				label.WidthRequest = 500;
				label.Wrap = true;
				label.LineWrapMode = Pango.WrapMode.WordChar;
			} else {
				label.Justify = Gtk.Justification.Center;
			}

			if (label.Layout.GetLine (1) != null) {
				label.Justify = Gtk.Justification.Left;
				var line15 = label.Layout.GetLine (15);
				if (line15 != null) {
					label.Text = value.Substring (0, line15.StartIndex).TrimEnd ('\r', '\n') + "\n…";
				}
			}

			label.Show ();

			return label;
		}
Ejemplo n.º 2
0
    public static void ChronopicColors(Gtk.Viewport v, Gtk.Label l1, Gtk.Label l2, bool connected)
    {
        //if(! v.Style.Background(StateType.Normal).Equal(BLUE))
        if (!v.Style.Background(StateType.Normal).Equal(v.Style.Background(StateType.Selected)))
        {
            chronopicViewportDefaultBg = v.Style.Background(StateType.Normal);
        }
        if (!l1.Style.Foreground(StateType.Normal).Equal(WHITE))
        {
            chronopicLabelsDefaultFg = l1.Style.Foreground(StateType.Normal);
        }

        if (connected)
        {
            v.ModifyBg(StateType.Normal, chronopicViewportDefaultBg);
            l1.ModifyFg(StateType.Normal, chronopicLabelsDefaultFg);
            l2.ModifyFg(StateType.Normal, chronopicLabelsDefaultFg);
        }
        else
        {
            //v.ModifyBg(StateType.Normal, BLUE);
            v.ModifyBg(StateType.Normal, v.Style.Background(StateType.Selected));
            l1.ModifyFg(StateType.Normal, WHITE);
            l2.ModifyFg(StateType.Normal, WHITE);
        }
    }
Ejemplo n.º 3
0
        public SparkleLink(string title, string url)
            : base()
        {
            Label label = new Label () {
                Ellipsize = Pango.EllipsizeMode.Middle,
                UseMarkup = true,
                Markup = title,
                Xalign    = 0
            };

            Add (label);

            Gdk.Color color = new Gdk.Color ();

            // Only make links for files that exist
            if (!url.StartsWith ("http://") && !File.Exists (url)) {

                // Use Tango Aluminium for the links
                Gdk.Color.Parse ("#2e3436", ref color);
                label.ModifyFg (StateType.Normal, color);
                return;

            }

            // Use Tango Sky Blue for the links
            Gdk.Color.Parse ("#3465a4", ref color);
            label.ModifyFg (StateType.Normal, color);

            // Open the URL when it is clicked
            ButtonReleaseEvent += delegate {

                Process process = new Process ();
                process.StartInfo.FileName  = "gnome-open";
                process.StartInfo.Arguments = url.Replace (" ", "\\ "); // Escape space-characters
                process.Start ();

            };

            // Add underline when hovering the link with the cursor
            EnterNotifyEvent += delegate {

                label.Markup = "<u>" + title + "</u>";
                ShowAll ();
                Realize ();
                GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Hand2);

            };

            // Remove underline when leaving the link with the cursor
            LeaveNotifyEvent += delegate {

                label.Markup = title;
                ShowAll ();
                Realize ();
                GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Arrow);

            };
        }
Ejemplo n.º 4
0
 void UpdateColor()
 {
     if (isActive)
     {
         slabel.ModifyFg(StateType.Normal, normalColor);
     }
     else
     {
         HslColor c = normalColor;
         c.L += 0.3;
         slabel.ModifyFg(StateType.Normal, c);
     }
 }
 public void UpdateTitleColor(Gdk.Color?titleColor)
 {
     if (_titleLabel != null)
     {
         if (titleColor.HasValue)
         {
             _titleLabel.ModifyFg(StateType.Normal, titleColor.Value);
         }
         else
         {
             _titleLabel.ModifyFg(StateType.Normal, _defaultTextColor);
         }
     }
 }
Ejemplo n.º 6
0
		public Category (Tiles.TileGroupInfo info, int columns)
		{
			WidgetFlags |= WidgetFlags.NoWindow;

			header = new Gtk.HBox (false, 0);

			headerExpander = new Gtk.Expander ("<big><b>" + GLib.Markup.EscapeText (info.Name) + "</b></big>");
			((Gtk.Label) headerExpander.LabelWidget).SetAlignment (0.0f, 0.5f);
			headerExpander.UseMarkup = true;
			headerExpander.UseUnderline = true;
			headerExpander.Show ();
			header.PackStart (headerExpander, true, true, 0);

			headerExpander.Activated += OnActivated;
			
			scope = Tiles.Utils.TileGroupToScopeType(info.Group);
			
			position = new Gtk.Label ();
			position.ModifyFg (Gtk.StateType.Normal, position.Style.Base (Gtk.StateType.Selected));
			header.PackStart (position, false, false, 0);
			position.Show ();

			prev = MakeButton (header, Gtk.Stock.GoBack, OnPrev);
			next = MakeButton (header, Gtk.Stock.GoForward, OnNext);

			header.Show ();
			header.Parent = this;
			header.SizeRequested += HeaderSizeRequested;

			tiles = new SortedTileList (Beagle.Search.SortType.Relevance);
			Columns = columns;

			UpdateButtons ();
			Expanded = true;	
		}
Ejemplo n.º 7
0
        public EntryCell(
            string label,
            Gdk.Color labelColor,
            string text,
            string placeholder)
        {
            _root = new VBox();
            Add(_root);

            _textLabel = new Gtk.Label();
            _textLabel.SetAlignment(0, 0);
            _textLabel.Text = label ?? string.Empty;
            _textLabel.ModifyFg(StateType.Normal, labelColor);

            _root.PackStart(_textLabel, false, false, 0);

            _entryWrapper                    = new EntryWrapper();
            _entryWrapper.Sensitive          = true;
            _entryWrapper.Entry.Text         = text ?? string.Empty;
            _entryWrapper.PlaceholderText    = placeholder ?? string.Empty;
            _entryWrapper.Entry.Changed     += OnEntryChanged;
            _entryWrapper.Entry.EditingDone += OnEditingDone;

            _root.PackStart(_entryWrapper, false, false, 0);
        }
Ejemplo n.º 8
0
        public Category(Tiles.TileGroupInfo info, int columns)
        {
            WidgetFlags |= WidgetFlags.NoWindow;

            header = new Gtk.HBox(false, 0);

            headerExpander = new Gtk.Expander("<big><b>" + GLib.Markup.EscapeText(info.Name) + "</b></big>");
            ((Gtk.Label)headerExpander.LabelWidget).SetAlignment(0.0f, 0.5f);
            headerExpander.UseMarkup    = true;
            headerExpander.UseUnderline = true;
            headerExpander.Show();
            header.PackStart(headerExpander, true, true, 0);

            headerExpander.Activated += OnActivated;

            scope = Tiles.Utils.TileGroupToScopeType(info.Group);

            position = new Gtk.Label();
            position.ModifyFg(Gtk.StateType.Normal, position.Style.Base(Gtk.StateType.Selected));
            header.PackStart(position, false, false, 0);
            position.Show();

            prev = MakeButton(header, Gtk.Stock.GoBack, OnPrev);
            next = MakeButton(header, Gtk.Stock.GoForward, OnNext);

            header.Show();
            header.Parent         = this;
            header.SizeRequested += HeaderSizeRequested;

            tiles   = new SortedTileList(Beagle.Search.SortType.Relevance);
            Columns = columns;

            UpdateButtons();
            Expanded = true;
        }
Ejemplo n.º 9
0
        public Tile ()
        {
            Table table = new Table (2, 2, false);
            table.ColumnSpacing = 6;
            table.RowSpacing = 2;
            table.BorderWidth = 2;

            PrimaryLabel = new Label ();
            SecondaryLabel = new Label ();

            table.Attach (image, 0, 1, 0, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            table.Attach (PrimaryLabel, 1, 2, 0, 1,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            table.Attach (SecondaryLabel, 1, 2, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);

            table.ShowAll ();
            Add (table);

            PrimaryLabel.Xalign = 0.0f;
            PrimaryLabel.Yalign = 0.0f;

            SecondaryLabel.Xalign = 0.0f;
            SecondaryLabel.Yalign = 0.0f;

            StyleSet += delegate {
                PrimaryLabel.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
                SecondaryLabel.ModifyFg (StateType.Normal, Hyena.Gui.GtkUtilities.ColorBlend (
                    Style.Foreground (StateType.Normal), Style.Background (StateType.Normal)));
            };

            Relief = ReliefStyle.None;
        }
Ejemplo n.º 10
0
        public ArtworkPopup() : base(Gtk.WindowType.Popup)
        {
            VBox vbox = new VBox();
            Add(vbox);

            Decorated = false;
            BorderWidth = 6;

            SetPosition(WindowPosition.CenterAlways);

            image = new Gtk.Image();
            label = new Label(String.Empty);
            label.CanFocus = false;
            label.Wrap = true;

            label.ModifyBg(StateType.Normal, new Color(0, 0, 0));
            label.ModifyFg(StateType.Normal, new Color(160, 160, 160));
            ModifyBg(StateType.Normal, new Color(0, 0, 0));
            ModifyFg(StateType.Normal, new Color(160, 160, 160));

            vbox.PackStart(image, true, true, 0);
            vbox.PackStart(label, false, false, 0);

            vbox.Spacing = 6;
            vbox.ShowAll();
        }
Ejemplo n.º 11
0
        public TitledList(string title_str)
            : base()
        {
            genre_map = new Dictionary<string, Genre> ();
            title = new Label ();
            title.Xalign = 0;
            title.Ellipsize = Pango.EllipsizeMode.End;
            title.Markup = String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (title_str));

            PackStart (title, false, false, 0);
            title.Show ();

            StyleSet += delegate {
                title.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
                title.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
            };

            tile_view = new TileView (2);
            PackStart (tile_view, true, true, 0);
            tile_view.Show ();

            StyleSet += delegate {
                tile_view.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
                tile_view.ModifyFg (StateType.Normal, Style.Base (StateType.Normal));
            };
        }
Ejemplo n.º 12
0
 private void UpdateTextColor(Gdk.Color textColor)
 {
     if (_textLabel != null)
     {
         _textLabel.ModifyFg(StateType.Normal, textColor);
     }
 }
Ejemplo n.º 13
0
        void DisplayUploadNotification(MainWindow mainWindow)
        {
            //set our window width
            int frameWidth  = 250;
            int frameHeight = 100;
            int screenWidth = Gdk.Screen.Default.Width;

            //need to dispose of all our stuff in the window to handle memory
            DestroyMostlyEverything();


            //add event box
            notificationEventBox = new EventBox();

            //add click event to close app on click
            notificationEventBox.ButtonPressEvent += OnActivated;

            //add label to eb
            notificationMessage = new Gtk.Label("Image Uploaded. Link copied to clipboard");
            notificationMessage.ModifyFg(StateType.Normal, new Gdk.Color(255, 255, 255));              //change font color to white
            notificationEventBox.Add(notificationMessage);

            mainWindow.Decorated = false;
            mainWindow.Resize(frameWidth, frameHeight);
            mainWindow.Move((screenWidth - frameWidth), 0);

            //change background color to black
            notificationEventBox.ModifyBg(StateType.Normal, new Gdk.Color(67, 67, 67));

            mainWindow.Add(notificationEventBox);
            mainWindow.ShowAll();

            //fadeout timer function
            GLib.Timeout.Add(100, new GLib.TimeoutHandler(update_opacity));
        }
Ejemplo n.º 14
0
 private void UpdateDetailColor(Gdk.Color detailColor)
 {
     if (_detailLabel != null)
     {
         _detailLabel.ModifyFg(StateType.Normal, detailColor);
     }
 }
Ejemplo n.º 15
0
        public TextCell(
            string text,
            Gdk.Color textColor,
            string detail,
            Gdk.Color detailColor)
        {
            _root = new VBox();

            var span = new Span()
            {
                FontSize = 12,
                Text     = text ?? string.Empty
            };

            _textLabel = new Gtk.Label();
            _textLabel.SetAlignment(0, 0);
            _textLabel.ModifyFg(StateType.Normal, textColor);
            _textLabel.SetTextFromSpan(span);

            _root.PackStart(_textLabel, false, false, 0);

            _detailLabel = new Gtk.Label();
            _detailLabel.SetAlignment(0, 0);
            _detailLabel.ModifyFg(StateType.Normal, detailColor);
            _detailLabel.Text = detail ?? string.Empty;

            _root.PackStart(_detailLabel, true, true, 0);

            Add(_root);
        }
Ejemplo n.º 16
0
        public override Control GetVisualizerWidget(ObjectValue val)
        {
            string value = val.Value;

            Gdk.Color col = new Gdk.Color(85, 85, 85);

            if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]"))
            {
                value = '"' + GetString(val) + '"';
            }
            if (DebuggingService.HasInlineVisualizer(val))
            {
                value = DebuggingService.GetInlineVisualizer(val).InlineVisualize(val);
            }

            var label = new Gtk.Label();

            label.Text = value;
            var font = label.Style.FontDescription.Copy();

            if (font.SizeIsAbsolute)
            {
                font.AbsoluteSize = font.Size - 1;
            }
            else
            {
                font.Size -= (int)(Pango.Scale.PangoScale);
            }

            label.ModifyFont(font);
            label.ModifyFg(StateType.Normal, col);
            label.SetPadding(4, 4);

            if (label.SizeRequest().Width > 500)
            {
                label.WidthRequest = 500;
                label.Wrap         = true;
                label.LineWrapMode = Pango.WrapMode.WordChar;
            }
            else
            {
                label.Justify = Gtk.Justification.Center;
            }

            if (label.Layout.GetLine(1) != null)
            {
                label.Justify = Gtk.Justification.Left;
                var line15 = label.Layout.GetLine(15);
                if (line15 != null)
                {
                    label.Text = value.Substring(0, line15.StartIndex).TrimEnd('\r', '\n') + "\n…";
                }
            }

            label.Show();

            return(label);
        }
Ejemplo n.º 17
0
 public void ShowWord(string word)
 {
     imageCanvas.ModifyFg(Gtk.StateType.Normal, fontColor);
     eventBox.ModifyBg(Gtk.StateType.Normal, backgroundColor);
     imageCanvas.ModifyFont(Pango.FontDescription.FromString(fontName));
     imageCanvas.Text      = word;
     imageCanvas.UseMarkup = false;
     imageCanvas.CanFocus  = false;
     imageCanvas.ShowAll();
 }
Ejemplo n.º 18
0
 private Label CreateLabel (string value)
 {
     Label label = new Label ();
     label.Xalign = 1.0f;
     label.Markup = String.Format ("<small>{0}</small>", GLib.Markup.EscapeText (value));
     label.ModifyFg (StateType.Normal, Hyena.Gui.GtkUtilities.ColorBlend (
         Style.Foreground (StateType.Normal), Style.Background (StateType.Normal)));
     label.Show ();
     return label;
 }
Ejemplo n.º 19
0
        public LinkLabel(string text, Uri uri)
        {
            CanFocus = true;
            AppPaintable = true;

            this.uri = uri;

            label = new Label(text);
            label.ModifyFg(Gtk.StateType.Normal, link_color);
            label.Show();
            Add(label);
        }
Ejemplo n.º 20
0
        public override Control GetVisualizerWidget(ObjectValue val)
        {
            var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone();

            ops.AllowTargetInvoke = true;
            ops.ChunkRawStrings   = true;
            ops.EllipsizedLength  = 5000; //Preview window can hold aprox. 4700 chars
            val.Refresh(ops);             //Refresh DebuggerDisplay/String value with full length instead of ellipsized
            string value = val.Value;

            Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor();

            if (DebuggingService.HasInlineVisualizer(val))
            {
                value = DebuggingService.GetInlineVisualizer(val).InlineVisualize(val);
            }

            var label = new Gtk.Label();

            label.Text = value;
            label.ModifyFont(FontService.SansFont.CopyModified(Ide.Gui.Styles.FontScale11));
            label.ModifyFg(StateType.Normal, col);
            label.SetPadding(4, 4);

            if (label.SizeRequest().Width > 500)
            {
                label.WidthRequest = 500;
                label.Wrap         = true;
                label.LineWrapMode = Pango.WrapMode.WordChar;
            }
            else
            {
                label.Justify = Gtk.Justification.Center;
            }

            if (label.Layout.GetLine(1) != null)
            {
                label.Justify = Gtk.Justification.Left;
                var trimmedLine = label.Layout.GetLine(50);
                if (trimmedLine != null)
                {
                    label.Text = value.Substring(0, trimmedLine.StartIndex).TrimEnd('\r', '\n') + "\n…";
                }
            }
            label.Selectable = true;
            label.CanFocus   = false;
            label.Show();

            return(label);
        }
        public override Control GetVisualizerWidget(ObjectValue val)
        {
            string value = val.Value;

            Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor();

            if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]"))
            {
                value = '"' + GetString(val) + '"';
            }
            if (DebuggingService.HasInlineVisualizer(val))
            {
                value = DebuggingService.GetInlineVisualizer(val).InlineVisualize(val);
            }

            var label = new Gtk.Label();

            label.Text = value;
            label.ModifyFont(FontService.SansFont.CopyModified(Ide.Gui.Styles.FontScale11));
            label.ModifyFg(StateType.Normal, col);
            label.SetPadding(4, 4);

            if (label.SizeRequest().Width > 500)
            {
                label.WidthRequest = 500;
                label.Wrap         = true;
                label.LineWrapMode = Pango.WrapMode.WordChar;
            }
            else
            {
                label.Justify = Gtk.Justification.Center;
            }

            if (label.Layout.GetLine(1) != null)
            {
                label.Justify = Gtk.Justification.Left;
                var line15 = label.Layout.GetLine(15);
                if (line15 != null)
                {
                    label.Text = value.Substring(0, line15.StartIndex).TrimEnd('\r', '\n') + "\n…";
                }
            }

            label.Show();

            return(label);
        }
Ejemplo n.º 22
0
        HBox GetSnackBarLayout(Container?container, SnackBarOptions arguments)
        {
            var snackBarLayout = new HBox();

            snackBarLayout.ModifyBg(StateType.Normal, arguments.BackgroundColor.ToGtkColor());

            var message = new Gtk.Label(arguments.MessageOptions.Message);

            message.ModifyFont(new FontDescription {
                AbsoluteSize = arguments.MessageOptions.Font.FontSize, Family = arguments.MessageOptions.Font.FontFamily
            });
            message.ModifyFg(StateType.Normal, arguments.MessageOptions.Foreground.ToGtkColor());
            message.SetPadding((int)arguments.MessageOptions.Padding.Left, (int)arguments.MessageOptions.Padding.Top);
            snackBarLayout.Add(message);
            snackBarLayout.SetChildPacking(message, false, false, 0, PackType.Start);

            foreach (var action in arguments.Actions)
            {
                var button = new Gtk.Button
                {
                    Label = action.Text
                };
                button.ModifyFont(new FontDescription {
                    AbsoluteSize = action.Font.FontSize, Family = action.Font.FontFamily
                });
                button.ModifyBg(StateType.Normal, action.BackgroundColor.ToGtkColor());
                button.ModifyFg(StateType.Normal, action.ForegroundColor.ToGtkColor());

                button.Clicked += async(sender, e) =>
                {
                    snackBarTimer?.Stop();

                    if (action.Action != null)
                    {
                        await action.Action();
                    }

                    arguments.SetResult(true);
                    container?.Remove(snackBarLayout);
                };

                snackBarLayout.Add(button);
                snackBarLayout.SetChildPacking(button, false, false, 0, PackType.End);
            }

            return(snackBarLayout);
        }
Ejemplo n.º 23
0
        public TitledList (string title_str) : base (false, 3)
        {
            title = new Label ();
            title.Xalign = 0;
            title.Wrap = true;
            title.Layout.Wrap = Pango.WrapMode.Word;
            title.Ellipsize = Pango.EllipsizeMode.None;
            Title = title_str;

            PackStart (title, false, false, 0);
            title.Show ();

            StyleSet += delegate {
                title.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
                title.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
            };
        }
Ejemplo n.º 24
0
		public void Append (string tip)
		{
			uint row = table.NRows;

			Gtk.Image image = new Gtk.Image (arrow);
			image.Show ();
			table.Attach (image, 0, 1, row, row + 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);

			Gtk.Label label = new Gtk.Label ();
			label.Markup = tip;
			label.LineWrap = true;
			label.Justify = Justification.Fill;
			label.SetAlignment (0.0f, 0.5f);
			label.ModifyFg (Gtk.StateType.Normal, label.Style.Foreground (Gtk.StateType.Insensitive));
			label.Show ();
			table.Attach (label, 1, 2, row, row + 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0, 0);
		}
Ejemplo n.º 25
0
        public void Append(string tip)
        {
            uint row = table.NRows;

            Gtk.Image image = new Gtk.Image(arrow);
            image.Show();
            table.Attach(image, 0, 1, row, row + 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);

            Gtk.Label label = new Gtk.Label();
            label.Markup   = tip;
            label.LineWrap = true;
            label.Justify  = Justification.Fill;
            label.SetAlignment(0.0f, 0.5f);
            label.ModifyFg(Gtk.StateType.Normal, label.Style.Foreground(Gtk.StateType.Insensitive));
            label.Show();
            table.Attach(label, 1, 2, row, row + 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0, 0);
        }
		public override Control GetVisualizerWidget (ObjectValue val)
		{
			var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
			ops.AllowTargetInvoke = true;
			ops.ChunkRawStrings = true;
			ops.EllipsizedLength = 5000;//Preview window can hold aprox. 4700 chars
			val.Refresh (ops);//Refresh DebuggerDisplay/String value with full length instead of ellipsized
			string value = val.Value;
			Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor ();

			if (DebuggingService.HasInlineVisualizer (val))
				value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);

			var label = new Gtk.Label ();
			label.Text = value;
			label.ModifyFont (FontService.SansFont.CopyModified (Ide.Gui.Styles.FontScale11));
			label.ModifyFg (StateType.Normal, col);
			label.SetPadding (4, 4);

			if (label.SizeRequest ().Width > 500) {
				label.WidthRequest = 500;
				label.Wrap = true;
				label.LineWrapMode = Pango.WrapMode.WordChar;
			} else {
				label.Justify = Gtk.Justification.Center;
			}

			if (label.Layout.GetLine (1) != null) {
				label.Justify = Gtk.Justification.Left;
				var trimmedLine = label.Layout.GetLine (50);
				if (trimmedLine != null) {
					label.Text = value.Substring (0, trimmedLine.StartIndex).TrimEnd ('\r', '\n') + "\n…";
				}
			}

			label.Show ();

			return label;
		}
Ejemplo n.º 27
0
        public ImageCell(
            Gdk.Pixbuf image,
            string text,
            Gdk.Color textColor,
            string detail,
            Gdk.Color detailColor)
        {
            _root = new HBox();
            Add(_root);

            _imageControl        = new Gtk.Image();
            _imageControl.Pixbuf = image;

            _root.PackStart(_imageControl, false, false, 0);

            _vertical = new VBox();

            var span = new Span()
            {
                FontSize = 12,
                Text     = text ?? string.Empty
            };

            _textLabel = new Gtk.Label();
            _textLabel.SetAlignment(0, 0);
            _textLabel.ModifyFg(StateType.Normal, textColor);
            _textLabel.SetTextFromSpan(span);

            _vertical.PackStart(_textLabel, false, false, 0);

            _detailLabel = new Gtk.Label();
            _detailLabel.SetAlignment(0, 0);
            _detailLabel.ModifyFg(StateType.Normal, detailColor);
            _detailLabel.Text = detail ?? string.Empty;

            _vertical.PackStart(_detailLabel, true, true, 0);

            _root.PackStart(_vertical, false, false, 0);
        }
		public override Control GetVisualizerWidget (ObjectValue val)
		{
			string value = val.Value;
			Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor ();

			if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]"))
				value = '"' + GetString (val) + '"';
			if (DebuggingService.HasInlineVisualizer (val))
				value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);

			var label = new Gtk.Label ();
			label.Text = value;
			label.ModifyFont (FontService.SansFont.CopyModified (Ide.Gui.Styles.FontScale11));
			label.ModifyFg (StateType.Normal, col);
			label.SetPadding (4, 4);

			if (label.SizeRequest ().Width > 500) {
				label.WidthRequest = 500;
				label.Wrap = true;
				label.LineWrapMode = Pango.WrapMode.WordChar;
			} else {
				label.Justify = Gtk.Justification.Center;
			}

			if (label.Layout.GetLine (1) != null) {
				label.Justify = Gtk.Justification.Left;
				var line15 = label.Layout.GetLine (15);
				if (line15 != null) {
					label.Text = value.Substring (0, line15.StartIndex).TrimEnd ('\r', '\n') + "\n…";
				}
			}

			label.Show ();

			return label;
		}
Ejemplo n.º 29
0
        private void ChangeColor(byte sel)
        {
            Gdk.Color color;

            switch (sel)
            {
            case 1:
                color = new Gdk.Color(255, 0, 0);
                break;

            case 2:
                color = new Gdk.Color(0, 0, 255);
                break;

            default:
                color = new Gdk.Color(232, 27, 92);
                break;
            }

            lblpoints.ModifyFg(Gtk.StateType.Normal, color);
            //lblpoints.ModifyFg(Gtk.StateType.Active, color);
            //lblpoints.ModifyFg(Gtk.StateType.Inactive, color);
            //lblpoints.ModifyFg(Gtk.StateType.Selected, color);
        }
Ejemplo n.º 30
0
 private Widget UserInfoBox()
 {
     VBox userInfo = new VBox(false, 0);
        string lable = null;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("Server: {0}"),lable);
       labeliFolderServer = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       userInfo.PackStart(labeliFolderServer, false, false, 0);
       labeliFolderServer.UseMarkup = true;
        labeliFolderServer.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labeliFolderServer.Xalign = 0.0F;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("Last Successfull Sync time: {0}"),lable);
       labelLastSyncTime = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       userInfo.PackStart(labelLastSyncTime, false, false, 0);
       labelLastSyncTime.UseMarkup = true;
        labelLastSyncTime.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labelLastSyncTime.Xalign = 0.0F;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("File/Folder to synchronize: {0}"),lable);
       labelFolderToSync = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       userInfo.PackStart(labelFolderToSync, false, false, 0);
       labelFolderToSync.UseMarkup = true;
        labelFolderToSync.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labelFolderToSync.Xalign = 0.0F;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("iFolder Size: {0}"),lable);
       labeliFolderSize = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       userInfo.PackStart(labeliFolderSize, false, false, 0);
       labeliFolderSize.UseMarkup = true;
        labeliFolderSize.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labeliFolderSize.Xalign = 0.0F;
        labeliFolderSize.Hide();
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("iFolder Type: {0}"),lable);
       labeliFolderType = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       userInfo.PackStart(labeliFolderType, false, false, 0);
       labeliFolderType.UseMarkup = true;
        labeliFolderType.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labeliFolderType.Xalign = 0.0F;
        labeliFolderType.Hide();
        return userInfo;
 }
Ejemplo n.º 31
0
 private Widget CreateWidgets()
 {
     table = new Table(1, 2, false);
        table.ColumnSpacing = 12;
        table.BorderWidth = 4;
        image = new Image(normalPixbuf);
        table.Attach(image,
        0, 1,
        0, 1,
        AttachOptions.Shrink,
        0, 0, 0);
        VBox vbox = new VBox(false, 0);
        table.Attach(vbox,
        1, 2,
        0, 1,
        AttachOptions.Expand | AttachOptions.Fill,
        0, 0, 0);
        widthForLabels = (int)maxWidth - (int)normalPixbuf.Width
     - (int)table.ColumnSpacing - (int)(table.BorderWidth * 2);
        nameLabel = new Label("<span size=\"large\"></span>");
        vbox.PackStart(nameLabel, false, false, 0);
        nameLabel.UseMarkup = true;
        nameLabel.UseUnderline = false;
        nameLabel.Xalign = 0;
        Requisition req = nameLabel.SizeRequest();
        nameLabel.SetSizeRequest(widthForLabels, -1);
        Util.GtkLabelSetMaxWidthChars(nameLabel, widthForLabels);
        Util.GtkLabelSetEllipsize(nameLabel, true);
        locationLabel = new Label("<span size=\"small\"></span>");
        vbox.PackStart(locationLabel, false, false, 0);
        locationLabel.UseMarkup = true;
        locationLabel.UseUnderline = false;
        locationLabel.ModifyFg(StateType.Normal, this.Style.Base(StateType.Active));
        locationLabel.Xalign = 0;
        req = locationLabel.SizeRequest();
        locationLabel.SetSizeRequest(widthForLabels, req.Height);
        Util.GtkLabelSetMaxWidthChars(locationLabel, widthForLabels);
        Util.GtkLabelSetEllipsize(locationLabel, true);
        statusLabel = new Label("<span size=\"small\"></span>");
        vbox.PackStart(statusLabel, false, false, 0);
        statusLabel.UseMarkup = true;
        statusLabel.UseUnderline = false;
        statusLabel.ModifyFg(StateType.Normal, this.Style.Base(StateType.Active));
        statusLabel.Xalign = 0;
        req = statusLabel.SizeRequest();
        statusLabel.SetSizeRequest(widthForLabels, req.Height);
        Util.GtkLabelSetMaxWidthChars(statusLabel, widthForLabels);
        Util.GtkLabelSetEllipsize(statusLabel, true);
        return table;
 }
Ejemplo n.º 32
0
 private Widget CreateiFolderActionButtonArea()
 {
     EventBox buttonArea = new EventBox();
        VBox actionsVBox = new VBox(false, 0);
        actionsVBox.WidthRequest = 100;
        buttonArea.ModifyBg(StateType.Normal, this.Style.Background(StateType.Normal));
        buttonArea.Add(actionsVBox);
        buttontips = new Tooltips();
     HBox ButtonControl = new HBox (false, 0);
        actionsVBox.PackStart(ButtonControl, false, false, 0);
        Image stopImage = new Image(Stock.Stop, Gtk.IconSize.Menu);
        stopImage.SetAlignment(0.5F, 0F);
        CancelSearchButton = new Button(stopImage);
        CancelSearchButton.Sensitive = false;
        CancelSearchButton.Clicked +=
     new EventHandler(OnCancelSearchButton);
        CancelSearchButton.Visible = false;
        HBox spacerHBox = new HBox(false, 0);
        ButtonControl.PackStart(spacerHBox, false, false, 0);
        HBox vbox = new HBox(false, 0);
        spacerHBox.PackStart(vbox, true, true, 0);
        HBox hbox = new HBox(false, 0);
        AddiFolderButton = new Button(hbox);
        vbox.PackStart(AddiFolderButton, false, false, 0);
        Label buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Upload a folder...")));
        hbox.PackStart(buttonText, false, false, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        AddiFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png")));
        AddiFolderButton.Clicked +=
     new EventHandler(AddiFolderHandler);
        buttontips.SetTip(AddiFolderButton, Util.GS("Create iFolder"),"");
        hbox = new HBox(false, 0);
        ShowHideAllFoldersButton = new Button(hbox);
        vbox.PackStart(ShowHideAllFoldersButton, false, false, 0);
        ShowHideAllFoldersButtonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("View available iFolders")));
        hbox.PackStart(ShowHideAllFoldersButtonText, false, false, 4);
        ShowHideAllFoldersButtonText.UseMarkup = true;
        ShowHideAllFoldersButtonText.UseUnderline = false;
        ShowHideAllFoldersButtonText.Xalign = 0;
        ShowHideAllFoldersButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png")));
        ShowHideAllFoldersButton.Clicked +=
     new EventHandler(ShowHideAllFoldersHandler);
        buttontips.SetTip(ShowHideAllFoldersButton, Util.GS("Show or Hide iFolder"),"");
        hbox = new HBox(false, 0);
        DownloadAvailableiFolderButton = new Button(hbox);
        vbox.PackStart(DownloadAvailableiFolderButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Download...")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        DownloadAvailableiFolderButton.Sensitive = false;
        DownloadAvailableiFolderButton.Image= new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder-download48.png")));
        DownloadAvailableiFolderButton.Clicked +=
     new EventHandler(DownloadAvailableiFolderHandler);
        buttontips.SetTip(DownloadAvailableiFolderButton, Util.GS("Download"),"");
        hbox = new HBox(false, 0);
        MergeAvailableiFolderButton = new Button(hbox);
        vbox.PackStart(MergeAvailableiFolderButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Merge")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        MergeAvailableiFolderButton.Sensitive = false;
        MergeAvailableiFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("merge48.png")));
        MergeAvailableiFolderButton.Clicked +=
     new EventHandler(MergeAvailableiFolderHandler);
        buttontips.SetTip(MergeAvailableiFolderButton, Util.GS("Merge"),"");
        hbox = new HBox(false, 0);
        RemoveMembershipButton = new Button(hbox);
        vbox.PackStart(RemoveMembershipButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Remove My Membership")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        RemoveMembershipButton.Sensitive = false;
        RemoveMembershipButton.Visible = false;
        RemoveMembershipButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder-error48.png")));
        RemoveMembershipButton.Clicked += new EventHandler(RemoveMembershipHandler);
        buttontips.SetTip(RemoveMembershipButton, Util.GS("Remove My Membership"),"");
        hbox = new HBox(false, 0);
        DeleteFromServerButton = new Button(hbox);
        vbox.PackStart(DeleteFromServerButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Delete from server")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        DeleteFromServerButton.Sensitive = false;
        DeleteFromServerButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("delete_48.png")));
        DeleteFromServerButton.Clicked +=
     new EventHandler(DeleteFromServerHandler);
        buttontips.SetTip(DeleteFromServerButton, Util.GS("Delete from server"),"");
        hbox = new HBox(false, 0);
        ShareSynchronizedFolderButton = new Button(hbox);
        vbox.PackStart(ShareSynchronizedFolderButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Share with...")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        ShareSynchronizedFolderButton.Sensitive= false;
       ShareSynchronizedFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder_share48.png")));
        ShareSynchronizedFolderButton.Clicked +=
     new EventHandler(OnShareSynchronizedFolder);
        buttontips.SetTip(ShareSynchronizedFolderButton, Util.GS("Share with"),"");
        hbox = new HBox(false, 0);
        ResolveConflictsButton = new Button(hbox);
        vbox.PackStart(ResolveConflictsButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Resolve conflicts...")));
        hbox.PackStart(buttonText, false, false, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        ResolveConflictsButton.Sensitive = false;
        ResolveConflictsButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder-conflict48.png")));
        ResolveConflictsButton.Clicked +=
     new EventHandler(OnResolveConflicts);
        buttontips.SetTip(ResolveConflictsButton, Util.GS("Resolve conflicts"),"");
        SynchronizedFolderTasks = new VBox(false, 0);
        ButtonControl.PackStart(SynchronizedFolderTasks, false, false, 0);
        spacerHBox = new HBox(false, 0);
        SynchronizedFolderTasks.PackStart(spacerHBox, false, false, 0);
        hbox = new HBox(false, 0);
        OpenSynchronizedFolderButton = new Button(hbox);
        vbox.PackStart(OpenSynchronizedFolderButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Open...")));
        hbox.PackStart(buttonText, false, false, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        OpenSynchronizedFolderButton.Visible = false;
        OpenSynchronizedFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png")));
        OpenSynchronizedFolderButton.Clicked +=
     new EventHandler(OnOpenSynchronizedFolder);
        buttontips.SetTip(OpenSynchronizedFolderButton, Util.GS("Open iFolder"),"");
        hbox = new HBox(false, 0);
        SynchronizeNowButton = new Button(hbox);
        vbox.PackStart(SynchronizeNowButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Synchronize Now")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        SynchronizeNowButton.Sensitive = false;
       SynchronizeNowButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder-sync48.png")));
        SynchronizeNowButton.Clicked +=
     new EventHandler(OnSynchronizeNow);
        buttontips.SetTip(SynchronizeNowButton, Util.GS("Synchronize Now"),"");
        hbox = new HBox(false, 0);
        RemoveiFolderButton = new Button(hbox);
        vbox.PackStart(RemoveiFolderButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Revert to a Normal Folder")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        RemoveiFolderButton.Sensitive = false;
        RemoveiFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("revert48.png")));
        RemoveiFolderButton.Clicked +=
     new EventHandler(RemoveiFolderHandler);
        buttontips.SetTip(RemoveiFolderButton, Util.GS("Revert to a Normal Folder"),"");
        hbox = new HBox(false, 0);
        ViewFolderPropertiesButton = new Button(hbox);
        vbox.PackStart(ViewFolderPropertiesButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Properties...")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        ViewFolderPropertiesButton.Visible = false;
        ViewFolderPropertiesButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png")));
        ViewFolderPropertiesButton.Clicked +=
     new EventHandler(OnShowFolderProperties);
        buttontips.SetTip(ViewFolderPropertiesButton, Util.GS("Properties"),"");
        ButtonControl.PackStart(new Label(""), false, false, 4);
        HBox searchHBox = new HBox(false, 4);
        searchHBox.WidthRequest = 110;
        ButtonControl.PackEnd(searchHBox, false, false, 0);
        SearchEntry = new Entry();
        searchHBox.PackStart(SearchEntry, true, true, 0);
        SearchEntry.SelectRegion(0, -1);
        SearchEntry.CanFocus = true;
        SearchEntry.Changed +=
     new EventHandler(OnSearchEntryChanged);
        Label l = new Label("<span size=\"small\"></span>");
        l = new Label(
     string.Format(
      "<span size=\"large\">{0}</span>",
      Util.GS("Filter")));
        ButtonControl.PackEnd(l, false, false, 0);
        l.UseMarkup = true;
        l.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
        l.Xalign = 0.0F;
       VBox viewChanger = new VBox(false,0);
        string[] list = {Util.GS("Open Panel"),Util.GS("Close Panel"),Util.GS("Thumbnail View"),Util.GS("List View") };
       viewList = new ComboBoxEntry (list);
        viewList.Active = 0;
        viewList.WidthRequest = 110;
        viewList.Changed += new EventHandler(OnviewListIndexChange);
        VBox dummyVbox = new VBox(false,0);
       Label labeldummy = new Label( string.Format( ""));
       labeldummy.UseMarkup = true;
        dummyVbox.PackStart(labeldummy,false,true,0);
        viewChanger.PackStart(dummyVbox,false,true,0);
        viewChanger.PackStart(viewList,false,true,0);
        ButtonControl.PackEnd(viewChanger, false, true,0);
        return buttonArea;
 }
Ejemplo n.º 33
0
 private Widget iFolderInfoBox()
 {
     VBox iFolderInfo = new VBox(false, 0);
        string lable = null;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("Name: {0}"),lable);
       labelName = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       iFolderInfo.PackStart(labelName, false, false, 0);
       labelName.UseMarkup = true;
        labelName.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labelName.Xalign = 0.0F;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("Access: {0}"),lable);
       labelAccess = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       iFolderInfo.PackStart(labelAccess, false, false, 0);
       labelAccess.UseMarkup = true;
        labelAccess.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labelAccess.Xalign = 0.0F;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("Owner: {0}"),lable);
       labelOwner = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       iFolderInfo.PackStart(labelOwner, false, false, 0);
       labelOwner.UseMarkup = true;
        labelOwner.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labelOwner.Xalign = 0.0F;
        return iFolderInfo;
 }
		public PreviewVisualizerWindow (ObjectValue val, Gtk.Widget invokingWidget) : base (Gtk.WindowType.Toplevel)
		{
			this.TypeHint = WindowTypeHint.PopupMenu;
			this.Decorated = false;
			if (((Gtk.Window)invokingWidget.Toplevel).Modal)
				this.Modal = true;
			TransientFor = (Gtk.Window) invokingWidget.Toplevel;

			Theme.SetFlatColor (new Cairo.Color (245 / 256.0, 245 / 256.0, 245 / 256.0));
			Theme.Padding = 3;
			ShowArrow = true;
			var mainBox = new VBox ();
			var headerTable = new Table (1, 3, false);
			headerTable.ColumnSpacing = 5;
			var closeButton = new ImageButton () {
				InactiveImage = ImageService.GetIcon ("md-popup-close", IconSize.Menu),
				Image = ImageService.GetIcon ("md-popup-close-hover", IconSize.Menu)
			};
			closeButton.Clicked += delegate {
				this.Destroy ();
			};
			var hb = new HBox ();
			var vb = new VBox ();
			hb.PackStart (vb, false, false, 0);
			vb.PackStart (closeButton, false, false, 0);
			headerTable.Attach (hb, 0, 1, 0, 1);

			var headerTitle = new Label ();
			headerTitle.ModifyFg (StateType.Normal, new Color (36, 36, 36));
			var font = headerTitle.Style.FontDescription.Copy ();
			font.Weight = Pango.Weight.Bold;
			headerTitle.ModifyFont (font);
			headerTitle.Text = val.TypeName;
			var vbTitle = new VBox ();
			vbTitle.PackStart (headerTitle, false, false, 3);
			headerTable.Attach (vbTitle, 1, 2, 0, 1);

			if (DebuggingService.HasValueVisualizers (val)) {
				var openButton = new Button ();
				openButton.Label = "Open";
				openButton.Relief = ReliefStyle.Half;
				openButton.Clicked += delegate {
					PreviewWindowManager.DestroyWindow ();
					DebuggingService.ShowValueVisualizer (val);
				};
				var hbox = new HBox ();
				hbox.PackEnd (openButton, false, false, 2);
				headerTable.Attach (hbox, 2, 3, 0, 1);
			} else {
				headerTable.Attach (new Label (), 2, 3, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 10, 0);
			}
			mainBox.PackStart (headerTable);
			mainBox.ShowAll ();

			var previewVisualizer = DebuggingService.GetPreviewVisualizer (val);
			if (previewVisualizer == null)
				previewVisualizer = new GenericPreviewVisualizer ();
			Control widget = null;
			try {
				widget = previewVisualizer.GetVisualizerWidget (val);
			} catch (Exception e) {
				DebuggingService.DebuggerSession.LogWriter (true, "Exception during preview widget creation: " + e.Message);
			}
			if (widget == null) {
				widget = new GenericPreviewVisualizer ().GetVisualizerWidget (val);
			}
			var alignment = new Alignment (0, 0, 1, 1);
			alignment.SetPadding (3, 5, 5, 5);
			alignment.Show ();
			alignment.Add (widget);
			mainBox.PackStart (alignment);
			ContentBox.Add (mainBox);
		}
Ejemplo n.º 35
0
 private Widget CreateActions()
 {
     actionsVBox = new VBox(false, 0);
        actionsVBox.WidthRequest = 175;
        Label l = new Label("<span size=\"small\"></span>");
        actionsVBox.PackStart(l, false, false, 0);
        l.UseMarkup = true;
        l = new Label(
     string.Format(
      "<span size=\"large\">{0}</span>",
      Util.GS("Domain List")));
        actionsVBox.PackStart(l, false, false, 0);
        l.UseMarkup = true;
        l.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
        l.Xalign = 0.0F;
        string lable = null;
        ViewUserDomainList = ComboBox.NewText();
        actionsVBox.PackStart(ViewUserDomainList, false, true, 0);
        ViewUserDomainList.Changed += new EventHandler(OnComboBoxIndexChange);
        actionsVBox.PackStart(new Label(""), false, false, 4);
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("User: {0}"),lable);
       labelUser = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
       actionsVBox.PackStart(labelUser, false, false, 0);
       labelUser.UseMarkup = true;
        labelUser.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labelUser.Xalign = 0.0F;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("Server: {0}"),lable);
       labelServer = new Label( string.Format( "<span size=\"medium\">{0}</span>", lable));
     actionsVBox.PackStart(labelServer, false, false, 0);
       labelServer.UseMarkup = true;
        labelServer.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labelServer.Xalign = 0.0F;
        actionsVBox.PackStart(new Label(""), false, false, 0);
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("No. of iFolder: {0}"),lable);
       labeliFolderCount = new Label( string.Format( "<span size=\"medium\">{0}</span>", lable));
       actionsVBox.PackStart(labeliFolderCount, false, false, 0);
       labeliFolderCount.UseMarkup = true;
        labeliFolderCount.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labeliFolderCount.Xalign = 0.0F;
        actionsVBox.PackStart(new Label(""), false, false, 0);
        lable = "";
        lable = string.Format(Util.GS("Disk Quota: {0}"),lable);
        labelDiskQuota = new Label( string.Format( "<span size=\"medium\">{0}</span>", lable));
       actionsVBox.PackStart(labelDiskQuota, false, false, 0);
        labelDiskQuota.UseMarkup = true;
        labelDiskQuota.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
        labelDiskQuota.Xalign = 0.0F;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("Used:") + lable);
       labeliDiskUsed = new Label( string.Format( "<span size=\"medium\">{0}</span>", lable));
      actionsVBox.PackStart(labeliDiskUsed, false, false, 0);
       labeliDiskUsed.UseMarkup = true;
        labeliDiskUsed.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
       labeliDiskUsed.Xalign = 0.0F;
        lable = Util.GS("N/A");
        lable = string.Format(Util.GS("Available:") + lable);
       labeliDiskAvailable = new Label( string.Format( "<span size=\"medium\">{0}</span>", lable));
       actionsVBox.PackStart(labeliDiskAvailable, false, false, 0);
        labeliDiskAvailable.UseMarkup = true;
        labeliDiskAvailable.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
        labeliDiskAvailable.Xalign = 0.0F;
        actionsVBox.PackStart(new Label(""), false, false, 4);
        serverStat = new Button();
        serverStat.Label = Util.GS("N/A");
        serverStat.Clicked += new EventHandler(OnserverStatButtonHandler);
        actionsVBox.PackStart(serverStat, false, false, 0);
        actionsVBox.PackStart(new Label(""), false, false, 4);
        serverImg = new Gtk.Image();
        serverImg.Pixbuf = new Gdk.Pixbuf(Util.ImagesPath("ifolder_discon_128.png"));
        actionsVBox.PackStart(serverImg, false, false, 0);
        return actionsVBox;
 }
Ejemplo n.º 36
0
 public static void ColorsTestLabel(Gtk.Viewport v, Gtk.Label l)
 {
     l.ModifyFg(StateType.Active, v.Style.Foreground(StateType.Selected));
     l.ModifyFg(StateType.Prelight, v.Style.Foreground(StateType.Selected));
 }
Ejemplo n.º 37
0
 private Widget CreateActions()
 {
     VBox actionsVBox = new VBox(false, 0);
        actionsVBox.WidthRequest = 250;
        Label l = new Label("<span size=\"small\"></span>");
        actionsVBox.PackStart(l, false, false, 0);
        l.UseMarkup = true;
        l = new Label(
     string.Format(
      "<span size=\"x-large\">{0}</span>",
      Util.GS("Filter")));
        actionsVBox.PackStart(l, false, false, 0);
        l.UseMarkup = true;
        l.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
        l.Xalign = 0.0F;
        HBox searchHBox = new HBox(false, 4);
        actionsVBox.PackStart(searchHBox, false, false, 0);
        SearchEntry = new Entry();
        searchHBox.PackStart(SearchEntry, true, true, 0);
        SearchEntry.SelectRegion(0, -1);
        SearchEntry.CanFocus = true;
        SearchEntry.Changed +=
     new EventHandler(OnSearchEntryChanged);
        Image stopImage = new Image(Stock.Stop, Gtk.IconSize.Menu);
        stopImage.SetAlignment(0.5F, 0F);
        CancelSearchButton = new Button(stopImage);
        searchHBox.PackEnd(CancelSearchButton, false, false, 0);
        CancelSearchButton.Relief = ReliefStyle.None;
        CancelSearchButton.Sensitive = false;
        CancelSearchButton.Clicked +=
     new EventHandler(OnCancelSearchButton);
        l = new Label("<span size=\"small\"></span>");
        actionsVBox.PackStart(l, false, false, 0);
        l.UseMarkup = true;
        l = new Label(
     string.Format(
      "<span size=\"x-large\">{0}</span>",
      Util.GS("General Actions")));
        actionsVBox.PackStart(l, false, false, 0);
        l.UseMarkup = true;
        l.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
        l.Xalign = 0.0F;
        HBox spacerHBox = new HBox(false, 0);
        actionsVBox.PackStart(spacerHBox, false, false, 0);
        spacerHBox.PackStart(new Label(""), false, false, 4);
        VBox vbox = new VBox(false, 0);
        spacerHBox.PackStart(vbox, true, true, 0);
        HBox hbox = new HBox(false, 0);
        AddiFolderButton = new Button(hbox);
        vbox.PackStart(AddiFolderButton, false, false, 0);
        AddiFolderButton.Relief = ReliefStyle.None;
        Label buttonText = new Label(
     string.Format("<span size=\"large\">{0}</span>",
      Util.GS("Upload a folder...")));
        hbox.PackStart(buttonText, false, false, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        AddiFolderButton.Clicked +=
     new EventHandler(AddiFolderHandler);
        hbox = new HBox(false, 0);
        ShowHideAllFoldersButton = new Button(hbox);
        vbox.PackStart(ShowHideAllFoldersButton, false, false, 0);
        ShowHideAllFoldersButton.Relief = ReliefStyle.None;
        ShowHideAllFoldersButtonText = new Label(
     string.Format("<span size=\"large\">{0}</span>",
      Util.GS("View available iFolders")));
        hbox.PackStart(ShowHideAllFoldersButtonText, false, false, 4);
        ShowHideAllFoldersButtonText.UseMarkup = true;
        ShowHideAllFoldersButtonText.UseUnderline = false;
        ShowHideAllFoldersButtonText.Xalign = 0;
        ShowHideAllFoldersButton.Clicked +=
     new EventHandler(ShowHideAllFoldersHandler);
        l = new Label("<span size=\"small\"></span>");
        actionsVBox.PackStart(l, false, false, 0);
        l.UseMarkup = true;
        SynchronizedFolderTasks = new VBox(false, 0);
        actionsVBox.PackStart(SynchronizedFolderTasks, false, false, 0);
        l = new Label(
     string.Format(
      "<span size=\"x-large\">{0}</span>",
      Util.GS("iFolder Actions")));
        SynchronizedFolderTasks.PackStart(l, false, false, 0);
        l.UseMarkup = true;
        l.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
        l.Xalign = 0.0F;
        spacerHBox = new HBox(false, 0);
        SynchronizedFolderTasks.PackStart(spacerHBox, false, false, 0);
        spacerHBox.PackStart(new Label(""), false, false, 4);
        vbox = new VBox(false, 0);
        spacerHBox.PackStart(vbox, true, true, 0);
        hbox = new HBox(false, 0);
        OpenSynchronizedFolderButton = new Button(hbox);
        vbox.PackStart(OpenSynchronizedFolderButton, false, false, 0);
        OpenSynchronizedFolderButton.Relief = ReliefStyle.None;
        buttonText = new Label(
     string.Format("<span size=\"large\">{0}</span>",
      Util.GS("Open...")));
        hbox.PackStart(buttonText, false, false, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        OpenSynchronizedFolderButton.Clicked +=
     new EventHandler(OnOpenSynchronizedFolder);
        hbox = new HBox(false, 0);
        ResolveConflictsButton = new Button(hbox);
        vbox.PackStart(ResolveConflictsButton, false, false, 0);
        ResolveConflictsButton.Relief = ReliefStyle.None;
        buttonText = new Label(
     string.Format("<span size=\"large\">{0}</span>",
      Util.GS("Resolve conflicts...")));
        hbox.PackStart(buttonText, false, false, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        ResolveConflictsButton.Clicked +=
     new EventHandler(OnResolveConflicts);
        hbox = new HBox(false, 0);
        SynchronizeNowButton = new Button(hbox);
        vbox.PackStart(SynchronizeNowButton, false, false, 0);
        SynchronizeNowButton.Relief = ReliefStyle.None;
        buttonText = new Label(
     string.Format("<span size=\"large\">{0}</span>",
      Util.GS("Synchronize now")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        SynchronizeNowButton.Clicked +=
     new EventHandler(OnSynchronizeNow);
        hbox = new HBox(false, 0);
        ShareSynchronizedFolderButton = new Button(hbox);
        vbox.PackStart(ShareSynchronizedFolderButton, false, false, 0);
        ShareSynchronizedFolderButton.Relief = ReliefStyle.None;
        buttonText = new Label(
     string.Format("<span size=\"large\">{0}</span>",
      Util.GS("Share with...")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        ShareSynchronizedFolderButton.Clicked +=
     new EventHandler(OnShareSynchronizedFolder);
        hbox = new HBox(false, 0);
        RemoveiFolderButton = new Button(hbox);
        vbox.PackStart(RemoveiFolderButton, false, false, 0);
        RemoveiFolderButton.Relief = ReliefStyle.None;
        buttonText = new Label(
     string.Format("<span size=\"large\">{0}</span>",
      Util.GS("Revert to a normal folder")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        RemoveiFolderButton.Clicked +=
     new EventHandler(RemoveiFolderHandler);
        hbox = new HBox(false, 0);
        ViewFolderPropertiesButton = new Button(hbox);
        vbox.PackStart(ViewFolderPropertiesButton, false, false, 0);
        ViewFolderPropertiesButton.Relief = ReliefStyle.None;
        buttonText = new Label(
     string.Format("<span size=\"large\">{0}</span>",
      Util.GS("Properties...")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        ViewFolderPropertiesButton.Clicked +=
     new EventHandler(OnShowFolderProperties);
        hbox = new HBox(false, 0);
        DownloadAvailableiFolderButton = new Button(hbox);
        vbox.PackStart(DownloadAvailableiFolderButton, false, false, 0);
        DownloadAvailableiFolderButton.Relief = ReliefStyle.None;
        buttonText = new Label(
     string.Format("<span size=\"large\">{0}</span>",
      Util.GS("Download...")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        DownloadAvailableiFolderButton.Clicked +=
     new EventHandler(DownloadAvailableiFolderHandler);
        hbox = new HBox(false, 0);
        DeleteFromServerButton = new Button(hbox);
        vbox.PackStart(DeleteFromServerButton, false, false, 0);
        DeleteFromServerButton.Relief = ReliefStyle.None;
        buttonText = new Label(
     string.Format("<span size=\"large\">{0}</span>",
      Util.GS("Delete from server")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        DeleteFromServerButton.Clicked +=
     new EventHandler(DeleteFromServerHandler);
        hbox = new HBox(false, 0);
        RemoveMembershipButton = new Button(hbox);
        vbox.PackStart(RemoveMembershipButton, false, false, 0);
        RemoveMembershipButton.Relief = ReliefStyle.None;
        buttonText = new Label(
     string.Format("<span size=\"large\">{0}</span>",
      Util.GS("Remove my membership")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        RemoveMembershipButton.Clicked +=
     new EventHandler(RemoveMembershipHandler);
        return actionsVBox;
 }
Ejemplo n.º 38
0
 private Widget CreateWidgets()
 {
     iFolderViewGroup.CheckThread();
        contentVBox = new VBox(false, 0);
        contentVBox.BorderWidth = 12;
        nameLabel = new Label(
     string.Format(
      "<span size=\"xx-large\">{0}</span>",
      GLib.Markup.EscapeText(name)));
        contentVBox.PackStart(nameLabel, false, false, 0);
        nameLabel.UseMarkup = true;
        nameLabel.UseUnderline = false;
        nameLabel.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
        nameLabel.Xalign = 0;
        groupNotebook = new Notebook();
        contentVBox.PackStart(groupNotebook, true, true, 0);
        groupNotebook.ShowTabs = false;
        groupNotebook.ShowBorder = false;
        groupNotebook.Homogeneous = false;
        groupNotebook.AppendPage(CreateMainPage(), null);
        groupNotebook.AppendPage(CreateEmptyPage(), null);
        groupNotebook.AppendPage(CreateEmptySearchPage(), null);
        groupNotebook.Page = 0;
        model.RowChanged +=
     new RowChangedHandler(OnRowChanged);
        model.RowDeleted +=
     new RowDeletedHandler(OnRowDeleted);
        model.RowInserted +=
     new RowInsertedHandler(OnRowInserted);
        return contentVBox;
 }
Ejemplo n.º 39
0
        private void UpdateForArtist (string artist_name, LastfmData<SimilarArtist> similar_artists,
            LastfmData<ArtistTopAlbum> top_albums, LastfmData<ArtistTopTrack> top_tracks)
        {
            ThreadAssist.ProxyToMain (delegate {
                album_box.Title = String.Format (album_title_format, artist);
                track_box.Title = String.Format (track_title_format, artist);

                similar_artists_view.ClearWidgets ();
                ClearBox (album_list);
                ClearBox (track_list);

                // Similar Artists
                var artists = similar_artists.Take (20);

                if (artists.Count () > 0) {
                    int artist_name_max_len = 2 * (int) artists.Select (a => a.Name.Length).Average ();
                    foreach (var similar_artist in artists) {
                        SimilarArtistTile tile = new SimilarArtistTile (similar_artist);

                        tile.PrimaryLabel.WidthChars = artist_name_max_len;
                        tile.PrimaryLabel.Ellipsize = Pango.EllipsizeMode.End;

                        tile.ShowAll ();
                        similar_artists_view.AddWidget (tile);
                    }

                    no_artists_pane.Hide ();
                    similar_artists_view_sw.ShowAll ();
                } else {
                    similar_artists_view_sw.Hide ();
                    no_artists_pane.ShowAll ();
                }

                for (int i = 0; i < Math.Min (5, top_albums.Count); i++) {
                    ArtistTopAlbum album = top_albums[i];
                    Button album_button = new Button ();
                    album_button.Relief = ReliefStyle.None;

                    Label label = new Label ();
                    label.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
                    label.Ellipsize = Pango.EllipsizeMode.End;
                    label.Xalign = 0;
                    label.Markup = String.Format ("{0}. {1}", i+1, GLib.Markup.EscapeText (album.Name));
                    album_button.Add (label);

                    album_button.Clicked += delegate {
                        Banshee.Web.Browser.Open (album.Url);
                    };
                    album_list.PackStart (album_button, false, true, 0);
                }
                album_box.ShowAll ();

                for (int i = 0; i < Math.Min (5, top_tracks.Count); i++) {
                    ArtistTopTrack track = top_tracks[i];
                    Button track_button = new Button ();
                    track_button.Relief = ReliefStyle.None;

                    HBox box = new HBox ();

                    Label label = new Label ();
                    label.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
                    label.Ellipsize = Pango.EllipsizeMode.End;
                    label.Xalign = 0;
                    label.Markup = String.Format ("{0}. {1}", i+1, GLib.Markup.EscapeText (track.Name));

                    /*if(node.SelectSingleNode("track_id") != null) {
                        box.PackEnd(new Image(now_playing_arrow), false, false, 0);
                        track_button.Clicked += delegate {
                            //PlayerEngineCore.OpenPlay(Globals.Library.GetTrack(
                                //Convert.ToInt32(node.SelectSingleNode("track_id").InnerText)));
                        };
                    } else {*/
                        track_button.Clicked += delegate {
                            Banshee.Web.Browser.Open (track.Url);
                        };
                    //}

                    box.PackStart (label, true, true, 0);
                    track_button.Add (box);
                    track_list.PackStart (track_button, false, true, 0);
                }
                track_box.ShowAll ();

                ready = true;
                refreshing = false;
                context_page.SetState (Banshee.ContextPane.ContextState.Loaded);
            });
        }
Ejemplo n.º 40
0
		Widget CreateExceptionHeader ()
		{
			var icon = new ImageView (WarningIconPixbuf);
			icon.Yalign = 0;

			ExceptionTypeLabel = new Label { Xalign = 0.0f, Selectable = true };
			ExceptionMessageLabel = new Label { Wrap = true, Xalign = 0.0f, Selectable = true };
			ExceptionTypeLabel.ModifyFg (StateType.Normal, new Gdk.Color (255, 255, 255));
			ExceptionMessageLabel.ModifyFg (StateType.Normal, new Gdk.Color (255, 255, 255));

			if (Platform.IsWindows) {
				ExceptionTypeLabel.ModifyFont (Pango.FontDescription.FromString ("bold 19"));
				ExceptionMessageLabel.ModifyFont (Pango.FontDescription.FromString ("10"));
			} else {
				ExceptionTypeLabel.ModifyFont (Pango.FontDescription.FromString ("21"));
				ExceptionMessageLabel.ModifyFont (Pango.FontDescription.FromString ("12"));
			}

			//Force rendering of background with EventBox
			var eventBox = new EventBox ();
			var hBox = new HBox ();
			var leftVBox = new VBox ();
			rightVBox = new VBox ();
			leftVBox.PackStart (icon, false, false, (uint)(Platform.IsWindows ? 5 : 0)); // as we change frame.BorderWidth below, we need to compensate

			rightVBox.PackStart (ExceptionTypeLabel, false, false, (uint)(Platform.IsWindows ? 0 : 2));
			rightVBox.PackStart (ExceptionMessageLabel, true, true, (uint)(Platform.IsWindows ? 6 : 5));

			hBox.PackStart (leftVBox, false, false, (uint)(Platform.IsWindows ? 5 : 0)); // as we change frame.BorderWidth below, we need to compensate
			hBox.PackStart (rightVBox, true, true, (uint)(Platform.IsWindows ? 5 : 10));

			var frame = new Frame ();
			frame.Add (hBox);
			frame.BorderWidth = (uint)(Platform.IsWindows ? 5 : 10); // on Windows we need to have smaller border due to ExceptionTypeLabel vertical misalignment
			frame.Shadow = ShadowType.None;
			frame.ShadowType = ShadowType.None;

			eventBox.Add (frame);
			eventBox.ShowAll ();
			eventBox.ModifyBg (StateType.Normal, new Gdk.Color (119, 130, 140));

			return eventBox;
		}
Ejemplo n.º 41
0
		public void SetForegroundColor(Gdk.Color color)
		{
			_label.ModifyFg(StateType.Normal, color);
			_label.ModifyFg(StateType.Prelight, color);
			_label.ModifyFg(StateType.Active, color);
		}
Ejemplo n.º 42
0
		void ShowLoadSourceFile (StackFrame sf)
		{
			if (messageOverlayWindow != null) {
				messageOverlayWindow.Destroy ();
				messageOverlayWindow = null;
			}
			messageOverlayWindow = new OverlayMessageWindow ();

			var hbox = new HBox ();
			hbox.Spacing = 8;
			var label = new Label (string.Format ("{0} not found. Find source file at alternative location.", Path.GetFileName (sf.SourceLocation.FileName)));
			hbox.TooltipText = sf.SourceLocation.FileName;
			var color = (HslColor)editor.ColorStyle.NotificationText.Foreground;
			label.ModifyFg (StateType.Normal, color);

			int w, h;
			label.Layout.GetPixelSize (out w, out h);

			hbox.PackStart (label, true, true, 0);
			var openButton = new Button (Gtk.Stock.Open);
			openButton.WidthRequest = 60;
			hbox.PackEnd (openButton, false, false, 0); 

			var container = new HBox ();
			const int containerPadding = 8;
			container.PackStart (hbox, true, true, containerPadding); 
			messageOverlayWindow.Child = container; 
			messageOverlayWindow.ShowOverlay (editor);

			messageOverlayWindow.SizeFunc = () => openButton.SizeRequest ().Width + w + hbox.Spacing * 5 + containerPadding * 2;
			openButton.Clicked += delegate {
				var dlg = new OpenFileDialog (GettextCatalog.GetString ("File to Open"), SelectFileDialogAction.Open) {
					TransientFor = IdeApp.Workbench.RootWindow,
					ShowEncodingSelector = true,
					ShowViewerSelector = true
				};
				if (!dlg.Run ())
					return;
				var newFilePath = dlg.SelectedFile;
				try {
					if (File.Exists (newFilePath)) {
						if (SourceCodeLookup.CheckFileMd5 (newFilePath, sf.SourceLocation.FileHash)) {
							SourceCodeLookup.AddLoadedFile (newFilePath, sf.SourceLocation.FileName);
							sf.UpdateSourceFile (newFilePath);
							if (IdeApp.Workbench.OpenDocument (newFilePath, null, sf.SourceLocation.Line, 1, OpenDocumentOptions.Debugger) != null) {
								this.WorkbenchWindow.CloseWindow (false);
							}
						} else {
							MessageService.ShowWarning ("File checksum doesn't match.");
						}
					} else {
						MessageService.ShowWarning ("File not found.");
					}
				} catch (Exception) {
					MessageService.ShowWarning ("Error opening file");
				}
			};
		}
Ejemplo n.º 43
0
        void UpdateResultInformLabel()
        {
            if (string.IsNullOrEmpty(SearchPattern))
            {
                resultInformLabel.Text = "";
                resultInformLabelEventBox.ModifyBg(StateType.Normal, searchEntry.Entry.Style.Base(searchEntry.Entry.State));
                resultInformLabel.ModifyFg(StateType.Normal, searchEntry.Entry.Style.Foreground(StateType.Insensitive));
                return;
            }

            //	bool error = result == null && !String.IsNullOrEmpty (SearchPattern);
            string errorMsg;
            bool   valid = widget.TextEditor.SearchEngine.IsValidPattern(searchPattern, out errorMsg);

            //	error |= !valid;

            if (!valid)
            {
                IdeApp.Workbench.StatusBar.ShowError(errorMsg);
            }
            else
            {
                IdeApp.Workbench.StatusBar.ShowReady();
            }

            if (!valid || widget.TextEditor.TextViewMargin.SearchResultMatchCount == 0)
            {
                //resultInformLabel.Markup = "<span foreground=\"#000000\" background=\"" + MonoDevelop.Components.PangoCairoHelper.GetColorString (GotoLineNumberWidget.errorColor) + "\">" + GettextCatalog.GetString ("Not found") + "</span>";
                resultInformLabel.Text = GettextCatalog.GetString("Not found");
                resultInformLabelEventBox.ModifyBg(StateType.Normal, GotoLineNumberWidget.errorColor);
                resultInformLabel.ModifyFg(StateType.Normal, searchEntry.Entry.Style.Foreground(StateType.Normal));
            }
            else
            {
                int      resultIndex  = 0;
                int      foundIndex   = -1;
                int      caretOffset  = widget.TextEditor.Caret.Offset;
                ISegment foundSegment = null;
                foreach (ISegment searchResult in widget.TextEditor.TextViewMargin.SearchResults)
                {
                    if (searchResult.Offset <= caretOffset && caretOffset <= searchResult.EndOffset)
                    {
                        foundIndex   = resultIndex + 1;
                        foundSegment = searchResult;
                        break;
                    }
                    resultIndex++;
                }
                if (foundIndex != -1)
                {
                    resultInformLabel.Text = String.Format(GettextCatalog.GetString("{0} of {1}"), foundIndex, widget.TextEditor.TextViewMargin.SearchResultMatchCount);
                }
                else
                {
                    resultInformLabel.Text = String.Format(GettextCatalog.GetPluralString("{0} match", "{0} matches", widget.TextEditor.TextViewMargin.SearchResultMatchCount), widget.TextEditor.TextViewMargin.SearchResultMatchCount);
                }
                resultInformLabelEventBox.ModifyBg(StateType.Normal, searchEntry.Entry.Style.Base(searchEntry.Entry.State));
                resultInformLabel.ModifyFg(StateType.Normal, searchEntry.Entry.Style.Foreground(StateType.Insensitive));
                widget.TextEditor.TextViewMargin.HideSelection    = FocusChild == this.table;
                widget.TextEditor.TextViewMargin.MainSearchResult = foundSegment;
            }
        }
Ejemplo n.º 44
0
        public static void FetchForm(Container Parent, XmlNode Nodes)
        {
            int cIndex = 0;

            string[]    UFont;
            XmlNodeList original = Nodes.ChildNodes;
            XmlNodeList reverse  = new ReverseXmlList(original);

            foreach (XmlNode C in reverse)
            {
                if (C.Name == "Object")
                {
                    cIndex++;
                    if (C.Attributes[0].Name == "type")
                    {
                        if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.PictureBox") || C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Button"))
                        {
                            var PB = new Gtk.Button();
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[PB]));
                            Parent.Add(PB);
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes["name"].Value)
                                    {
                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "Name":
                                        PB.Name = V.InnerText;
                                        break;

                                    case "ForeColor":
                                        var FColor = V.InnerText.GetXColor().ToNative();
                                        PB.Children[0].ModifyFg(StateType.Normal, FColor);
                                        PB.Children[0].ModifyFg(StateType.Active, FColor);
                                        PB.Children[0].ModifyFg(StateType.Prelight, FColor);
                                        PB.Children[0].ModifyFg(StateType.Selected, FColor);
                                        break;

                                    case "Caption":
                                    case "Text":
                                        PB.Label = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")));
                                        break;

                                    case "BackColor":
                                        var BColor = V.InnerText.GetXColor().ToNative();
                                        PB.ModifyBg(StateType.Normal, BColor);
                                        PB.ModifyBg(StateType.Active, BColor);
                                        PB.ModifyBg(StateType.Insensitive, BColor);
                                        PB.ModifyBg(StateType.Prelight, BColor);
                                        PB.ModifyBg(StateType.Selected, BColor);
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "Size":
                                        PB.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;

                                    case "Font":
                                        string VC = V.InnerText;
                                        UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                        string VCFName = UFont[0];
                                        float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                        float  Z       = (float)(VCSize * App.ScaleFactorY);
                                        PB.Children[0].ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                        break;

                                    case "Image":
                                        if (V.HasChildNodes)
                                        {
                                            string IMGData = V.FirstChild.InnerText;
                                            byte[] B       = System.Convert.FromBase64String(IMGData);
                                            Pixbuf P       = new Pixbuf(B);
                                            P        = P.ScaleSimple(PB.WidthRequest - 10, PB.HeightRequest, InterpType.Bilinear);
                                            PB.Image = new Gtk.Image(P);
                                        }
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        }
                        else if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Label"))
                        {
                            var CE = new Gtk.EventBox();
                            CE.ResizeMode = ResizeMode.Parent;
                            var CC = new Gtk.Label();
                            CE.Add(CC);
                            Parent.Add(CE);
                            CC.LineWrapMode = Pango.WrapMode.Word;
                            CC.LineWrap     = true;
                            CC.Wrap         = true;
                            CC.Justify      = Justification.Fill;
                            global::Gtk.Fixed.FixedChild PBC1;
                            if ((Parent[CE]).GetType().ToString() == "Gtk.Container+ContainerChild")
                            {
                                var XVC = Parent[CE].Parent.Parent;
                                PBC1 = (global::Gtk.Fixed.FixedChild)(Parent[XVC]);
                            }
                            else
                            {
                                PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[CE]));
                            }
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes["name"].Value)
                                    {
                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "Name":
                                        CC.Name = V.InnerText;
                                        break;

                                    case "Font":
                                        string VC = V.InnerText;
                                        UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                        string VCFName = UFont[0];
                                        float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                        float  Z       = (float)(VCSize * App.ScaleFactorY);
                                        CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + (int)Z));
                                        break;

                                    case "ForeColor":
                                        var FColor = V.InnerText.GetXColor().ToNative();
                                        CC.ModifyFg(StateType.Normal, FColor);
                                        CC.ModifyFg(StateType.Active, FColor);
                                        CC.ModifyFg(StateType.Insensitive, FColor);
                                        CC.ModifyFg(StateType.Prelight, FColor);
                                        CC.ModifyFg(StateType.Selected, FColor);
                                        CE.ModifyFg(StateType.Normal, FColor);
                                        CE.ModifyFg(StateType.Active, FColor);
                                        CE.ModifyFg(StateType.Insensitive, FColor);
                                        CE.ModifyFg(StateType.Prelight, FColor);
                                        CE.ModifyFg(StateType.Selected, FColor);
                                        CC.Markup = "<span foreground=\"" + V.InnerText + "\">" + CC.Text + "</span>";
                                        break;

                                    case "Caption":
                                    case "Text":
                                        CC.Text = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")).Replace("##", "\r\n"));
                                        break;

                                    case "BackColor":
                                        if (V.InnerText != "Transparent")
                                        {
                                            var BColor = V.InnerText.GetXColor().ToNative();
                                            CE.ModifyBg(StateType.Normal, BColor);
                                            CE.ModifyBg(StateType.Active, BColor);
                                            CE.ModifyBg(StateType.Insensitive, BColor);
                                            CE.ModifyBg(StateType.Prelight, BColor);
                                            CE.ModifyBg(StateType.Selected, BColor);
                                        }
                                        else
                                        {
                                            CE.Visible       = false;
                                            CE.VisibleWindow = false;
                                        }
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "TextAlign":
                                        CC.Justify = (V.InnerText == "MiddleCenter" || V.InnerText == "TopCenter" || V.InnerText == "BottomCenter" ? Justification.Center : (V.InnerText == "MiddleRight" || V.InnerText == "TopRight" || V.InnerText == "BottomRight" ? Justification.Right : Justification.Left));
                                        break;

                                    case "Size":
                                        CE.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    var TZJE = new Fixed();
                                }
                            }
                        }
                        else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.TextBox"))
                        {
                            if (C.InnerXml.IndexOf("\"Multiline\">True") > -1)
                            {
                                var CC = new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add(CC);
                                foreach (XmlNode V in C.ChildNodes)
                                {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                            case "Text":
                                            {
                                                if (V.InnerText.Contains("%"))
                                                {
                                                    CC.Text     = System.Environment.ExpandEnvironmentVariables(V.InnerText);
                                                    CC.Position = CC.Text.Length;
                                                }
                                                break;
                                            }

                                            case "Location":
                                                PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                                PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                                break;

                                            case "Size":
                                                CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                                break;

                                            case "Name":
                                                CC.Name = V.InnerText;
                                                break;

                                            case "Font":
                                                string VC = V.InnerText;
                                                UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                                string VCFName = UFont[0];
                                                float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                                float  Z       = (float)(VCSize * App.ScaleFactorY);
                                                CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                                System.Diagnostics.Debug.WriteLine(VCFName + " " + ((int)Z).ToString());
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                var CC = new Gtk.Entry();
                                global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC]));
                                Parent.Add(CC);
                                foreach (XmlNode V in C.ChildNodes)
                                {
                                    {
                                        if (V.Name == "Property")
                                        {
                                            switch (V.Attributes ["name"].Value)
                                            {
                                            case "Name":
                                                CC.Name = V.InnerText;
                                                break;

                                            case "Text":
                                            {
                                                if (V.InnerText.Contains("%"))
                                                {
                                                    CC.Text     = System.Environment.ExpandEnvironmentVariables(V.InnerText);
                                                    CC.Position = CC.Text.Length;
                                                }
                                                break;
                                            }

                                            case "Location":
                                                PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                                PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                                break;

                                            case "Size":
                                                CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                                break;

                                            case "PasswordChar":
                                                CC.InvisibleChar = '*';
                                                CC.Visibility    = false;
                                                break;

                                            case "Font":
                                                string VC = V.InnerText;
                                                UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                                string VCFName = UFont[0];
                                                float  VCSize  = float.Parse(UFont[1].Replace("pt", ""));
                                                float  Z       = (float)(VCSize * App.ScaleFactorY);
                                                CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
                                                System.Diagnostics.Debug.WriteLine(VCFName + " " + ((int)Z).ToString());
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.Panel"))
                        {
                            var CP = new Gtk.Fixed();
                            //CP.Clicked += HandleClick;
                            global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CP]));
                            Parent.Add(CP);
                            foreach (XmlNode V in C.ChildNodes)
                            {
                                if (V.Name == "Property")
                                {
                                    switch (V.Attributes ["name"].Value)
                                    {
                                    case "Name":
                                        CP.Name = V.InnerText;
                                        break;

                                    case "BorderStyle":
                                        if (V.InnerText == "Solid")
                                        {
                                            //PB.ModifierStyle =
                                        }
                                        break;

                                    case "ForeColor":

                                        CP.Children [0].ModifyFg(StateType.Normal, V.InnerText.GetXColor().ToNative());
                                        break;

                                    case "BackColor":
                                        CP.ModifyBg(StateType.Normal, V.InnerText.GetXColor().ToNative());
                                        break;

                                    case "SizeMode":
                                        //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
                                        break;

                                    case "Location":
                                        PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
                                        PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
                                        break;

                                    case "Size":
                                        CP.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
                                        break;
                                    }
                                }
                                else if (V.Name == "Object")
                                {
                                    //FetchForm(PB, V.ParentNode);
                                }
                            }
                        }
                        else
                        {
                            System.Diagnostics.Debug.WriteLine(C.Attributes ["type"].Value);
                        }
                    }
                }
            }
            Parent.ShowAll();
        }
Ejemplo n.º 45
0
        /*		private void OnStatusComboKeyPress (object sender, KeyPressEventArgs args)
        {
            if (args.Event.Key == Gdk.Key.Return) {
                if (PersonManager.Me != null) {
                    Logger.Debug ("FIXME: Set \"my\" status to: {0}",
                            statusComboBoxEntry.ActiveText);
                    PersonManager.Me.Presence.Message =
                            statusComboBoxEntry.ActiveText;
                }
            }
        }
        */
        /*		private void OnStatusComboChanged (object sender, EventArgs args)
        {
            Logger.Debug ("OnStatusComboChanged");
        }
        */
        private Widget CreateSidebarSearchEntry()
        {
            VBox vbox = new VBox (false, 0);

            Label l = new Label (
                    string.Format ("<span size=\"large\">{0}</span>",
                        Catalog.GetString ("Filter")));
            l.UseMarkup = true;
            l.ModifyFg (StateType.Normal, this.Style.Base (StateType.Selected));
            l.Xalign = 0;
            l.Show ();
            vbox.PackStart (l, false, false, 0);

            searchEntry = new Entry ();
            searchEntry.SelectRegion (0, -1);
            searchEntry.CanFocus = true;
            searchEntry.Changed += OnSearchEntryChanged;
            searchEntry.Show ();

            Image stopImage = new Image (Stock.Stop, Gtk.IconSize.Menu);
            stopImage.SetAlignment (0.5F, 0.0F);

            cancelSearchButton = new Button (stopImage);
            cancelSearchButton.Relief = ReliefStyle.None;
            cancelSearchButton.Sensitive = false;
            cancelSearchButton.Clicked += OnCancelSearchButton;
            cancelSearchButton.Show ();

            HBox searchHBox = new HBox (false, 4);
            searchHBox.PackStart (searchEntry, true, true, 0);
            searchHBox.PackStart (cancelSearchButton, false, false, 0);

            searchHBox.Show ();
            vbox.PackStart (searchHBox, false, false, 0);

            return vbox;
        }
Ejemplo n.º 46
0
        public void Append(string tip, bool showArrow, Gdk.Pixbuf arrow)
        {
            uint row = table.NRows;
            Gtk.Label label;

            if (showArrow) {
                AttachArrow (arrow);
            }

            label = new Gtk.Label ();
            label.Markup = tip;
            label.SetAlignment (0.0f, 0.5f);
            label.LineWrap = true;
            label.ModifyFg (Gtk.StateType.Normal, label.Style.Foreground (Gtk.StateType.Insensitive));
            label.Show ();
            table.Attach (label, 1, 2, row, row + 1,
                      Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                      0, 0, 0);
        }
Ejemplo n.º 47
0
        void UpdateResultInformLabel()
        {
            try {
                var entry = searchEntry.Entry;
                if (entry == null)
                {
                    LoggingService.LogError("SearchAndReplaceWidget.UpdateResultInformLabel called with null entry.");
                    return;
                }
                if (string.IsNullOrEmpty(SearchPattern))
                {
                    resultInformLabel.Text = "";
                    resultInformLabelEventBox.ModifyBg(StateType.Normal, entry.Style.Base(entry.State));
                    resultInformLabel.ModifyFg(StateType.Normal, entry.Style.Foreground(StateType.Insensitive));
                    return;
                }

                //	bool error = result == null && !String.IsNullOrEmpty (SearchPattern);
                string errorMsg;
                bool   valid = textEditor.SearchEngine.IsValidPattern(SearchAndReplaceOptions.SearchPattern, out errorMsg);
                //	error |= !valid;

                if (!valid)
                {
                    IdeApp.Workbench.StatusBar.ShowError(errorMsg);
                }
                else
                {
                    IdeApp.Workbench.StatusBar.ShowReady();
                }

                if (!valid || textEditor.TextViewMargin.SearchResultMatchCount == 0)
                {
                    //resultInformLabel.Markup = "<span foreground=\"#000000\" background=\"" + MonoDevelop.Components.PangoCairoHelper.GetColorString (GotoLineNumberWidget.errorColor) + "\">" + GettextCatalog.GetString ("Not found") + "</span>";
                    resultInformLabel.Text = GettextCatalog.GetString("Not found");
                    resultInformLabel.ModifyFg(StateType.Normal, Ide.Gui.Styles.Editor.SearchErrorForegroundColor.ToGdkColor());
                }
                else
                {
                    int      resultIndex  = 0;
                    int      foundIndex   = -1;
                    int      caretOffset  = textEditor.Caret.Offset;
                    ISegment foundSegment = TextSegment.Invalid;
                    foreach (var searchResult in textEditor.TextViewMargin.SearchResults)
                    {
                        if (searchResult.Offset <= caretOffset && caretOffset <= searchResult.EndOffset)
                        {
                            foundIndex   = resultIndex + 1;
                            foundSegment = searchResult;
                            break;
                        }
                        resultIndex++;
                    }
                    if (foundIndex != -1)
                    {
                        resultInformLabel.Text = String.Format(GettextCatalog.GetString("{0} of {1}"), foundIndex, textEditor.TextViewMargin.SearchResultMatchCount);
                    }
                    else
                    {
                        resultInformLabel.Text = String.Format(GettextCatalog.GetPluralString("{0} match", "{0} matches", textEditor.TextViewMargin.SearchResultMatchCount), textEditor.TextViewMargin.SearchResultMatchCount);
                    }
                    resultInformLabelEventBox.ModifyBg(StateType.Normal, entry.Style.Base(entry.State));
                    resultInformLabel.ModifyFg(StateType.Normal, entry.Style.Foreground(StateType.Insensitive));
                    textEditor.TextViewMargin.HideSelection    = FocusChild == table;
                    textEditor.TextViewMargin.MainSearchResult = foundSegment;
                }
            } catch (Exception ex) {
                LoggingService.LogError("Exception while updating result inform label.", ex);
            }
        }
Ejemplo n.º 48
0
 private Widget CreateWidgets()
 {
     iFolderViewGroup.CheckThread();
        contentVBox = new VBox(false, 0);
        contentVBox.BorderWidth = 12;
        nameLabel = new Label(
     string.Format(
      "<span size=\"xx-large\">{0}</span>",
      name));
        contentVBox.PackStart(nameLabel, false, false, 0);
        nameLabel.UseMarkup = true;
        nameLabel.UseUnderline = false;
        nameLabel.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
        nameLabel.Xalign = 0;
        table = new Table(1, 1, true);
        contentVBox.PackStart(table, true, true, 0);
        table.ColumnSpacing = 12;
        table.RowSpacing = 12;
        table.BorderWidth = 12;
        table.ModifyBase(StateType.Normal, this.Style.Base(StateType.Prelight));
        model.RowChanged +=
     new RowChangedHandler(OnRowChanged);
        model.RowDeleted +=
     new RowDeletedHandler(OnRowDeleted);
        model.RowInserted +=
     new RowInsertedHandler(OnRowInserted);
        return contentVBox;
 }
Ejemplo n.º 49
0
        /// <summary>
        /// Populate the main menu tool strip.
        /// We rebuild the contents from scratch
        /// </summary>
        /// <param name="menuDescriptions">Menu descriptions for each menu item.</param>
        public void PopulateMainToolStrip(List<MenuDescriptionArgs> menuDescriptions)
        {
            foreach (Widget child in toolStrip.Children)
                toolStrip.Remove(child);
            foreach (MenuDescriptionArgs description in menuDescriptions)
            {
                if (!hasResource(description.ResourceNameForImage))
                {
                    MessageDialog md = new MessageDialog(MainWidget.Toplevel as Window, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
                        "Program error. Could not locate the resource named " + description.ResourceNameForImage);
                    md.Run();
                    md.Destroy();
                }
                else
                {

                    Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(null, description.ResourceNameForImage, 20, 20);
                    ToolButton button = new ToolButton(new Gtk.Image(pixbuf), description.Name);
                    button.Homogeneous = false;
                    button.LabelWidget = new Label(description.Name);
                    Pango.FontDescription font = new Pango.FontDescription();
                    font.Size = (int)(8 * Pango.Scale.PangoScale);
                    button.LabelWidget.ModifyFont(font);
                    if (description.OnClick != null)
                        button.Clicked += description.OnClick;
                    toolStrip.Add(button);
                }
            }
            ToolItem item = new ToolItem();
            item.Expand = true;
            toolbarlabel = new Label();
            toolbarlabel.Xalign = 1.0F;
            toolbarlabel.Xpad = 10;
            toolbarlabel.ModifyFg(StateType.Normal, new Gdk.Color(0x99, 0x99, 0x99));
            item.Add(toolbarlabel);
            toolbarlabel.Visible = false;
            toolStrip.Add(item);
            toolStrip.ShowAll();
        }
		void ShowIncorrectEolMarkers (string fileName, bool multiple)
		{
			RemoveMessageBar ();
			var hbox = new HBox ();
			hbox.Spacing = 8;

			var image = new HoverCloseButton ();
			hbox.PackStart (image, false, false, 0);
			var label = new Label (string.Format ("This file has line endings ({0}) which differ from the policy settings ({1}).", GetEolString (DetectedEolMarker), GetEolString (textEditor.Options.DefaultEolMarker)));
			var color = (HslColor)textEditor.ColorStyle.NotificationText.Foreground;
			label.ModifyFg (StateType.Normal, color);

			int w, h;
			label.Layout.GetPixelSize (out w, out h);
			label.Ellipsize = Pango.EllipsizeMode.End;

			hbox.PackStart (label, true, true, 0);
			var okButton = new Button (Gtk.Stock.Ok);
			okButton.WidthRequest = 60;

			// Small amount of vertical padding for the OK button.
			const int verticalPadding = 2;
			var vbox = new VBox ();
			vbox.PackEnd (okButton, true, true, verticalPadding);
			hbox.PackEnd (vbox, false, false, 0);

			var list = new List<string> ();
			list.Add (string.Format ("Convert to {0} line endings", GetEolString (textEditor.Options.DefaultEolMarker)));
			list.Add (string.Format ("Convert all files to {0} line endings", GetEolString (textEditor.Options.DefaultEolMarker)));
			list.Add (string.Format ("Keep {0} line endings", GetEolString (DetectedEolMarker)));
			list.Add (string.Format ("Keep {0} line endings in all files", GetEolString (DetectedEolMarker)));
			var combo = new ComboBox (list.ToArray ());
			combo.Active = 0;
			hbox.PackEnd (combo, false, false, 0);
			incorrectEolMessage = new HBox ();
			const int containerPadding = 8;
			incorrectEolMessage.PackStart (hbox, true, true, containerPadding); 

			// This is hacky, but it will ensure that our combo appears with with the correct size.
			GLib.Timeout.Add (100, delegate {
				combo.QueueResize ();
				return false;
			});

			AddOverlay (incorrectEolMessage, () => {
				return okButton.SizeRequest ().Width +
							   combo.SizeRequest ().Width +
							   image.SizeRequest ().Width +
							   w +
							   hbox.Spacing * 4 +
							   containerPadding * 2;
			});

			image.Clicked += delegate {
				UseIncorrectMarkers = true;
				view.WorkbenchWindow.ShowNotification = false;
				RemoveMessageBar ();
			};
			okButton.Clicked += delegate {
				switch (combo.Active) {
				case 0:
					ConvertLineEndings ();
					view.WorkbenchWindow.ShowNotification = false;
					view.Save (fileName, view.SourceEncoding);
					break;
				case 1:
					FileRegistry.ConvertLineEndingsInAllFiles ();
					break;
				case 2:
					UseIncorrectMarkers = true;
					view.WorkbenchWindow.ShowNotification = false;
					break;
				case 3:
					FileRegistry.IgnoreLineEndingsInAllFiles ();
					break;
				}
				RemoveMessageBar ();
			};
		}
Ejemplo n.º 51
0
		void ShowIncorretEolMarkers (string fileName, bool multiple)
		{
			RemoveMessageBar ();
			messageOverlayWindow = new OverlayMessageWindow ();

			var hbox = new HBox ();
			hbox.Spacing = 8;

			var image = new HoverCloseButton ();
			hbox.PackStart (image, false, false, 0);
			var label = new Label (string.Format ("This file has line endings ({0}) which differ from the policy settings ({1}).", GetEolString (DetectedEolMarker), GetEolString (textEditor.Options.DefaultEolMarker)));
			var color = (Mono.TextEditor.HslColor)textEditor.ColorStyle.NotificationText.Foreground;
			label.ModifyFg (StateType.Normal, color);

			int w, h;
			label.Layout.GetPixelSize (out w, out h);
			label.Ellipsize = Pango.EllipsizeMode.End;

			hbox.PackStart (label, true, true, 0);
			var okButton = new Button (Gtk.Stock.Ok);
			okButton.WidthRequest = 60;
			hbox.PackEnd (okButton, false, false, 0); 

			var list = new List<string> ();
			list.Add (string.Format ("Convert to {0} line endings", GetEolString (textEditor.Options.DefaultEolMarker)));
			if (multiple)
				list.Add (string.Format ("Convert all files to {0} line endings", GetEolString (textEditor.Options.DefaultEolMarker)));
			list.Add (string.Format ("Keep {0} line endings", GetEolString (DetectedEolMarker)));
			if (multiple)
				list.Add (string.Format ("Keep {0} line endings in all files", GetEolString (DetectedEolMarker)));
			var combo = new ComboBox (list.ToArray ());
			combo.Active = 0;
			hbox.PackEnd (combo, false, false, 0);
			var container = new HBox ();
			const int containerPadding = 8;
			container.PackStart (hbox, true, true, containerPadding); 
			messageOverlayWindow.Child = container; 
			messageOverlayWindow.ShowOverlay (this.TextEditor);

			messageOverlayWindow.SizeFunc = () => {
				return okButton.SizeRequest ().Width +
					combo.SizeRequest ().Width +
					image.SizeRequest ().Width +
					w +
					hbox.Spacing * 4 + 
					containerPadding * 2;
			};
			image.Clicked += delegate {
				UseIncorrectMarkers = true;
				view.WorkbenchWindow.ShowNotification = false;
				RemoveMessageBar ();
			};
			okButton.Clicked += delegate {
				if (multiple) {
					switch (combo.Active) {
					case 0:
						ConvertLineEndings ();
						view.WorkbenchWindow.ShowNotification = false;
						view.Save (fileName, view.SourceEncoding);
						break;
					case 1:
						FileRegistry.ConvertLineEndingsInAllFiles ();
						break;
					case 2:
						UseIncorrectMarkers = true;
						view.WorkbenchWindow.ShowNotification = false;
						break;
					case 3:
						FileRegistry.IgnoreLineEndingsInAllFiles ();
						break;
					}
				} else {
					switch (combo.Active) {
					case 0:
						ConvertLineEndings ();
						view.WorkbenchWindow.ShowNotification = false;
						view.Save (fileName, view.SourceEncoding);
						break;
					case 1:
						UseIncorrectMarkers = true;
						view.WorkbenchWindow.ShowNotification = false;
						break;
					}
				}
				RemoveMessageBar ();
			};
		}
		void Build ()
		{
			BorderWidth = 0;
			WidthRequest = 901;
			HeightRequest = 632;

			Name = "wizard_dialog";
			Title = GettextCatalog.GetString ("New Project");
			WindowPosition = WindowPosition.CenterOnParent;
			TransientFor = IdeApp.Workbench.RootWindow;

			projectConfigurationWidget = new GtkProjectConfigurationWidget ();
			projectConfigurationWidget.Name = "projectConfigurationWidget";

			// Top banner of dialog.
			var topLabelEventBox = new EventBox ();
			topLabelEventBox.Name = "topLabelEventBox";
			topLabelEventBox.HeightRequest = 52;
			topLabelEventBox.ModifyBg (StateType.Normal, bannerBackgroundColor);
			topLabelEventBox.ModifyFg (StateType.Normal, whiteColor);
			topLabelEventBox.BorderWidth = 0;

			var topBannerTopEdgeLineEventBox = new EventBox ();
			topBannerTopEdgeLineEventBox.Name = "topBannerTopEdgeLineEventBox";
			topBannerTopEdgeLineEventBox.HeightRequest = 1;
			topBannerTopEdgeLineEventBox.ModifyBg (StateType.Normal, bannerLineColor);
			topBannerTopEdgeLineEventBox.BorderWidth = 0;

			var topBannerBottomEdgeLineEventBox = new EventBox ();
			topBannerBottomEdgeLineEventBox.Name = "topBannerBottomEdgeLineEventBox";
			topBannerBottomEdgeLineEventBox.HeightRequest = 1;
			topBannerBottomEdgeLineEventBox.ModifyBg (StateType.Normal, bannerLineColor);
			topBannerBottomEdgeLineEventBox.BorderWidth = 0;

			topBannerLabel = new Label ();
			topBannerLabel.Name = "topBannerLabel";
			Pango.FontDescription font = topBannerLabel.Style.FontDescription.Copy (); // UNDONE: VV: Use FontService?
			font.Size = (int)(font.Size * 1.8);
			topBannerLabel.ModifyFont (font);
			topBannerLabel.ModifyFg (StateType.Normal, whiteColor);
			var topLabelHBox = new HBox ();
			topLabelHBox.Name = "topLabelHBox";
			topLabelHBox.PackStart (topBannerLabel, false, false, 20);
			topLabelEventBox.Add (topLabelHBox);

			VBox.PackStart (topBannerTopEdgeLineEventBox, false, false, 0);
			VBox.PackStart (topLabelEventBox, false, false, 0);
			VBox.PackStart (topBannerBottomEdgeLineEventBox, false, false, 0);

			// Main templates section.
			centreVBox = new VBox ();
			centreVBox.Name = "centreVBox";
			VBox.PackStart (centreVBox, true, true, 0);
			templatesHBox = new HBox ();
			templatesHBox.Name = "templatesHBox";
			centreVBox.PackEnd (templatesHBox, true, true, 0);

			// Template categories.
			var templateCategoriesBgBox = new EventBox ();
			templateCategoriesBgBox.Name = "templateCategoriesVBox";
			templateCategoriesBgBox.BorderWidth = 0;
			templateCategoriesBgBox.ModifyBg (StateType.Normal, categoriesBackgroundColor);
			templateCategoriesBgBox.WidthRequest = 220;
			var templateCategoriesScrolledWindow = new ScrolledWindow ();
			templateCategoriesScrolledWindow.Name = "templateCategoriesScrolledWindow";
			templateCategoriesScrolledWindow.HscrollbarPolicy = PolicyType.Never;

			// Template categories tree view.
			templateCategoriesTreeView = new TreeView ();
			templateCategoriesTreeView.Name = "templateCategoriesTreeView";
			templateCategoriesTreeView.BorderWidth = 0;
			templateCategoriesTreeView.HeadersVisible = false;
			templateCategoriesTreeView.Model = templateCategoriesListStore;
			templateCategoriesTreeView.SearchColumn = -1; // disable the interactive search
			templateCategoriesTreeView.AppendColumn (CreateTemplateCategoriesTreeViewColumn ());
			templateCategoriesScrolledWindow.Add (templateCategoriesTreeView);
			templateCategoriesBgBox.Add (templateCategoriesScrolledWindow);
			templatesHBox.PackStart (templateCategoriesBgBox, false, false, 0);

			// Templates.
			var templatesBgBox = new EventBox ();
			templatesBgBox.ModifyBg (StateType.Normal, templateListBackgroundColor);
			templatesBgBox.Name = "templatesVBox";
			templatesBgBox.WidthRequest = 400;
			templatesHBox.PackStart (templatesBgBox, false, false, 0);
			var templatesScrolledWindow = new ScrolledWindow ();
			templatesScrolledWindow.Name = "templatesScrolledWindow";
			templatesScrolledWindow.HscrollbarPolicy = PolicyType.Never;

			// Templates tree view.
			templatesTreeView = new TreeView ();
			templatesTreeView.Name = "templatesTreeView";
			templatesTreeView.HeadersVisible = false;
			templatesTreeView.Model = templatesListStore;
			templatesTreeView.SearchColumn = -1; // disable the interactive search
			templatesTreeView.AppendColumn (CreateTemplateListTreeViewColumn ());
			templatesScrolledWindow.Add (templatesTreeView);
			templatesBgBox.Add (templatesScrolledWindow);

			// Template
			var templateEventBox = new EventBox ();
			templateEventBox.Name = "templateEventBox";
			templateEventBox.ModifyBg (StateType.Normal, templateBackgroundColor);
			templatesHBox.PackStart (templateEventBox, true, true, 0);
			templateVBox = new VBox ();
			templateVBox.Visible = false;
			templateVBox.BorderWidth = 20;
			templateVBox.Spacing = 10;
			templateEventBox.Add (templateVBox);

			// Template large image.
			templateImage = new ImageView ();
			templateImage.Name = "templateImage";
			templateImage.HeightRequest = 140;
			templateImage.WidthRequest = 240;
			templateVBox.PackStart (templateImage, false, false, 10);

			// Template description.
			templateNameLabel = new Label ();
			templateNameLabel.Name = "templateNameLabel";
			templateNameLabel.WidthRequest = 240;
			templateNameLabel.Wrap = true;
			templateNameLabel.Xalign = 0;
			templateNameLabel.Markup = MarkupTemplateName ("TemplateName");
			templateVBox.PackStart (templateNameLabel, false, false, 0);
			templateDescriptionLabel = new Label ();
			templateDescriptionLabel.Name = "templateDescriptionLabel";
			templateDescriptionLabel.WidthRequest = 240;
			templateDescriptionLabel.Wrap = true;
			templateDescriptionLabel.Xalign = 0;
			templateVBox.PackStart (templateDescriptionLabel, false, false, 0);
			templateVBox.PackStart (new Label (), true, true, 0);

			// Template - button separator.
			var templateSectionSeparatorEventBox = new EventBox ();
			templateSectionSeparatorEventBox.Name = "templateSectionSeparatorEventBox";
			templateSectionSeparatorEventBox.HeightRequest = 1;
			templateSectionSeparatorEventBox.ModifyBg (StateType.Normal, templateSectionSeparatorColor);
			VBox.PackStart (templateSectionSeparatorEventBox, false, false, 0);

			// Buttons at bottom of dialog.
			var bottomHBox = new HBox ();
			bottomHBox.Name = "bottomHBox";
			VBox.PackStart (bottomHBox, false, false, 0);

			// Cancel button - bottom left.
			var cancelButtonBox = new HButtonBox ();
			cancelButtonBox.Name = "cancelButtonBox";
			cancelButtonBox.BorderWidth = 16;
			cancelButton = new Button ();
			cancelButton.Name = "cancelButton";
			cancelButton.Label = "gtk-cancel";
			cancelButton.UseStock = true;
			cancelButtonBox.PackStart (cancelButton, false, false, 0);
			bottomHBox.PackStart (cancelButtonBox, false, false, 0);

			// Previous button - bottom right.
			var previousNextButtonBox = new HButtonBox ();
			previousNextButtonBox.Name = "previousNextButtonBox";
			previousNextButtonBox.BorderWidth = 16;
			previousNextButtonBox.Spacing = 9;
			bottomHBox.PackStart (previousNextButtonBox);
			previousNextButtonBox.Layout = ButtonBoxStyle.End;

			previousButton = new Button ();
			previousButton.Name = "previousButton";
			previousButton.Label = GettextCatalog.GetString ("Previous");
			previousButton.Sensitive = false;
			previousNextButtonBox.PackEnd (previousButton);

			// Next button - bottom right.
			nextButton = new Button ();
			nextButton.Name = "nextButton";
			nextButton.Label = GettextCatalog.GetString ("Next");
			previousNextButtonBox.PackEnd (nextButton);

			// Remove default button action area.
			VBox.Remove (ActionArea);

			if (Child != null) {
				Child.ShowAll ();
			}

			Show ();

			templatesTreeView.HasFocus = true;
			Resizable = false;
		}
Ejemplo n.º 53
0
 public void SetPlaceholderTextColor(Gdk.Color color)
 {
     _placeholder.ModifyFg(StateType.Normal, color);
 }
Ejemplo n.º 54
0
    public MindFire(string[] args)
    {
        Application.Init();
        Glade.XML gxml = new Glade.XML(null, "gui.glade", "mindFire", null);
        gxml.Autoconnect(this);

        playButtonPixbuf       = new Gdk.Pixbuf(null, "media-play.png");
        playButtonImage        = new Gtk.Image();
        playButtonImage.Pixbuf = playButtonPixbuf;
        startButton.Add(playButtonImage);
        startButton.Sensitive = false;
        startButton.Clicked  += new EventHandler(StartRsvp);
        startButton.ShowAll();

        stopButtonPixbuf       = new Gdk.Pixbuf(null, "media-stop.png");
        stopButtonImage        = new Gtk.Image();
        stopButtonImage.Pixbuf = stopButtonPixbuf;
        stopButton.Add(stopButtonImage);
        stopButton.Sensitive = false;
        stopButton.Clicked  += new EventHandler(StopRsvp);
        stopButton.ShowAll();

        prevButtonPixbuf       = new Gdk.Pixbuf(null, "media-prev.png");
        prevButtonImage        = new Gtk.Image();
        prevButtonImage.Pixbuf = prevButtonPixbuf;
        prevButton.Add(prevButtonImage);
        prevButton.Sensitive = false;
        prevButton.Clicked  += new EventHandler(PreviousWord);
        prevButton.ShowAll();

        nextButtonPixbuf       = new Gdk.Pixbuf(null, "media-next.png");
        nextButtonImage        = new Gtk.Image();
        nextButtonImage.Pixbuf = nextButtonPixbuf;
        nextButton.Add(nextButtonImage);
        nextButton.Sensitive = false;
        nextButton.Clicked  += new EventHandler(NextWord);
        nextButton.ShowAll();

        speedUp.Clicked   += new EventHandler(SpeedUp);
        speedDown.Clicked += new EventHandler(SpeedDown);

        startMenuItem.Sensitive = false;
        stopMenuItem.Sensitive  = false;
        slider.ValueChanged    += new EventHandler(SliderMoved);
        noteBook.SwitchPage    += new SwitchPageHandler(NoteBookChanged);
        icon          = new Gdk.Pixbuf(null, "mindFireMonkey.png");
        mindFire.Icon = icon;

        dateTime = System.DateTime.Now;

        config = new Config();

        noteBook.SetTabLabelPacking(noteBook.GetNthPage(0), true, true, Gtk.PackType.Start);
        ftLabel.ModifyFg(Gtk.StateType.Active, new Gdk.Color(127, 127, 127));
        riLabel.ModifyFg(Gtk.StateType.Active, new Gdk.Color(127, 127, 127));
        sgLabel.ModifyFg(Gtk.StateType.Active, new Gdk.Color(127, 127, 127));
        mlLabel.ModifyFg(Gtk.StateType.Active, new Gdk.Color(127, 127, 127));

        statusBar.Push(0, "Ready");
        ShowWord(curWord);
        Application.Run();
    }