Exemplo n.º 1
0
 void SetStatusIcon(IconId stockId, double alpha = 1.0)
 {
     animatedStatusIcon = null;
     if (statusIconAnimation != null)
     {
         statusIconAnimation.Dispose();
         statusIconAnimation = null;
     }
     if (stockId.IsNull)
     {
         statusIconView.Visible = false;
         return;
     }
     if (ImageService.IsAnimation(stockId, Gtk.IconSize.Menu))
     {
         animatedStatusIcon   = ImageService.GetAnimatedIcon(stockId, Gtk.IconSize.Menu);
         statusIconView.Image = animatedStatusIcon.FirstFrame.WithAlpha(alpha);
         statusIconAnimation  = animatedStatusIcon.StartAnimation(p => {
             statusIconView.Image = p.WithAlpha(alpha);
         });
     }
     else
     {
         statusIconView.Image = ImageService.GetIcon(stockId).WithSize(Xwt.IconSize.Small).WithAlpha(alpha);
     }
     statusIconView.Visible = true;
 }
Exemplo n.º 2
0
        void UpdateServiceStatus()
        {
            if (Service == null)
            {
                return;
            }
            Runtime.RunInMainThread(delegate {
                StopIconAnimations();
                statusWidget.Visible = !showDetails && Service.Status != Status.NotAdded;
                addButton.Sensitive  = Service.Status == Status.NotAdded;

                switch (Service.Status)
                {
                case Status.NotAdded:
                    addButton.Label = GettextCatalog.GetString("Add");
                    addButton.Image = statusIcon.Image = null;

                    // if the service has just been added/removed then the document view won't know this and does not have the correct DocumentObject
                    // tell it to update
                    ConnectedServices.LocateServiceView(this.Service.Project)?.UpdateCurrentNode();
                    break;

                case Status.Added:
                    addButton.Label  = statusText.Text = GettextCatalog.GetString("Added");
                    addButton.Image  = ImageService.GetIcon("md-checkmark").WithSize(IconSize.Small).WithAlpha(0.4);
                    statusIcon.Image = ImageService.GetIcon("md-checkmark").WithSize(IconSize.Small);

                    // if the service has just been added/removed then the document view won't know this and does not have the correct DocumentObject
                    // tell it to update
                    ConnectedServices.LocateServiceView(this.Service.Project)?.UpdateCurrentNode();
                    break;

                case Status.Adding:
                case Status.Removing:
                    addButton.Label = statusText.Text =
                        Service.Status == Status.Adding
                                                ? GettextCatalog.GetString("Adding\u2026")
                                                : GettextCatalog.GetString("Removing\u2026");
                    if (statusIconAnimation == null)
                    {
                        if (animatedStatusIcon != null)
                        {
                            statusIcon.Image    = animatedStatusIcon.FirstFrame;
                            addButton.Image     = animatedStatusIcon.FirstFrame.WithAlpha(0.4);
                            statusIconAnimation = animatedStatusIcon.StartAnimation(p => {
                                statusIcon.Image = p;
                                addButton.Image  = p.WithAlpha(0.4);
                            });
                        }
                        else
                        {
                            statusIcon.Image = ImageService.GetIcon("md-spinner-16").WithSize(Xwt.IconSize.Small);
                            addButton.Image  = ImageService.GetIcon("md-spinner-16").WithSize(Xwt.IconSize.Small).WithAlpha(0.4);
                        }
                    }
                    break;
                }
            });
        }
Exemplo n.º 3
0
 void StartAnimation()
 {
     if (Animation == null)
     {
         Animation = AnimatedIcon.StartAnimation(delegate(Xwt.Drawing.Image pix) {
             Image.Pixbuf = pix.ToPixbuf();
         });
     }
 }
Exemplo n.º 4
0
 void StartAnimation()
 {
     if (Animation == null)
     {
         Animation = AnimatedIcon.StartAnimation(delegate(Gdk.Pixbuf pix) {
             Image.Pixbuf = pix;
         });
     }
 }
Exemplo n.º 5
0
 void StartAnimation()
 {
     if (Animation == null)
     {
         Animation = AnimatedIcon.StartAnimation(delegate(Xwt.Drawing.Image pix) {
             if (TreeStore.IterIsValid(Iter))
             {
                 TreeStore.SetValue(Iter, Column, pix);
             }
             else
             {
                 UnregisterTreeAnimation(this);
             }
         });
     }
 }
Exemplo n.º 6
0
        void LoadPixbuf(IconId iconId)
        {
            // We dont need to load the same image twice
            if (icon == iconId && iconLoaded)
            {
                return;
            }

            icon          = iconId;
            iconAnimation = null;

            // clean up previous running animation
            if (xwtAnimation != null)
            {
                xwtAnimation.Dispose();
                xwtAnimation = null;
            }

            // if we have nothing, use the default icon
            if (iconId == IconId.Null)
            {
                iconId = Stock.StatusSteady;
            }

            // load image now
            if (ImageService.IsAnimation(iconId, Gtk.IconSize.Menu))
            {
                iconAnimation = ImageService.GetAnimatedIcon(iconId, Gtk.IconSize.Menu);
                image         = iconAnimation.FirstFrame.ToNSImage();
                xwtAnimation  = iconAnimation.StartAnimation(p => {
                    image = p.ToNSImage();
                    ReconstructString();
                });
            }
            else
            {
                image = ImageService.GetIcon(iconId).ToNSImage();
            }

            iconLoaded = true;
        }
Exemplo n.º 7
0
        void LoadPixbuf(IconId image)
        {
            // We dont need to load the same image twice
            if (currentIcon == image && iconLoaded)
            {
                return;
            }

            currentIcon   = image;
            iconAnimation = null;

            // clean up previous running animation
            if (currentIconAnimation != null)
            {
                currentIconAnimation.Dispose();
                currentIconAnimation = null;
            }

            // if we have nothing, use the default icon
            if (image == IconId.Null)
            {
                image = "md-status-steady";
            }

            // load image now
            if (ImageService.IsAnimation(image, Gtk.IconSize.Menu))
            {
                iconAnimation           = ImageService.GetAnimatedIcon(image, Gtk.IconSize.Menu);
                renderArg.CurrentPixbuf = iconAnimation.FirstFrame.WithSize(14, 14);
                currentIconAnimation    = iconAnimation.StartAnimation(delegate(Xwt.Drawing.Image p) {
                    renderArg.CurrentPixbuf = p.WithSize(14, 14);
                    QueueDraw();
                });
            }
            else
            {
                renderArg.CurrentPixbuf = ImageService.GetIcon(image).WithSize(14, 14);
            }

            iconLoaded = true;
        }
        public void ShowMessage(IconId iconId, string message, bool isMarkup)
        {
            Message            = message;
            StatusText.ToolTip = message;

            if (iconId.IsNull)
            {
                iconId = BrandingService.StatusSteadyIconId;
            }

            // don't reload same icon
            if (currentIcon == iconId)
            {
                return;
            }

            currentIcon = iconId;

            if (xwtAnimation != null)
            {
                xwtAnimation.Dispose();
                xwtAnimation = null;
            }

            if (ImageService.IsAnimation(currentIcon, Gtk.IconSize.Menu))
            {
                animatedIcon = ImageService.GetAnimatedIcon(currentIcon, Gtk.IconSize.Menu);
                StatusImage  = animatedIcon.FirstFrame;
                xwtAnimation = animatedIcon.StartAnimation(p => {
                    StatusImage = p;
                });
            }
            else
            {
                StatusImage = currentIcon.GetStockIcon().WithSize(Xwt.IconSize.Small);
            }
        }