Ejemplo n.º 1
0
        private void AddActionLabel(LinksPaneActionItem actionItem, int curX, int curY)
        {
            JetLinkLabel lbl = (JetLinkLabel)_actionLabelPool.GetControl();

            lbl.ClickableLink = true;
            lbl.Enabled       = actionItem.Enabled;
            lbl.Text          = actionItem.Text;
            lbl.Tag           = actionItem.Action;
            lbl.BackColor     = Color.FromArgb(0, SystemColors.Control);
            lbl.Location      = new Point(curX, curY);
        }
Ejemplo n.º 2
0
        private void AddLinkGroupSeparator(ref int curY)
        {
            Control separator = _separatorPool.GetControl();

            separator.Location = new Point(0, curY);
            curY += 3;
        }
Ejemplo n.º 3
0
        /**
         * Adds an icon and label for a single resource.
         */

        private ResourceLinkLabel AddResourceLabel(IResource linkRes, int linkType, ref int curX, int curY)
        {
            ResourceLinkLabel linkLabel = (ResourceLinkLabel)_resourceLinkLabelPool.GetControl();

            linkLabel.Resource = linkRes;
            linkLabel.LinkType = Math.Abs(linkType);

            int width = linkLabel.PreferredWidth;

            if (_verticalViewMode && width > Width - curX - 8)
            {
                width = Width - curX - 8;
                linkLabel.AutoSize    = false;
                linkLabel.EndEllipsis = true;
            }
            else
            {
                linkLabel.AutoSize    = true;
                linkLabel.EndEllipsis = false;
            }
            int dy = (_scaleHeight >= 1.01f) ? 2 : 1;

            linkLabel.Bounds            = new Rectangle(curX, curY + dy, width, 16);
            linkLabel.LinkOwnerResource = _resource;
            linkLabel.PostfixText       = "";
            curX += width + 4;
            return(linkLabel);
        }
Ejemplo n.º 4
0
        private void AddLinkLabel(object tag, string text, ref int x)
        {
            JetLinkLabel linkLabel = (JetLinkLabel)_linkLabelPool.GetControl();

            linkLabel.Text     = text;
            linkLabel.Location = new Point(x, 2);
            linkLabel.Tag      = tag;
            SetLinkColor(linkLabel);

            x += linkLabel.PreferredWidth + 12;
        }
Ejemplo n.º 5
0
        protected override void UpdateLinksPane()
        {
            if (Core.State == CoreState.ShuttingDown)
            {
                return;
            }
            if (_resourceList != null && _resourceList.Count == 1 && _resourceList [0].IsDeleting)
            {
                return;
            }

            RemoveAllControls();
            _borderPanel.AutoScrollPosition = new Point(0, 0);

            if (_resourceList != null && _resourceList.Count > 0)
            {
                int curX = 0;
                int curY = 4 - _scrollY;
                if (_resourceList.Count == 1)
                {
                    LinkSection section = BuildLinksForResource(_resourceList[0]);
                    ShowLinksFromSection(section, ref curX, ref curY);
                    ShowCustomPropertiesForResource(_resourceList[0], ref curX, ref curY);
                }
                else
                {
                    AddLinkTypeLabel(ref curX, ref curY, _resourceList.Count + " resources selected");
                    curY += 8;
                }

                LinksPaneActionItem[] actionItems = LinksPaneActionManager.GetManager().CreateActionLinks(_resourceList, _filter);
                if (actionItems.Length > 0)
                {
                    AddLinkTypeLabel(ref curX, ref curY, "Actions");
                    foreach (LinksPaneActionItem item in actionItems)
                    {
                        JetLinkLabel lbl = (JetLinkLabel)_actionLabelPool.GetControl();
                        lbl.AutoSize  = false;
                        lbl.Enabled   = item.Enabled;
                        lbl.Text      = item.Text;
                        lbl.Tag       = item.Action;
                        lbl.BackColor = Color.FromArgb(0, SystemColors.Control);
                        lbl.Bounds    = new Rectangle(_linkLabelX, curY, Width - _linkLabelX - 4, lbl.PreferredSize.Height);
                        curY         += 18;
                    }
                }

                UpdateLinkLabelTooltips();
            }

            DisposePooledControls();
            _borderPanel.Invalidate();
        }
