public override void Draw(IPlatformDrawer platform, float scale)
        {
            base.Draw(platform, scale);

            var paddedBOunds = Bounds.PadSides(5);
            var headerBounds = paddedBOunds.WithHeight(20).Translate(0,10);
            Rect imageBounds;
            var hasHeader = !string.IsNullOrEmpty(NodeViewModel.HeaderText);
            var hasComments= !string.IsNullOrEmpty(NodeViewModel.Comments);
            if (hasHeader)
            {
                imageBounds = paddedBOunds.Below(headerBounds).Translate(0, 5).Clip(paddedBOunds);
            }
            else
            {
                imageBounds = paddedBOunds;
            }

            if (hasHeader)
            {
                var ts =platform.CalculateTextSize(NodeViewModel.HeaderText, CachedStyles.WizardSubBoxTitleStyle);
                platform.DrawLabel(headerBounds, NodeViewModel.HeaderText, CachedStyles.WizardSubBoxTitleStyle);

                var hmRect = new Rect().Align(headerBounds).WithSize(ts.x,2).Below(headerBounds).Translate(0,3);
                platform.DrawRect(hmRect, CachedStyles.GetColor(NodeColor.Gray));

            }

            if (!string.IsNullOrEmpty(NodeViewModel.ImageName) && Image != null)
            {
                platform.DrawImage(imageBounds,Image,true);
            }
            else platform.DrawLabel(imageBounds,"Image Not Found",CachedStyles.WizardSubBoxTitleStyle);
        }
        public override void Draw(IPlatformDrawer platform, float scale)
        {
            base.Draw(platform, scale);

            var paddedBOunds = Bounds.PadSides(5);
            var headerBounds = paddedBOunds.WithHeight(20).Translate(0,10);
            Rect textBounds;
            var hasHeader = !string.IsNullOrEmpty(NodeViewModel.HeaderText);
            if (hasHeader)
            {
                textBounds = paddedBOunds.Below(headerBounds).Translate(0, 5).Clip(paddedBOunds);
            }
            else
            {
                textBounds = paddedBOunds;
            }

            if (NodeViewModel.ShowMark)
            {
                textBounds = textBounds.Pad(6, 0, 6, 0);
            }

            if (hasHeader)
            {
                var ts =platform.CalculateTextSize(NodeViewModel.HeaderText, CachedStyles.WizardSubBoxTitleStyle);
                platform.DrawLabel(headerBounds, NodeViewModel.HeaderText, CachedStyles.WizardSubBoxTitleStyle);

                var hmRect = new Rect().Align(headerBounds).WithSize(ts.x,2).Below(headerBounds).Translate(0,3);
                platform.DrawRect(hmRect, CachedStyles.GetColor(NodeColor.Gray));

            }

            if (NodeViewModel.ShowMark)
            {
                var markRect = textBounds.WithWidth(3).Pad(0,10,0,20).Translate(-6, 0);
                platform.DrawRect(markRect,CachedStyles.GetColor(NodeViewModel.MarkColor));
            }

            platform.DrawLabel(textBounds,ViewModel.Comments,CachedStyles.ListItemTitleStyle);
        }
        public void DrawBreadcrumbs(IPlatformDrawer platform, float y)
        {
            var navPanelRect    = new Rect(4, y, 60, 30f);
            var breadcrumbsRect = new Rect(64, y, Bounds.width - 44, 30f);

            platform.DrawRect(Bounds.WithOrigin(0, y).WithHeight(30), InvertGraphEditor.Settings.BackgroundColor);

            var back = new Rect().WithSize(30, 30).PadSides(2).CenterInsideOf(navPanelRect.LeftHalf());

            platform.DoButton(back, "", ElementDesignerStyles.WizardActionButtonStyleSmall,
                              () =>
            {
                InvertApplication.Execute(new NavigateBackCommand());
            });
            platform.DrawImage(back.PadSides(4), "BackIcon", true);

            var forward = new Rect().WithSize(30, 30).PadSides(2).CenterInsideOf(navPanelRect.RightHalf());

            platform.DoButton(forward, "", ElementDesignerStyles.WizardActionButtonStyleSmall,
                              () =>
            {
                InvertApplication.Execute(new NavigateForwardCommand());
            });
            platform.DrawImage(forward.PadSides(4), "ForwardIcon", true);

            //var color = new Color(InvertGraphEditor.Settings.BackgroundColor.r * 0.8f, InvertGraphEditor.Settings.BackgroundColor.g * 0.8f, InvertGraphEditor.Settings.BackgroundColor.b * 0.8f, 1f);
            //platform.DrawRect(rect, color);

//            var lineRect = new Rect(rect);
//            lineRect.height = 2;
//            lineRect.y = y + 38f;
//            platform.DrawRect(lineRect, new Color(InvertGraphEditor.Settings.BackgroundColor.r * 0.6f, InvertGraphEditor.Settings.BackgroundColor.g * 0.6f, InvertGraphEditor.Settings.BackgroundColor.b * 0.6f, 1f));
//
//
//            var first = true;
//            if (_cachedPaths != null)
//            foreach (var item in _cachedPaths)
//            {
//                var item1 = item;
//                platform.DoButton(new Rect(x, rect.y + 20 - (item.Value.y / 2), item.Value.x, item.Value.y), first ? item.Key.Name : "< " + item.Key.Name, first ? CachedStyles.GraphTitleLabel : CachedStyles.ItemTextEditingStyle,
//                    () =>
//                    {
//                        InvertApplication.Execute(new LambdaCommand(() =>
//                        {
//                            DiagramViewModel.GraphData.PopToFilter(item1.Key);
//                        }));
//                    });
//                x += item.Value.x + 15;
//                first = false;
//            }


            var x = 1f;

            var styles    = DiagramViewModel.NavigationViewModel.BreadcrumbsStyle;
            var iconsTine = new Color(1, 1, 1, 0.5f);

            foreach (var usitem in DiagramViewModel.NavigationViewModel.Breadcrubs.ToArray())
            {
                var   item                 = usitem;
                var   textSize             = platform.CalculateTextSize(usitem.Title, CachedStyles.BreadcrumbTitleStyle);
                float buttonContentPadding = 5;
                float buttonIconsPadding   = 5;
                bool  useSpecIcon          = !string.IsNullOrEmpty(item.SpecializedIcon);
                var   buttonWidth          = textSize.x + buttonContentPadding * 2 + 8;
                if (!string.IsNullOrEmpty(item.Icon))
                {
                    buttonWidth += buttonIconsPadding + 16;
                }
                if (useSpecIcon)
                {
                    buttonWidth += buttonIconsPadding + 16;
                }

                var buttonRect = new Rect()
                                 .AlignAndScale(breadcrumbsRect)
                                 .WithWidth(buttonWidth)
                                 .PadSides(3)
                                 .Translate(x, 0);

                var icon1Rect = new Rect()
                                .WithSize(16, 16)
                                .AlignTopRight(buttonRect)
                                .AlignHorisonallyByCenter(buttonRect)
                                .Translate(-buttonContentPadding, 0);

                var icon2Rect = new Rect()
                                .WithSize(16, 16)
                                .Align(buttonRect)
                                .AlignHorisonallyByCenter(buttonRect)
                                .Translate(buttonContentPadding, 0);

                var textRect = new Rect()
                               .WithSize(textSize.x, textSize.y)
                               .Align(useSpecIcon ? icon2Rect : buttonRect)
                               .AlignHorisonallyByCenter(buttonRect)
                               .Translate(useSpecIcon ? buttonIconsPadding + 16 : buttonContentPadding, -1);

                var dotRect = new Rect()
                              .WithSize(16, 16)
                              .RightOf(buttonRect)
                              .AlignHorisonallyByCenter(buttonRect)
                              .Translate(-3, 0);

                platform.DoButton(buttonRect, "", item.State == NavigationItemState.Current ? CachedStyles.BreadcrumbBoxActiveStyle : CachedStyles.BreadcrumbBoxStyle, item.NavigationAction);
                platform.DrawLabel(textRect, item.Title, CachedStyles.BreadcrumbTitleStyle, DrawingAlignment.MiddleCenter);
                platform.DrawImage(icon1Rect, styles.GetIcon(item.Icon, iconsTine), true);

                if (useSpecIcon)
                {
                    platform.DrawImage(icon2Rect, styles.GetIcon(item.SpecializedIcon, iconsTine), true);
                }
                if (item.State != NavigationItemState.Current)
                {
                    platform.DrawImage(dotRect, styles.GetIcon("DotIcon", iconsTine), true);
                }

                x += buttonRect.width + 16 - 6;
            }
        }
