示例#1
0
        public SlicePresetListWidget(SlicePresetsWindow windowController)
        {
            this.windowController = windowController;
            this.AnchorAll();

            linkButtonFactory = new LinkButtonFactory();

            buttonFactory = new TextImageButtonFactory();
            buttonFactory.normalTextColor   = ActiveTheme.Instance.PrimaryTextColor;
            buttonFactory.hoverTextColor    = ActiveTheme.Instance.PrimaryTextColor;
            buttonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor;
            buttonFactory.pressedTextColor  = ActiveTheme.Instance.PrimaryTextColor;
            buttonFactory.borderWidth       = 0;

            AddElements();
        }
		public SlicePresetListWidget(SlicePresetsWindow windowController)
		{
			this.windowController = windowController;
			this.AnchorAll();

			linkButtonFactory = new LinkButtonFactory();

			buttonFactory = new TextImageButtonFactory();
			buttonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
			buttonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor;
			buttonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor;
			buttonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor;
			buttonFactory.borderWidth = 0;

			AddElements();
			AddHandlers();
		}
示例#3
0
        public SlicePresetsWindow(PresetsContext presetsContext)
            : base(641, 481)
        {
            this.presetsContext    = presetsContext;
            this.AlwaysOnTopOfMain = true;
            this.Title             = LocalizedString.Get("Slice Presets Editor");
            this.MinimumSize       = new Vector2(640, 480);
            this.AnchorAll();

            var linkButtonFactory = new LinkButtonFactory()
            {
                fontSize  = 8,
                textColor = ActiveTheme.Instance.SecondaryAccentColor
            };

            var buttonFactory = new TextImageButtonFactory()
            {
                normalTextColor   = ActiveTheme.Instance.PrimaryTextColor,
                hoverTextColor    = ActiveTheme.Instance.PrimaryTextColor,
                disabledTextColor = ActiveTheme.Instance.PrimaryTextColor,
                pressedTextColor  = ActiveTheme.Instance.PrimaryTextColor,
                borderWidth       = 0
            };

            FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                Padding = new BorderDouble(3)
            };

            mainContainer.AnchorAll();

            middleRow = new GuiWidget();
            middleRow.AnchorAll();
            middleRow.AddChild(CreateSliceSettingsWidget(presetsContext.PersistenceLayer));

            mainContainer.AddChild(GetTopRow());
            mainContainer.AddChild(middleRow);
            mainContainer.AddChild(GetBottomRow(buttonFactory));

            this.AddChild(mainContainer);

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
        }
		public SlicePresetsWindow(PresetsContext presetsContext)
				: base(641, 481)
		{
			this.presetsContext = presetsContext;
			this.AlwaysOnTopOfMain = true;
			this.Title = LocalizedString.Get("Slice Presets Editor");
			this.MinimumSize = new Vector2(640, 480);
			this.AnchorAll();

			var linkButtonFactory = new LinkButtonFactory()
			{
				fontSize = 8,
				textColor = ActiveTheme.Instance.SecondaryAccentColor
			};

			var buttonFactory = new TextImageButtonFactory()
			{
				normalTextColor = ActiveTheme.Instance.PrimaryTextColor,
				hoverTextColor = ActiveTheme.Instance.PrimaryTextColor,
				disabledTextColor = ActiveTheme.Instance.PrimaryTextColor,
				pressedTextColor = ActiveTheme.Instance.PrimaryTextColor,
				borderWidth = 0
			};

			FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
			{
				Padding = new BorderDouble(3)
			};
			mainContainer.AnchorAll();

			middleRow = new GuiWidget();
			middleRow.AnchorAll();
			middleRow.AddChild(CreateSliceSettingsWidget(presetsContext.PersistenceLayer));

			mainContainer.AddChild(GetTopRow());
			mainContainer.AddChild(middleRow);
			mainContainer.AddChild(GetBottomRow(buttonFactory));

			this.AddChild(mainContainer);

			BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
		}
