public static void Show() { if (editMacrosWindow == null) { editMacrosWindow = new EditMacrosWindow(); editMacrosWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editMacrosWindow = null; }; } else { editMacrosWindow.BringToFront(); } }
public static void Show() { if (editMacrosWindow == null) { editMacrosWindow = new EditMacrosWindow(ReloadMacros); editMacrosWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editMacrosWindow = null; }; } else { editMacrosWindow.BringToFront(); } }
void AddChildElements() { Button editButton; GroupBox groupBox = new GroupBox(textImageButtonFactory.GenerateGroupBoxLableWithEdit(new LocalizedString("Macros").Translated, out editButton)); editButton.Click += (sender, e) => { if (editSettingsWindow == null) { editSettingsWindow = new EditMacrosWindow(GetMacros(), ReloadMacros); editSettingsWindow.Closed += (popupWindowSender, popupWindowSenderE) => { editSettingsWindow = null; }; } else { editSettingsWindow.BringToFront(); } }; groupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; groupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight; // make sure the client area will get smaller when the contents get smaller groupBox.ClientArea.VAnchor = Agg.UI.VAnchor.FitToChildren; FlowLayoutWidget controlRow = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom); controlRow.Margin = new BorderDouble(top: 5); controlRow.HAnchor |= HAnchor.ParentLeftRight; { { this.presetButtonsContainer = GetMacroButtonContainer(); controlRow.AddChild(this.presetButtonsContainer); } } groupBox.AddChild(controlRow); this.AddChild(groupBox); }
public MacroDetailWidget(EditMacrosWindow windowController) { this.windowController = windowController; if (this.windowController.ActiveMacro == null) { initMacro(); } linkButtonFactory.fontSize = 10; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); { string editMacroLabel = LocalizedString.Get("Edit Macro"); string editMacroLabelFull = string.Format("{0}:", editMacroLabel); TextWidget elementHeader = new TextWidget(editMacroLabelFull, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.Padding = new BorderDouble(3); presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } topToBottom.AddChild(presetsFormContainer); presetsFormContainer.AddChild(createMacroNameContainer()); presetsFormContainer.AddChild(createMacroCommandContainer()); Button addMacroButton = textImageButtonFactory.Generate(LocalizedString.Get("Save")); addMacroButton.Click += new ButtonBase.ButtonEventHandler(saveMacro_Click); Button cancelPresetsButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel")); cancelPresetsButton.Click += (sender, e) => { UiThread.RunOnIdle((state) => { windowController.ChangeToMacroList(); }); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(addMacroButton); buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); this.AnchorAll(); }
public MacroListWidget(EditMacrosWindow windowController) { this.windowController = windowController; linkButtonFactory.fontSize = 10; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); { string macroPresetsLabel = LocalizedString.Get("Macro Presets"); string macroPresetsLabelFull = string.Format("{0}:", macroPresetsLabel); TextWidget elementHeader = new TextWidget(macroPresetsLabelFull, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.Padding = new BorderDouble(3); presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } topToBottom.AddChild(presetsFormContainer); IEnumerable <DataStorage.CustomCommands> macroList = GetMacros(); foreach (DataStorage.CustomCommands currentCommand in macroList) { FlowLayoutWidget macroRow = new FlowLayoutWidget(); macroRow.Margin = new BorderDouble(3, 0, 3, 3); macroRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.Padding = new BorderDouble(3); macroRow.BackgroundColor = RGBA_Bytes.White; TextWidget buttonLabel = new TextWidget(currentCommand.Name); macroRow.AddChild(buttonLabel); FlowLayoutWidget hSpacer = new FlowLayoutWidget(); hSpacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.AddChild(hSpacer); Button editLink = linkButtonFactory.Generate(LocalizedString.Get("edit")); editLink.Margin = new BorderDouble(right: 5); // You can't pass a foreach variable into a link function or it wall always be the last item. // So we make a local variable copy of it and pass that. This will get the right one. DataStorage.CustomCommands currentCommandForLinkFunction = currentCommand; editLink.Click += (sender, e) => { windowController.ChangeToMacroDetail(currentCommandForLinkFunction); }; macroRow.AddChild(editLink); Button removeLink = linkButtonFactory.Generate(LocalizedString.Get("remove")); removeLink.Click += (sender, e) => { currentCommandForLinkFunction.Delete(); windowController.functionToCallOnSave(this, null); windowController.ChangeToMacroList(); }; macroRow.AddChild(removeLink); presetsFormContainer.AddChild(macroRow); } Button addMacroButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); addMacroButton.Click += new ButtonBase.ButtonEventHandler(addMacro_Click); Button cancelPresetsButton = textImageButtonFactory.Generate(LocalizedString.Get("Close")); cancelPresetsButton.Click += (sender, e) => { UiThread.RunOnIdle((state) => { this.windowController.Close(); }); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(addMacroButton); buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); this.AnchorAll(); }
public MacroDetailWidget(EditMacrosWindow windowController) { this.windowController = windowController; if (this.windowController.ActiveMacro == null) { initMacro(); } linkButtonFactory.fontSize = 10; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); { string editMacroLabel = LocalizedString.Get("Edit Macro"); string editMacroLabelFull = string.Format("{0}:", editMacroLabel); TextWidget elementHeader = new TextWidget(editMacroLabelFull, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.Padding = new BorderDouble(3); presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } topToBottom.AddChild(presetsFormContainer); presetsFormContainer.AddChild(createMacroNameContainer()); presetsFormContainer.AddChild(createMacroCommandContainer()); Button addMacroButton = textImageButtonFactory.Generate(LocalizedString.Get("Save")); addMacroButton.Click += new EventHandler(saveMacro_Click); Button cancelPresetsButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel")); cancelPresetsButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { windowController.ChangeToMacroList(); }); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(addMacroButton); buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); this.AnchorAll(); }
public MacroListWidget(EditMacrosWindow windowController) { this.windowController = windowController; linkButtonFactory.fontSize = 10; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); { string macroPresetsLabel = LocalizedString.Get("Macro Presets"); string macroPresetsLabelFull = string.Format("{0}:", macroPresetsLabel); TextWidget elementHeader = new TextWidget(macroPresetsLabelFull, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.Padding = new BorderDouble(3); presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } topToBottom.AddChild(presetsFormContainer); foreach (CustomCommands currentCommand in MacroControlsWidget.GetMacros()) { FlowLayoutWidget macroRow = new FlowLayoutWidget(); macroRow.Margin = new BorderDouble(3, 0, 3, 3); macroRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.Padding = new BorderDouble(3); macroRow.BackgroundColor = RGBA_Bytes.White; TextWidget buttonLabel = new TextWidget(currentCommand.Name); macroRow.AddChild(buttonLabel); macroRow.AddChild(new HorizontalSpacer()); Button editLink = linkButtonFactory.Generate(LocalizedString.Get("edit")); editLink.Margin = new BorderDouble(right: 5); // You can't pass a foreach variable into a link function or it wall always be the last item. // So we make a local variable copy of it and pass that. This will get the right one. CustomCommands currentCommandForLinkFunction = currentCommand; editLink.Click += (sender, e) => { windowController.ChangeToMacroDetail(currentCommandForLinkFunction); }; macroRow.AddChild(editLink); Button removeLink = linkButtonFactory.Generate(LocalizedString.Get("remove")); removeLink.Click += (sender, e) => { currentCommandForLinkFunction.Delete(); windowController.functionToCallOnSave(this, null); windowController.ChangeToMacroList(); }; macroRow.AddChild(removeLink); presetsFormContainer.AddChild(macroRow); } Button addMacroButton = textImageButtonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png"); addMacroButton.ToolTipText = "Add a new Macro".Localize(); addMacroButton.Click += new EventHandler(addMacro_Click); Button cancelPresetsButton = textImageButtonFactory.Generate(LocalizedString.Get("Close")); cancelPresetsButton.Click += (sender, e) => { UiThread.RunOnIdle(() => { this.windowController.Close(); }); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(addMacroButton); buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); this.AnchorAll(); }
public MacroListWidget(EditMacrosWindow windowController) { this.windowController = windowController; linkButtonFactory.fontSize = 10; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); { string macroPresetsLabel = LocalizedString.Get("Macro Presets"); string macroPresetsLabelFull = string.Format("{0}:", macroPresetsLabel); TextWidget elementHeader = new TextWidget(macroPresetsLabelFull, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.Padding = new BorderDouble(3); presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } topToBottom.AddChild(presetsFormContainer); if (ActiveSliceSettings.Instance?.Macros != null) { foreach (GCodeMacro macro in ActiveSliceSettings.Instance.Macros) { FlowLayoutWidget macroRow = new FlowLayoutWidget(); macroRow.Margin = new BorderDouble(3, 0, 3, 3); macroRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.Padding = new BorderDouble(3); macroRow.BackgroundColor = RGBA_Bytes.White; TextWidget buttonLabel = new TextWidget(MacroControls.FixMacroName(macro.Name)); macroRow.AddChild(buttonLabel); macroRow.AddChild(new HorizontalSpacer()); // You can't pass a foreach variable into a link function or it wall always be the last item. // So we make a local variable copy of it and pass that. This will get the right one. var localMacroReference = macro; Button editLink = linkButtonFactory.Generate("edit".Localize()); editLink.Margin = new BorderDouble(right: 5); editLink.Click += (sender, e) => { windowController.ChangeToMacroDetail(localMacroReference); }; macroRow.AddChild(editLink); Button removeLink = linkButtonFactory.Generate("remove".Localize()); removeLink.Click += (sender, e) => { ActiveSliceSettings.Instance.Macros.Remove(localMacroReference); windowController.FunctionToCallOnSave(this, null); windowController.ChangeToMacroList(); }; macroRow.AddChild(removeLink); presetsFormContainer.AddChild(macroRow); } } Button addMacroButton = textImageButtonFactory.Generate("Add".Localize(), "icon_circle_plus.png"); addMacroButton.ToolTipText = "Add a new Macro".Localize(); addMacroButton.Click += (s, e) => { windowController.ChangeToMacroDetail(new GCodeMacro() { Name = "Home All", GCode = "G28 ; Home All Axes" }); }; Button cancelPresetsButton = textImageButtonFactory.Generate("Close".Localize()); cancelPresetsButton.Click += (sender, e) => { UiThread.RunOnIdle(() => this.windowController.Close()); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(addMacroButton); buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); this.AnchorAll(); }
public MacroListWidget(EditMacrosWindow windowController) { this.windowController = windowController; linkButtonFactory.fontSize = 10; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); { string macroPresetsLabel = new LocalizedString("Macro Presets").Translated; string macroPresetsLabelFull = string.Format("{0}:", macroPresetsLabel); TextWidget elementHeader = new TextWidget(macroPresetsLabelFull, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.Padding = new BorderDouble(3); presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } topToBottom.AddChild(presetsFormContainer); IEnumerable <DataStorage.CustomCommands> macroList = GetMacros(); int buttonCount = 0; foreach (DataStorage.CustomCommands m in macroList) { FlowLayoutWidget macroRow = new FlowLayoutWidget(); macroRow.Margin = new BorderDouble(3, 0, 3, 3); macroRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.Padding = new BorderDouble(3); macroRow.BackgroundColor = RGBA_Bytes.White; TextWidget buttonLabel = new TextWidget(m.Name); macroRow.AddChild(buttonLabel); FlowLayoutWidget hSpacer = new FlowLayoutWidget(); hSpacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.AddChild(hSpacer); Button editLink = linkButtonFactory.Generate(new LocalizedString("edit").Translated); editLink.Margin = new BorderDouble(right: 5); editLink.Click += (sender, e) => { windowController.ChangeToMacroDetail(m); }; macroRow.AddChild(editLink); Button removeLink = linkButtonFactory.Generate(new LocalizedString("remove").Translated); removeLink.Click += (sender, e) => { m.Delete(); windowController.functionToCallOnSave(this, null); windowController.ChangeToMacroList(); }; macroRow.AddChild(removeLink); presetsFormContainer.AddChild(macroRow); } Button addMacroButton = textImageButtonFactory.Generate(new LocalizedString("Add").Translated, "icon_circle_plus.png"); addMacroButton.Click += new ButtonBase.ButtonEventHandler(addMacro_Click); Button cancelPresetsButton = textImageButtonFactory.Generate(new LocalizedString("Close").Translated); cancelPresetsButton.Click += (sender, e) => { this.windowController.Close(); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(addMacroButton); buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); this.AnchorAll(); }
public MacroListWidget(EditMacrosWindow windowController) { this.windowController = windowController; linkButtonFactory.fontSize = 10; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); { string macroPresetsLabel = new LocalizedString("Macro Presets").Translated; string macroPresetsLabelFull = string.Format("{0}:", macroPresetsLabel); TextWidget elementHeader = new TextWidget(macroPresetsLabelFull, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); } topToBottom.AddChild(headerRow); FlowLayoutWidget presetsFormContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { presetsFormContainer.HAnchor = HAnchor.ParentLeftRight; presetsFormContainer.VAnchor = VAnchor.ParentBottomTop; presetsFormContainer.Padding = new BorderDouble(3); presetsFormContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } topToBottom.AddChild(presetsFormContainer); IEnumerable<DataStorage.CustomCommands> macroList = GetMacros(); int buttonCount = 0; foreach (DataStorage.CustomCommands m in macroList) { FlowLayoutWidget macroRow = new FlowLayoutWidget(); macroRow.Margin = new BorderDouble(3, 0, 3, 3); macroRow.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.Padding = new BorderDouble(3); macroRow.BackgroundColor = RGBA_Bytes.White; TextWidget buttonLabel = new TextWidget(m.Name); macroRow.AddChild(buttonLabel); FlowLayoutWidget hSpacer = new FlowLayoutWidget(); hSpacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; macroRow.AddChild(hSpacer); Button editLink = linkButtonFactory.Generate(new LocalizedString("edit").Translated); editLink.Margin = new BorderDouble(right: 5); editLink.Click += (sender, e) => { windowController.ChangeToMacroDetail(m); }; macroRow.AddChild(editLink); Button removeLink = linkButtonFactory.Generate(new LocalizedString("remove").Translated); removeLink.Click += (sender, e) => { m.Delete(); windowController.functionToCallOnSave(this, null); windowController.ChangeToMacroList(); }; macroRow.AddChild(removeLink); presetsFormContainer.AddChild(macroRow); } Button addMacroButton = textImageButtonFactory.Generate(new LocalizedString("Add").Translated, "icon_circle_plus.png"); addMacroButton.Click += new ButtonBase.ButtonEventHandler(addMacro_Click); Button cancelPresetsButton = textImageButtonFactory.Generate(new LocalizedString("Close").Translated); cancelPresetsButton.Click += (sender, e) => { UiThread.RunOnIdle((state) => { this.windowController.Close(); }); }; FlowLayoutWidget buttonRow = new FlowLayoutWidget(); buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); GuiWidget hButtonSpacer = new GuiWidget(); hButtonSpacer.HAnchor = HAnchor.ParentLeftRight; buttonRow.AddChild(addMacroButton); buttonRow.AddChild(hButtonSpacer); buttonRow.AddChild(cancelPresetsButton); topToBottom.AddChild(buttonRow); AddChild(topToBottom); this.AnchorAll(); }