mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-09 18:12:32 +02:00
8e85fe2995
Mostly text updates, with a few adjustments to dialog box layouts or controls. Presets for Threshold, for example, where changed from buttons to a combobox selections. Allowed the line splits added by Designer to remain, but did fix any mid-word breaks.
91 lines
2.9 KiB
C#
91 lines
2.9 KiB
C#
/*
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE
|
|
* Version 3, 19 November 2007
|
|
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
* of this license document, but changing it is not allowed.
|
|
*/
|
|
|
|
using System;
|
|
using Emgu.CV.CvEnum;
|
|
using UVtools.Core;
|
|
using UVtools.Core.Operations;
|
|
|
|
namespace UVtools.GUI.Controls.Tools
|
|
{
|
|
public partial class CtrlToolThreshold : CtrlToolWindowContent
|
|
{
|
|
public OperationThreshold Operation { get; }
|
|
|
|
public CtrlToolThreshold()
|
|
{
|
|
InitializeComponent();
|
|
Operation = new OperationThreshold();
|
|
SetOperation(Operation);
|
|
|
|
var directions = Enum.GetValues(typeof(Enumerations.FlipDirection));
|
|
|
|
cbThresholdType.BeginUpdate();
|
|
foreach (var thresholdType in (ThresholdType[])Enum.GetValues(typeof(ThresholdType)))
|
|
{
|
|
cbThresholdType.Items.Add(thresholdType);
|
|
}
|
|
cbThresholdType.EndUpdate();
|
|
|
|
cbThresholdType.SelectedItem = ThresholdType.Binary;
|
|
|
|
cbPresetHelpers.SelectedItem = "Free use";
|
|
}
|
|
|
|
public override bool UpdateOperation()
|
|
{
|
|
base.UpdateOperation();
|
|
Operation.Threshold = (byte) nmThreshold.Value;
|
|
Operation.Maximum = (byte) nmMaximum.Value;
|
|
Operation.Type = (ThresholdType)cbThresholdType.SelectedItem;
|
|
return true;
|
|
}
|
|
|
|
private void cbPresetHelpers_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (cbPresetHelpers.SelectedItem.ToString() == "Free use")
|
|
{
|
|
nmThreshold.Enabled =
|
|
nmMaximum.Enabled =
|
|
cbThresholdType.Enabled = true;
|
|
return;
|
|
}
|
|
|
|
if (cbPresetHelpers.SelectedItem.ToString() == "Strip AntiAliasing")
|
|
{
|
|
nmThreshold.Enabled =
|
|
nmMaximum.Enabled =
|
|
cbThresholdType.Enabled = true;
|
|
|
|
nmMaximum.Enabled = cbThresholdType.Enabled = false;
|
|
|
|
nmThreshold.Value = 127;
|
|
nmMaximum.Value = 255;
|
|
cbThresholdType.SelectedItem = ThresholdType.Binary;
|
|
nmThreshold.Focus();
|
|
return;
|
|
}
|
|
|
|
if (cbPresetHelpers.SelectedItem.ToString() == "Set pixel brightness")
|
|
{
|
|
nmThreshold.Enabled =
|
|
nmMaximum.Enabled =
|
|
cbThresholdType.Enabled = true;
|
|
|
|
nmThreshold.Enabled = cbThresholdType.Enabled = false;
|
|
|
|
nmThreshold.Value = 254;
|
|
nmMaximum.Value = 254;
|
|
cbThresholdType.SelectedItem = ThresholdType.Binary;
|
|
nmMaximum.Focus();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|