示例#5
0
            public PresetListItem(SlicePresetsWindow windowController, SliceSettingsCollection preset)
            {
                this.preset          = preset;
                this.BackgroundColor = RGBA_Bytes.White;
                this.HAnchor         = HAnchor.ParentLeftRight;
                this.Margin          = new BorderDouble(6, 0, 6, 3);
                this.Padding         = new BorderDouble(3);

                LinkButtonFactory linkButtonFactory = new LinkButtonFactory();

                linkButtonFactory.fontSize = 10;

                int        maxLabelWidth = 300;
                TextWidget materialLabel = new TextWidget(preset.Name, pointSize: 14);

                materialLabel.EllipsisIfClipped = true;
                materialLabel.VAnchor           = Agg.UI.VAnchor.ParentCenter;
                materialLabel.MinimumSize       = new Vector2(maxLabelWidth, materialLabel.Height);
                materialLabel.Width             = maxLabelWidth;

                Button materialEditLink = linkButtonFactory.Generate("edit");

                materialEditLink.VAnchor = Agg.UI.VAnchor.ParentCenter;
                materialEditLink.Click  += (sender, e) =>
                {
                    UiThread.RunOnIdle(() =>
                    {
                        windowController.ChangeToSlicePresetDetail(preset);
                    });
                };

                Button materialRemoveLink = linkButtonFactory.Generate("remove");

                materialRemoveLink.Margin  = new BorderDouble(left: 4);
                materialRemoveLink.VAnchor = Agg.UI.VAnchor.ParentCenter;
                materialRemoveLink.Click  += (sender, e) =>
                {
                    UiThread.RunOnIdle(() =>
                    {
                        //Unwind this setting if it is currently active
                        if (ActivePrinterProfile.Instance.ActivePrinter != null)
                        {
                            if (preset.Id == ActivePrinterProfile.Instance.ActiveQualitySettingsID)
                            {
                                ActivePrinterProfile.Instance.ActiveQualitySettingsID = 0;
                            }

                            string[] activeMaterialPresets = ActivePrinterProfile.Instance.ActivePrinter.MaterialCollectionIds.Split(',');
                            for (int i = 0; i < activeMaterialPresets.Count(); i++)
                            {
                                int index = 0;
                                Int32.TryParse(activeMaterialPresets[i], out index);
                                if (preset.Id == index)
                                {
                                    ActivePrinterProfile.Instance.SetMaterialSetting(i + 1, 0);
                                }
                            }
                        }
                        preset.Delete();
                        windowController.ChangeToSlicePresetList();
                        ActiveSliceSettings.Instance.LoadAllSettings();
                        ApplicationController.Instance.ReloadAdvancedControlsPanel();
                    });
                };

                this.AddChild(materialLabel);
                this.AddChild(new HorizontalSpacer());
                this.AddChild(materialEditLink);
                this.AddChild(materialRemoveLink);

                this.Height = 35;
            }
        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 checkbox
                    {
                        includeText             = new CheckBox(new CheckBoxViewText("Include Text".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor));
                        includeText.ToolTipText = "Show normal text under 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 checkbox
                    {
                        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);
        }
		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(),
					View3DWidget.ArrowRight,
					View3DWidget.ArrowDown);
					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;
		}
			public PresetListItem(SlicePresetsWindow windowController, SliceSettingsCollection preset)
			{
				this.preset = preset;
				this.BackgroundColor = RGBA_Bytes.White;
				this.HAnchor = HAnchor.ParentLeftRight;
				this.Margin = new BorderDouble(6, 0, 6, 3);
				this.Padding = new BorderDouble(3);

				LinkButtonFactory linkButtonFactory = new LinkButtonFactory();
				linkButtonFactory.fontSize = 10;

				int maxLabelWidth = 300;
				TextWidget materialLabel = new TextWidget(preset.Name, pointSize: 14);
				materialLabel.EllipsisIfClipped = true;
				materialLabel.VAnchor = Agg.UI.VAnchor.ParentCenter;
				materialLabel.MinimumSize = new Vector2(maxLabelWidth, materialLabel.Height);
				materialLabel.Width = maxLabelWidth;

				Button materialEditLink = linkButtonFactory.Generate("edit");
				materialEditLink.VAnchor = Agg.UI.VAnchor.ParentCenter;
				materialEditLink.Click += (sender, e) =>
				{
					UiThread.RunOnIdle(() =>
					{
						windowController.ChangeToSlicePresetDetail(preset);
					});
				};

				Button materialRemoveLink = linkButtonFactory.Generate("remove");
				materialRemoveLink.Margin = new BorderDouble(left: 4);
				this.DebugShowBounds = true;
				materialRemoveLink.VAnchor = Agg.UI.VAnchor.ParentCenter;
				materialRemoveLink.Click += (sender, e) =>
				{
					UiThread.RunOnIdle(() =>
					{
						//Unwind this setting if it is currently active
						if (ActiveSliceSettings.Instance != null)
						{
							/*
							if (preset.Id == ActivePrinterProfile.Instance.ActiveQualitySettingsID)
							{
								ActivePrinterProfile.Instance.ActiveQualitySettingsID = 0;
							}

							string[] activeMaterialPresets = ActiveSliceSettings.Instance.MaterialCollectionIds.Split(',');
							for (int i = 0; i < activeMaterialPresets.Count(); i++)
							{
								int index = 0;
								Int32.TryParse(activeMaterialPresets[i], out index);
								if (preset.Id == index)
								{
									ActiveSliceSettings.Instance.SetMaterialPreset(i, "");
								}
							} */
						}
						preset.Delete();
						windowController.ChangeToSlicePresetList();
						ApplicationController.Instance.ReloadAdvancedControlsPanel();
					});
				};

				this.AddChild(materialLabel);
				this.AddChild(new HorizontalSpacer());
				this.AddChild(materialEditLink);
				this.AddChild(materialRemoveLink);

				this.Height = 35;
			}