public PerturbedErrorFilterDialog( PerturbedErrorFilter existingModule) : base(existingModule) { module = modifiedModule as PerturbedErrorFilter; if (module == null) { modifiedModule = new PerturbedErrorFilter(); module = modifiedModule as PerturbedErrorFilter; } childFilterSelector = new SubmoduleSelector<MatrixErrorFilter>( module.ChildFilter); childFilterSelector.ModuleChanged += delegate { module.ChildFilter = childFilterSelector.Module; }; perturbationAmplitudeHScale = new HScale(0.0, 1.0, 0.01); perturbationAmplitudeHScale.Value = module.PerturbationAmplitude; perturbationAmplitudeHScale.ValueChanged += delegate { module.PerturbationAmplitude = perturbationAmplitudeHScale.Value; }; table = new Table(2, 2, false) { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 }; table.Attach(new Label("Child filter:") { Xalign = 0.0f}, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(childFilterSelector, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); table.Attach(new Label("Perturbation amplitude:") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(perturbationAmplitudeHScale, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); table.ShowAll(); VBox.PackStart(table); }
/// <summary> /// Create a new halftone algorithm configuration panel using an /// existing halftone algorithm. /// </summary> /// <param name="existingModule"></param> public HalftoneAlgorithmPanel(HalftoneAlgorithm existingModule) { BorderWidth = 3; VBox preProcessingVBox = new VBox(); Frame preResizeFrame = new Frame("Resize") { BorderWidth = 3 }; Frame preDotGainFrame = new Frame("Dot gain correction") { BorderWidth = 3 }; Frame preSharpenFrame = new Frame("Sharpen") { BorderWidth = 3 }; Frame halftoneMethodFrame = new Frame("Halftone method") { BorderWidth = 3 }; VBox postProcessingVBox = new VBox(); Frame postResizeFrame = new Frame("Resize") { BorderWidth = 3 }; Frame postSmoothenFrame = new Frame("Smoothen") { BorderWidth = 3 }; // -------- pre-processing -------- // ---- resize ---- preResizePanel = new ResizePanel(); preResizePanel.ModuleChanged += delegate { Module.PreResize = preResizePanel.Module; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; preResizeFrame.Add(preResizePanel); preProcessingVBox.PackStart(preResizeFrame); // ---- dot gain ---- preDotGainEnabledCheckButton = new CheckButton("Enabled"); preDotGainEnabledCheckButton.Toggled += delegate { bool enabled = preDotGainEnabledCheckButton.Active; if (!enabled) { Module.PreDotGain = null; } else if (Module.PreDotGain == null) { Module.PreDotGain = new HalftoneAlgorithm.GammaCorrection(); } if (Module.PreDotGain != null) { preDotGainGammaSpinButton.Value = ((HalftoneAlgorithm.GammaCorrection) Module.PreDotGain).Gamma; } preDotGainGammaSpinButton.Sensitive = enabled; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; preDotGainGammaSpinButton = new SpinButton(0.1, 10, 0.1); preDotGainGammaSpinButton.Changed += delegate { ((HalftoneAlgorithm.GammaCorrection)Module.PreDotGain).Gamma = preDotGainGammaSpinButton.Value; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; Table preDotGainTable = new Table(2, 2, false) { ColumnSpacing = 3, RowSpacing = 3, BorderWidth = 5 }; preDotGainTable.Attach(preDotGainEnabledCheckButton, 0, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); preDotGainTable.Attach(new Label("Gamma:") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); preDotGainTable.Attach(preDotGainGammaSpinButton, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); preDotGainFrame.Add(preDotGainTable); preProcessingVBox.PackStart(preDotGainFrame); // ---- sharpen ---- preSharpenEnabledCheckButton = new CheckButton("Enabled"); preSharpenEnabledCheckButton.Toggled += delegate { bool enabled = preSharpenEnabledCheckButton.Active; if (!enabled) { Module.PreSharpen = null; } else if (Module.PreSharpen == null) { Module.PreSharpen = new HalftoneAlgorithm.Sharpen(); } if (Module.PreSharpen != null) { preSharpenAmountHScale.Value = Module.PreSharpen.Amount; } preSharpenAmountHScale.Sensitive = enabled; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; preSharpenAmountHScale = new HScale(0, 1, 0.01); preSharpenAmountHScale.ChangeValue += delegate { Module.PreSharpen.Amount = preSharpenAmountHScale.Value; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; Table preSharpenTable = new Table(2, 2, false) { ColumnSpacing = 3, RowSpacing = 3, BorderWidth = 5 }; preSharpenTable.Attach(preSharpenEnabledCheckButton, 0, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); preSharpenTable.Attach(new Label("Amount:") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); preSharpenTable.Attach(preSharpenAmountHScale, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); preSharpenFrame.Add(preSharpenTable); preProcessingVBox.PackStart(preSharpenFrame); AppendPage(preProcessingVBox, new Label("Pre-processing")); // -------- halftone method -------- halftoneMethodSelector = new SubmoduleSelector<HalftoneMethod>(HalftoneMethod.createDefault()) { BorderWidth = 5 }; halftoneMethodSelector.ModuleChanged += delegate { if (Module != null) { Module.Method = halftoneMethodSelector.Module; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } } }; halftoneMethodFrame.Add(halftoneMethodSelector); AppendPage(halftoneMethodFrame, new Label("Halftone method")); // -------- post-processing -------- // ---- resize ---- postResizePanel = new ResizePanel(); postResizePanel.ModuleChanged += delegate { Module.PostResize = postResizePanel.Module; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; supersamplingCheckButton = new CheckButton("Supersampling"); supersamplingCheckButton.Toggled += delegate { Module.SupersamplingEnabled = supersamplingCheckButton.Active; postResizePanel.Sensitive = !supersamplingCheckButton.Active; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; Table postResizeTable = new Table(2, 1, false); postResizeTable.Attach(supersamplingCheckButton, 0, 1, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); postResizeTable.Attach(postResizePanel, 0, 1, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 0, 0); postResizeFrame.Add(postResizeTable); postProcessingVBox.PackStart(postResizeFrame); // ---- smoothen ---- postSmoothenEnabledCheckButton = new CheckButton("Enabled"); postSmoothenEnabledCheckButton.Toggled += delegate { bool enabled = postSmoothenEnabledCheckButton.Active; if (!enabled) { Module.PostSmoothen = null; } else if (Module.PostSmoothen == null) { Module.PostSmoothen = new HalftoneAlgorithm.Smoothen(); } if (Module.PostSmoothen != null) { postSmoothenRadiusSpinButton.Value = Module.PostSmoothen.Radius; } postSmoothenRadiusSpinButton.Sensitive = enabled; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; postSmoothenRadiusSpinButton = new SpinButton(1, 20, 0.5); postSmoothenRadiusSpinButton.Changed += delegate { Module.PostSmoothen.Radius = postSmoothenRadiusSpinButton.Value; if (ModuleChanged != null) { ModuleChanged(this, new EventArgs()); } }; Table postSmoothenTable = new Table(2, 2, false) { ColumnSpacing = 3, RowSpacing = 3, BorderWidth = 5 }; postSmoothenTable.Attach(postSmoothenEnabledCheckButton, 0, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); postSmoothenTable.Attach(new Label("Radius:") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); postSmoothenTable.Attach(postSmoothenRadiusSpinButton, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); postSmoothenFrame.Add(postSmoothenTable); postProcessingVBox.PackStart(postSmoothenFrame); AppendPage(postProcessingVBox, new Label("Post-processing")); Module = existingModule; ShowAll(); Page = 1; }
public ThresholdHalftoneMethodDialog( ThresholdHalftoneMethod existingModule) : base(existingModule) { module = modifiedModule as ThresholdHalftoneMethod; if (module == null) { modifiedModule = new ThresholdHalftoneMethod(); module = modifiedModule as ThresholdHalftoneMethod; } thresholdFilterSelector = new SubmoduleSelector<ThresholdFilter>( module.ThresholdFilter); thresholdFilterSelector.ModuleChanged += delegate { module.ThresholdFilter = thresholdFilterSelector.Module; }; errorFilterSelector = new SubmoduleSelector<ErrorFilter>( module.ErrorFilter) { AllowNull = true }; errorFilterSelector.ModuleChanged += delegate { module.ErrorFilter = errorFilterSelector.Module; useErrorFilterCheckButton.Active = module.UseErrorFilter; useErrorFilterCheckButton.Sensitive = errorFilterSelector.Module != null; }; useErrorFilterCheckButton = new CheckButton( "Use error filter?"); useErrorFilterCheckButton.Active = module.UseErrorFilter; useErrorFilterCheckButton.Sensitive = errorFilterSelector.Module != null; useErrorFilterCheckButton.Toggled += delegate { module.UseErrorFilter = useErrorFilterCheckButton.Active; }; scanningOrderSelector = new SubmoduleSelector<ScanningOrder>( module.ScanningOrder); scanningOrderSelector.ModuleChanged += delegate { module.ScanningOrder = scanningOrderSelector.Module; }; table = new Table(3, 2, false) { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 }; table.Attach(new Label("Threshold filter:") { Xalign = 0.0f}, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(thresholdFilterSelector, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); table.Attach(new Label("Error filter:") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(errorFilterSelector, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); table.Attach(useErrorFilterCheckButton, 0, 2, 2, 3, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); table.Attach(new Label("Scanning order:") { Xalign = 0.0f }, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(scanningOrderSelector, 1, 2, 3, 4, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); table.ShowAll(); VBox.PackStart(table); }
public SFCClusteringMethodDialog( SFCClusteringMethod existingModule) : base(existingModule) { module = modifiedModule as SFCClusteringMethod; if (module == null) { modifiedModule = new SFCClusteringMethod(); module = modifiedModule as SFCClusteringMethod; } errorFilterSelector = new SubmoduleSelector<VectorErrorFilter>( module.ErrorFilter); errorFilterSelector.ModuleChanged += delegate { useErrorFilterCheckButton.Active = errorFilterSelector.Module != null; useErrorFilterCheckButton.Sensitive = errorFilterSelector.Module != null; }; useErrorFilterCheckButton = new CheckButton("Use error filter?"); useErrorFilterCheckButton.Active = module.UseErrorFilter; scanningOrderSelector = new SubmoduleSelector<SFCScanningOrder>( module.ScanningOrder); maxCellSizeSpinButton = new SpinButton(1, 100, 1); maxCellSizeSpinButton.Value = module.MaxCellSize; minCellSizeSpinButton = new SpinButton(1, 99, 1); minCellSizeSpinButton.Value = module.MinCellSize; clusterPositioningCheckButton = new CheckButton("Use cluster positioning?"); clusterPositioningCheckButton.Active = module.UseClusterPositioning; adaptiveClusteringCheckButton = new CheckButton("Use adaptive clustering?"); adaptiveClusteringCheckButton.Toggled += delegate { minCellSizeSpinButton.Sensitive = adaptiveClusteringCheckButton.Active; }; adaptiveClusteringCheckButton.Active = module.UseAdaptiveClustering; table = new Table(7, 2, false) { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 }; table.Attach(new Label("Scanning order:") { Xalign = 0.0f }, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(scanningOrderSelector, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(new Label("Maximum cell size:") { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(maxCellSizeSpinButton, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(new Label("Minimum cell size:") { Xalign = 0.0f }, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(minCellSizeSpinButton, 1, 2, 2, 3, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(adaptiveClusteringCheckButton, 0, 2, 4, 5, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); table.Attach(clusterPositioningCheckButton, 0, 2, 5, 6, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); table.Attach(new Label("Error filter:") { Xalign = 0.0f }, 0, 1, 6, 7, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(errorFilterSelector, 1, 2, 6, 7, AttachOptions.Fill, AttachOptions.Shrink, 0, 0); table.Attach(useErrorFilterCheckButton, 0, 2, 7, 8, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0); table.ShowAll(); VBox.PackStart(table); }