示例#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();
		}
        public SlicePresetDetailWidget(SlicePresetsWindow windowController)
        {
            this.windowController = windowController;
            this.AnchorAll();
            if (this.windowController.ActivePresetLayer == null)
            {
                initSlicePreset();
            }

            linkButtonFactory.fontSize  = 10;
            linkButtonFactory.textColor = ActiveTheme.Instance.SecondaryAccentColor;

            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();
        }
		public SlicePresetDetailWidget(SlicePresetsWindow windowController)
		{
			this.windowController = windowController;
			this.AnchorAll();
			if (this.windowController.ActivePresetLayer == null)
			{
				initSlicePreset();
			}

			linkButtonFactory.fontSize = 8;
			linkButtonFactory.textColor = ActiveTheme.Instance.SecondaryAccentColor;

			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();
		}
示例#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;
            }
			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;
			}