Esempio n. 1
0
        private FlowLayoutWidget CreateRightButtonPanel(double buildHeight)
        {
            FlowLayoutWidget buttonRightPanel = new FlowLayoutWidget(FlowDirection.TopToBottom);

            buttonRightPanel.Width = 200;
            {
                BorderDouble buttonMargin = new BorderDouble(top: 3);

                // put in the word editing menu
                {
                    CheckBox expandWordOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Word Edit".Localize(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png");
                    expandWordOptions.Margin = new BorderDouble(bottom: 2);
                    buttonRightPanel.AddChild(expandWordOptions);

                    FlowLayoutWidget wordOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
                    wordOptionContainer.HAnchor = HAnchor.ParentLeftRight;
                    wordOptionContainer.Visible = false;
                    buttonRightPanel.AddChild(wordOptionContainer);

                    sizeScrollBar = InsertUiForSlider(wordOptionContainer, "Size:".Localize(), .3, 2);
                    {
                        sizeScrollBar.ValueChanged += (sender, e) =>
                        {
                            SetWordSize(MeshGroups, MeshGroupTransforms);

                            //SetWordSpacing(MeshGroups, MeshGroupTransforms, MeshGroupExtraData);
                            RebuildBase();
                        };
                    }

                    heightScrollBar = InsertUiForSlider(wordOptionContainer, "Height:".Localize(), .05, 1);
                    {
                        heightScrollBar.ValueChanged += (sender, e) =>
                        {
                            SetWordHeight(MeshGroups, MeshGroupTransforms);
                            RebuildBase();
                        };
                    }

                    // put in the user alpha check box
                    {
                        includeText             = new CheckBox(new CheckBoxViewText("Include Text".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor));
                        includeText.ToolTipText = "Show normal text above the braille".Localize();
                        includeText.Checked     = false;
                        includeText.Margin      = new BorderDouble(10, 5);
                        includeText.HAnchor     = HAnchor.ParentLeft;
                        wordOptionContainer.AddChild(includeText);
                        includeText.CheckedStateChanged += (sender, e) =>
                        {
                            InsertTextNow(this.word);
                        };
                    }

                    // put in the user alpha check box
                    {
                        useGrade2             = new CheckBox(new CheckBoxViewText("Use Grade 2".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor));
                        useGrade2.ToolTipText = "Experimental support for Braille grade 2 (contractions)".Localize();
                        useGrade2.Checked     = false;
                        useGrade2.Margin      = new BorderDouble(10, 5);
                        useGrade2.HAnchor     = HAnchor.ParentLeft;
                        wordOptionContainer.AddChild(useGrade2);
                        useGrade2.CheckedStateChanged += (sender, e) =>
                        {
                            InsertTextNow(this.word);
                        };
                    }

                    // put in a link to the wikipedia article
                    {
                        LinkButtonFactory linkButtonFactory = new LinkButtonFactory();
                        linkButtonFactory.fontSize  = 10;
                        linkButtonFactory.textColor = ActiveTheme.Instance.PrimaryTextColor;

                        Button moreAboutBrailleLink = linkButtonFactory.Generate("About Braille".Localize());
                        moreAboutBrailleLink.Margin  = new BorderDouble(10, 5);
                        moreAboutBrailleLink.HAnchor = HAnchor.ParentLeft;
                        moreAboutBrailleLink.Click  += (sender, e) =>
                        {
                            UiThread.RunOnIdle(() =>
                            {
                                MatterControlApplication.Instance.LaunchBrowser("https://en.wikipedia.org/wiki/Braille");
                            });
                        };

                        wordOptionContainer.AddChild(moreAboutBrailleLink);
                    }

                    expandWordOptions.CheckedStateChanged += (sender, e) =>
                    {
                        wordOptionContainer.Visible = expandWordOptions.Checked;
                    };

                    expandWordOptions.Checked = true;
                }

                GuiWidget verticalSpacer = new GuiWidget();
                verticalSpacer.VAnchor = VAnchor.ParentBottomTop;
                buttonRightPanel.AddChild(verticalSpacer);

                saveButton         = WhiteButtonFactory.Generate("Save".Localize(), centerText: true);
                saveButton.Visible = false;
                saveButton.Cursor  = Cursors.Hand;

                saveAndExitButton         = WhiteButtonFactory.Generate("Save & Exit".Localize(), centerText: true);
                saveAndExitButton.Visible = false;
                saveAndExitButton.Cursor  = Cursors.Hand;

                //buttonRightPanel.AddChild(saveButton);
                buttonRightPanel.AddChild(saveAndExitButton);
            }

            buttonRightPanel.Padding         = new BorderDouble(6, 6);
            buttonRightPanel.Margin          = new BorderDouble(0, 1);
            buttonRightPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            buttonRightPanel.VAnchor         = VAnchor.ParentBottomTop;

            return(buttonRightPanel);
        }
