/* * GNU AFFERO GENERAL PUBLIC LICENSE * Version 3, 19 November 2007 * Copyright (C) 2007 Free Software Foundation, Inc. * Everyone is permitted to copy and distribute verbatim copies * of this license document, but changing it is not allowed. */ using System; using System.Windows.Forms; using UVtools.Core.Extensions; using UVtools.Core.Operations; namespace UVtools.GUI.Controls.Tools { public partial class CtrlToolLayerReHeight : CtrlToolWindowContent { public OperationLayerReHeight Operation { get; } public OperationLayerReHeight.OperationLayerReHeightItem[] Presets { get; } = OperationLayerReHeight.GetItems( Program.SlicerFile.LayerCount, (decimal) Program.SlicerFile.LayerHeight); public CtrlToolLayerReHeight() { InitializeComponent(); Operation = new OperationLayerReHeight(); SetOperation(Operation); lbCurrent.Text = $"Current layers: {Program.SlicerFile.LayerCount} at {Program.SlicerFile.LayerHeight}mm"; if (Presets.Length > 0) { cbMultiplier.Items.AddRange(Presets); cbMultiplier.SelectedIndex = 0; } else { GUIExtensions.MessageBoxInformation("Not possible to re-height", "No valid configuration to be able to re-height, closing this tool now."); CanRun = false; } } private void EventValueChanged(object sender, EventArgs e) { ButtonOkEnabled = cbMultiplier.SelectedIndex >= 0; } public override bool UpdateOperation() { base.UpdateOperation(); Operation.Item = (OperationLayerReHeight.OperationLayerReHeightItem)cbMultiplier.SelectedItem; return true; } } }