Exemple #4
0
        public void DrawBreadcrumbs(IPlatformDrawer platform, float y)
        {
            var navPanelRect    = new Rect(4, y, 60, 30f);
            var breadcrumbsRect = new Rect(64, y, Bounds.width - 44, 30f);

            platform.DrawRect(Bounds.WithOrigin(0, y).WithHeight(30), InvertGraphEditor.Settings.BackgroundColor);

            var back = new Rect().WithSize(30, 30).PadSides(2).CenterInsideOf(navPanelRect.LeftHalf());

            platform.DoButton(back, "", ElementDesignerStyles.WizardActionButtonStyleSmall,
                              () =>
            {
                InvertApplication.Execute(new NavigateBackCommand());
            });
            platform.DrawImage(back.PadSides(4), "BackIcon", true);

            var forward = new Rect().WithSize(30, 30).PadSides(2).CenterInsideOf(navPanelRect.RightHalf());

            platform.DoButton(forward, "", ElementDesignerStyles.WizardActionButtonStyleSmall,
                              () =>
            {
                InvertApplication.Execute(new NavigateForwardCommand());
            });
            platform.DrawImage(forward.PadSides(4), "ForwardIcon", true);

            var x = 1f;

            var styles    = DiagramViewModel.NavigationViewModel.BreadcrumbsStyle;
            var iconsTine = new Color(1, 1, 1, 0.5f);

            foreach (var usitem in DiagramViewModel.NavigationViewModel.Breadcrubs.ToArray())
            {
                var   item                 = usitem;
                var   textSize             = platform.CalculateTextSize(usitem.Title, CachedStyles.BreadcrumbTitleStyle);
                float buttonContentPadding = 5;
                float buttonIconsPadding   = 5;
                bool  useSpecIcon          = !string.IsNullOrEmpty(item.SpecializedIcon);
                var   buttonWidth          = textSize.x + buttonContentPadding * 2 + 8;
                if (!string.IsNullOrEmpty(item.Icon))
                {
                    buttonWidth += buttonIconsPadding + 16;
                }
                if (useSpecIcon)
                {
                    buttonWidth += buttonIconsPadding + 16;
                }

                var buttonRect = new Rect()
                                 .AlignAndScale(breadcrumbsRect)
                                 .WithWidth(buttonWidth)
                                 .PadSides(3)
                                 .Translate(x, 0);

                var icon1Rect = new Rect()
                                .WithSize(16, 16)
                                .AlignTopRight(buttonRect)
                                .AlignHorisonallyByCenter(buttonRect)
                                .Translate(-buttonContentPadding, 0);

                var icon2Rect = new Rect()
                                .WithSize(16, 16)
                                .Align(buttonRect)
                                .AlignHorisonallyByCenter(buttonRect)
                                .Translate(buttonContentPadding, 0);

                var textRect = new Rect()
                               .WithSize(textSize.x, textSize.y)
                               .Align(useSpecIcon ? icon2Rect : buttonRect)
                               .AlignHorisonallyByCenter(buttonRect)
                               .Translate(useSpecIcon ? buttonIconsPadding + 16 : buttonContentPadding, -1);

                var dotRect = new Rect()
                              .WithSize(16, 16)
                              .RightOf(buttonRect)
                              .AlignHorisonallyByCenter(buttonRect)
                              .Translate(-3, 0);

                platform.DoButton(buttonRect, "", item.State == NavigationItemState.Current ? CachedStyles.BreadcrumbBoxActiveStyle : CachedStyles.BreadcrumbBoxStyle, item.NavigationAction);
                platform.DrawLabel(textRect, item.Title, CachedStyles.BreadcrumbTitleStyle, DrawingAlignment.MiddleCenter);
                platform.DrawImage(icon1Rect, styles.GetIcon(item.Icon, iconsTine), true);

                if (useSpecIcon)
                {
                    platform.DrawImage(icon2Rect, styles.GetIcon(item.SpecializedIcon, iconsTine), true);
                }
                if (item.State != NavigationItemState.Current)
                {
                    platform.DrawImage(dotRect, styles.GetIcon("DotIcon", iconsTine), true);
                }

                x += buttonRect.width + 16 - 6;
            }
        }
        public void DrawBreadcrumbs(IPlatformDrawer platform,  float y)
        {

            var navPanelRect = new Rect(4, y, 60, 30f);
            var breadcrumbsRect = new Rect(64, y, Bounds.width-44, 30f);
            platform.DrawRect(Bounds.WithOrigin(0,y).WithHeight(30), InvertGraphEditor.Settings.BackgroundColor);

            var back = new Rect().WithSize(30, 30).PadSides(2).CenterInsideOf(navPanelRect.LeftHalf());
            platform.DoButton(back, "", ElementDesignerStyles.WizardActionButtonStyleSmall,
                () =>
                {
                    InvertApplication.Execute(new NavigateBackCommand());
                });
            platform.DrawImage(back.PadSides(4), "BackIcon", true);

            var forward = new Rect().WithSize(30, 30).PadSides(2).CenterInsideOf(navPanelRect.RightHalf());
            platform.DoButton(forward, "", ElementDesignerStyles.WizardActionButtonStyleSmall,
                () =>
                {
                    InvertApplication.Execute(new NavigateForwardCommand());
                });
            platform.DrawImage(forward.PadSides(4),"ForwardIcon",true);

            //var color = new Color(InvertGraphEditor.Settings.BackgroundColor.r * 0.8f, InvertGraphEditor.Settings.BackgroundColor.g * 0.8f, InvertGraphEditor.Settings.BackgroundColor.b * 0.8f, 1f);
            //platform.DrawRect(rect, color);
            
//            var lineRect = new Rect(rect);
//            lineRect.height = 2;
//            lineRect.y = y + 38f;
//            platform.DrawRect(lineRect, new Color(InvertGraphEditor.Settings.BackgroundColor.r * 0.6f, InvertGraphEditor.Settings.BackgroundColor.g * 0.6f, InvertGraphEditor.Settings.BackgroundColor.b * 0.6f, 1f));
//            
//            
//            var first = true;
//            if (_cachedPaths != null)
//            foreach (var item in _cachedPaths)
//            {
//                var item1 = item;
//                platform.DoButton(new Rect(x, rect.y + 20 - (item.Value.y / 2), item.Value.x, item.Value.y), first ? item.Key.Name : "< " + item.Key.Name, first ? CachedStyles.GraphTitleLabel : CachedStyles.ItemTextEditingStyle,
//                    () =>
//                    {
//                        InvertApplication.Execute(new LambdaCommand(() =>
//                        {
//                            DiagramViewModel.GraphData.PopToFilter(item1.Key);
//                        }));
//                    });
//                x += item.Value.x + 15;
//                first = false;
//            }


            var x = 1f;

            var styles = DiagramViewModel.NavigationViewModel.BreadcrumbsStyle;
            var iconsTine = new Color(1, 1, 1, 0.5f);

            foreach (var usitem in DiagramViewModel.NavigationViewModel.Breadcrubs.ToArray())
            {
                var item = usitem;
                var textSize = platform.CalculateTextSize(usitem.Title, CachedStyles.BreadcrumbTitleStyle);
                float buttonContentPadding = 5;
                float buttonIconsPadding= 5;
                bool useSpecIcon = !string.IsNullOrEmpty(item.SpecializedIcon);
                var buttonWidth = textSize.x + buttonContentPadding*2 + 8;
                if (!string.IsNullOrEmpty(item.Icon)) buttonWidth += buttonIconsPadding + 16;
                if (useSpecIcon) buttonWidth += buttonIconsPadding + 16;
               
                var buttonRect = new Rect()
                    .AlignAndScale(breadcrumbsRect)
                    .WithWidth(buttonWidth)
                    .PadSides(3)
                    .Translate(x, 0);

                var icon1Rect = new Rect()
                    .WithSize(16, 16)
                    .AlignTopRight(buttonRect)
                    .AlignHorisonallyByCenter(buttonRect)
                    .Translate(-buttonContentPadding, 0);

                var icon2Rect = new Rect()
                    .WithSize(16, 16)
                    .Align(buttonRect)
                    .AlignHorisonallyByCenter(buttonRect)
                    .Translate(buttonContentPadding, 0);

                var textRect = new Rect()
                    .WithSize(textSize.x, textSize.y)
                    .Align(useSpecIcon ? icon2Rect : buttonRect)
                    .AlignHorisonallyByCenter(buttonRect)
                    .Translate(useSpecIcon ? buttonIconsPadding + 16 : buttonContentPadding, -1);

                var dotRect = new Rect()
                    .WithSize(16, 16)
                    .RightOf(buttonRect)
                    .AlignHorisonallyByCenter(buttonRect)
                    .Translate(-3,0);

                platform.DoButton(buttonRect, "", item.State == NavigationItemState.Current ? CachedStyles.BreadcrumbBoxActiveStyle : CachedStyles.BreadcrumbBoxStyle, item.NavigationAction);
                platform.DrawLabel(textRect, item.Title, CachedStyles.BreadcrumbTitleStyle, DrawingAlignment.MiddleCenter);
                platform.DrawImage(icon1Rect, styles.GetIcon(item.Icon,iconsTine), true);

                if (useSpecIcon) platform.DrawImage(icon2Rect, styles.GetIcon(item.SpecializedIcon, iconsTine), true);
                if (item.State != NavigationItemState.Current) platform.DrawImage(dotRect, styles.GetIcon("DotIcon", iconsTine), true);

                x += buttonRect.width + 16 - 6;

            }



        }