Ejemplo n.º 6
0
        /**
         * Adds an icon and label for a single resource.
         */

        private ResourceLinkLabel AddResourceLabel(IResource linkRes, int linkType, IResource linkOwnerRes,
                                                   int curY)
        {
            ResourceLinkLabel linkLabel = (ResourceLinkLabel)_resourceLinkLabelPool.GetControl();

            linkLabel.Resource          = linkRes;
            linkLabel.LinkOwnerResource = linkOwnerRes;
            linkLabel.LinkType          = Math.Abs(linkType);
            linkLabel.Bounds            = new Rectangle(_linkLabelX, curY, Width - _linkLabelX - 4,
                                                        (int)(19 * Core.ScaleFactor.Height));
            linkLabel.EndEllipsis = true;
            return(linkLabel);
        }
Ejemplo n.º 7
0
        /**
         * Creates a link type label with the specified name.
         */

        private Control AddLinkTypeLabel(ref int curX, ref int curY, string text)
        {
            JetLinkLabel typeLabel = (JetLinkLabel)_linkTypeLabelPool.GetControl();

            int typeLabelHeight = (int)(17 * Core.ScaleFactor.Height);

            typeLabel.Text      = text;
            typeLabel.Bounds    = new Rectangle(_linkTypeLabelX, curY, Width - _linkTypeLabelX - 4, typeLabelHeight);
            typeLabel.Visible   = true;
            typeLabel.ForeColor = ColorScheme.GetColor(_colorScheme, "LinksPane.LinkTypeText", Color.Black);
            curY += typeLabelHeight;
            return(typeLabel);
        }
Ejemplo n.º 8
0
        public override void EditResource(IResource res)
        {
            IResourceList accounts = res.GetLinksOfType(null, Props.MirandaAcct);

            accounts.Sort(new SortSettings(ResourceProps.Type, true));
            int curY = 4;

            _typeLabelPool.MoveControlsToPool();
            _valueLabelPool.MoveControlsToPool();

            foreach (IResource acct in accounts)
            {
                string acctType;
                switch (acct.Type)
                {
                case ResourceTypes.MirandaICQAccount:    acctType = "ICQ";    break;

                case ResourceTypes.MirandaAIMAccount:    acctType = "AIM";    break;

                case ResourceTypes.MirandaJabberAccount: acctType = "Jabber"; break;

                case ResourceTypes.MirandaYahooAccount:  acctType = "Yahoo";  break;

                default: acctType = "Other"; break;
                }

                Label lblType = (Label)_typeLabelPool.GetControl();
                lblType.Text     = acctType + ":";
                lblType.Location = new Point(4, curY);

                JetTextBox lblValue = (JetTextBox)_valueLabelPool.GetControl();
                if (acct.Type == ResourceTypes.MirandaICQAccount)
                {
                    lblValue.Text = acct.GetPropText("UIN");
                }
                else
                {
                    lblValue.Text = acct.DisplayName;
                }

                lblValue.Location = new Point(88, curY);
                lblValue.Width    = Width - 96;

                curY += 20;
            }

            _typeLabelPool.RemovePooledControls();
            _valueLabelPool.RemovePooledControls();

            Height = curY + 4;
        }
Ejemplo n.º 9
0
        /**
         * Creates a link type label with the specified name.
         */

        private Label AddLinkTypeLabel(ref int curX, ref int curY, string text, ref int maxWidth)
        {
            Label typeLabel = (Label)_linkTypeLabelPool.GetControl();

            typeLabel.Text     = text + ":";
            typeLabel.Bounds   = new Rectangle(curX, curY + 2, Width - 8, 15);
            typeLabel.Visible  = true;
            typeLabel.AutoSize = true;

            if (!_verticalViewMode)
            {
                curX += typeLabel.Width + _cSpaceAfterLinkType;
            }
            if (typeLabel.Width > maxWidth)
            {
                maxWidth = typeLabel.Width;
            }
            return(typeLabel);
        }