Esempio n. 2
0
        private FlowLayoutWidget CreateRightButtonPanel(double buildHeight)
        {
            FlowLayoutWidget buttonRightPanel = new FlowLayoutWidget(FlowDirection.TopToBottom);

            buttonRightPanel.Width = 200;
            {
                BorderDouble buttonMargin = new BorderDouble(top: 3);

                // put in the word editing menu
                {
                    CheckBox expandWordOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Word Edit".Localize(), "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png");
                    expandWordOptions.Margin = new BorderDouble(bottom: 2);
                    buttonRightPanel.AddChild(expandWordOptions);

                    FlowLayoutWidget wordOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
                    wordOptionContainer.HAnchor = HAnchor.ParentLeftRight;
                    wordOptionContainer.Visible = false;
                    buttonRightPanel.AddChild(wordOptionContainer);

                    spacingScrollBar = InsertUiForSlider(wordOptionContainer, "Spacing:".Localize(), .5, 1);
                    {
                        spacingScrollBar.ValueChanged += (sender, e) =>
                        {
                            SetWordSpacing(MeshGroups, MeshGroupTransforms, MeshGroupExtraData);
                            RebuildUnderlineIfRequired();
                        };
                    }

                    sizeScrollBar = InsertUiForSlider(wordOptionContainer, "Size:".Localize(), .3, 2);
                    {
                        sizeScrollBar.ValueChanged += (sender, e) =>
                        {
                            SetWordSize(MeshGroups, MeshGroupTransforms);

                            //SetWordSpacing(MeshGroups, MeshGroupTransforms, MeshGroupExtraData);
                            RebuildUnderlineIfRequired();
                        };
                    }

                    heightScrollBar = InsertUiForSlider(wordOptionContainer, "Height:".Localize(), .05, 1);
                    {
                        heightScrollBar.ValueChanged += (sender, e) =>
                        {
                            SetWordHeight(MeshGroups, MeshGroupTransforms);
                            RebuildUnderlineIfRequired();
                        };
                    }

                    createUnderline         = new CheckBox(new CheckBoxViewText("Underline".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor));
                    createUnderline.Checked = true;
                    createUnderline.Margin  = new BorderDouble(10, 5);
                    createUnderline.HAnchor = HAnchor.ParentLeft;
                    wordOptionContainer.AddChild(createUnderline);
                    createUnderline.CheckedStateChanged += (sender, e) =>
                    {
                        int oldIndex = SelectedMeshGroupIndex;
                        if (!createUnderline.Checked)
                        {
                            // we need to remove the underline
                            if (MeshGroups.Count > 1)
                            {
                                SelectedMeshGroupIndex = MeshGroups.Count - 1;
                                DeleteSelectedMesh();
                            }
                        }
                        else if (MeshGroups.Count > 0)
                        {
                            // we need to add the underline
                            CreateUnderline(MeshGroups, MeshGroupTransforms, MeshGroupExtraData);
                        }
                        SelectedMeshGroupIndex = Math.Min(oldIndex, MeshGroups.Count - 1);
                    };

                    expandWordOptions.CheckedStateChanged += (sender, e) =>
                    {
                        wordOptionContainer.Visible = expandWordOptions.Checked;
                    };

                    expandWordOptions.Checked = true;
                }

                // put in the letter editing menu
                {
                    CheckBox expandLetterOptions = ExpandMenuOptionFactory.GenerateCheckBoxButton("Letter", "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png");
                    expandLetterOptions.Margin = new BorderDouble(bottom: 2);
                    //buttonRightPanel.AddChild(expandLetterOptions);

                    FlowLayoutWidget letterOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
                    letterOptionContainer.HAnchor = HAnchor.ParentLeftRight;
                    letterOptionContainer.Visible = false;
                    buttonRightPanel.AddChild(letterOptionContainer);

                    SolidSlider sizeScrollBar     = InsertUiForSlider(letterOptionContainer, "Size:".Localize());
                    SolidSlider heightScrollBar   = InsertUiForSlider(letterOptionContainer, "Height:".Localize());
                    SolidSlider rotationScrollBar = InsertUiForSlider(letterOptionContainer, "Rotation:".Localize());

                    expandLetterOptions.CheckedStateChanged += (sender, e) =>
                    {
                        letterOptionContainer.Visible = expandLetterOptions.Checked;
                    };
                }

                GuiWidget verticalSpacer = new GuiWidget();
                verticalSpacer.VAnchor = VAnchor.ParentBottomTop;
                buttonRightPanel.AddChild(verticalSpacer);

                saveButton         = WhiteButtonFactory.Generate("Save".Localize(), centerText: true);
                saveButton.Visible = false;
                saveButton.Cursor  = Cursors.Hand;

                saveAndExitButton         = WhiteButtonFactory.Generate("Save & Exit".Localize(), centerText: true);
                saveAndExitButton.Visible = false;
                saveAndExitButton.Cursor  = Cursors.Hand;

                //buttonRightPanel.AddChild(saveButton);
                buttonRightPanel.AddChild(saveAndExitButton);
            }

            buttonRightPanel.Padding         = new BorderDouble(6, 6);
            buttonRightPanel.Margin          = new BorderDouble(0, 1);
            buttonRightPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
            buttonRightPanel.VAnchor         = VAnchor.ParentBottomTop;

            return(buttonRightPanel);
        }