public void Apply() { ApplySettings.Clicks(); WaitforIt(Properties.LittlePause); SaveDashboard.Clicks(); }
// called when the Plugin is deselected OR when Liv is being closed down. public void OnDeactivate() { PluginLog.Log("ActionCameraPlugin", "OnDeactivate "); ApplySettings?.Invoke(this, EventArgs.Empty); avatarRefSignal?.OnChanged.RemoveListener(OnAvatarChanged); avatarRefSignal = null; }
private void btnSave_Click(object sender, EventArgs e) { if (!trw.IsAllFieldSet()) { MessageBox.Show("One of the required field is empty", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } int.TryParse(txPort.Text, out var port); var sd = new ServerDetails { GroupID = GlobalHelper.dbGroups.GetIDByGroupName(ddGroup.Text), ServerName = txServername.Text, Server = txComputer.Text, Port = port, Username = txUsername.Text, Password = new Password(txPassword.Text, false), Description = txDescription.Text, ColorDepth = (int)lblColorDepth.Tag, DesktopWidth = int.Parse(txWidth.Text), DesktopHeight = int.Parse(txHeight.Text), Fullscreen = cbFullscreen.Checked }; if (isUpdating) { // pass our old UID to new UID for saving sd.Id = oldSD.Id; GlobalHelper.dbServers.Save(sd); // new settings changed // pass new settings on our oldSD oldSD = sd; DialogResult dr = MessageBox.Show("Conection settings successfully updated.\r\nDo you want to apply your current changes.", Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { ApplySettings?.Invoke(sender, oldSD); } } else { GlobalHelper.dbServers.Save(sd); MessageBox.Show("New conenction settings successfully saved", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } }
private void RestoreConfSettings_Click(object sender, EventArgs e) { DialogResult RES = Program.ShowError(3, "Reset configurator's internal settings", "Are you sure you want to reset the configurator's internal settings?\n\nYou'll lose all your custom settings, like the position of the window, the size of the columns in the SoundFonts editor etc...", null); if (RES == DialogResult.Yes) { String BeforeBranch = Properties.Settings.Default.UpdateBranch; Properties.Settings.Default.Reset(); Properties.Settings.Default.UpdateBranch = BeforeBranch; Properties.Settings.Default.Save(); new SelectBranch().ShowDialog(); CreateSFLEEmbed(null); CreateSETEmbed(); ApplySettings.PerformClick(); } }
public SettingsForm(Settings settings, ApplySettings applySettingsCallBack = null) { InitializeComponent(); LoadSettings(settings); this.ApplySettingsCallBack = applySettingsCallBack; }
///<summary>Applies the document specified cropping, flip, rotation, brightness and contrast transformations to the image and returns the resulting image. Zoom and translation must be handled by the calling code. The returned image is always a new image that can be modified without affecting the original image. The change in the image's center point is returned into deltaCenter, so that rotation offsets can be properly calculated when displaying the returned image.</summary> public static Bitmap ApplyDocumentSettingsToImage(Document doc, Bitmap image, ApplySettings settings) { if (image == null) //Any operation on a non-existant image produces a non-existant image. { return(null); } if (doc == null) //No doc implies no operations, implies that the image should be returned unaltered. { return((Bitmap)image.Clone()); } //CROP - Implies that the croping rectangle must be saved in raw-image-space coordinates, //with an origin of that equal to the upper left hand portion of the image. Rectangle cropResult; if ((settings & ApplySettings.CROP) != 0 && //Crop not requested. doc.CropW > 0 && doc.CropH > 0) //No clip area yet defined, so no clipping is performed. { float[] cropDims = ODMathLib.IntersectRectangles(0, 0, image.Width, image.Height, //Intersect image rectangle with doc.CropX, doc.CropY, doc.CropW, doc.CropH); //document crop rectangle. if (cropDims.Length == 0) //The entire image has been cropped away. { return(null); } //Rounds dims up, so that data is not lost, but possibly not removing all of what was expected. cropResult = new Rectangle((int)cropDims[0], (int)cropDims[1], (int)Math.Ceiling(cropDims[2]), (int)Math.Ceiling(cropDims[3])); } else { cropResult = new Rectangle(0, 0, image.Width, image.Height); //No cropping. } //Always use 32-bit images in memory. We could use 24-bit images here (it works in Windows, but MONO produces //output using 32-bit data on a 24-bit image in that case, providing horrible output). Perhaps we can update //this when MONO is more fully featured. Bitmap cropped = new Bitmap(cropResult.Width, cropResult.Height, PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(cropped); Rectangle croppedDims = new Rectangle(0, 0, cropped.Width, cropped.Height); g.DrawImage(image, croppedDims, cropResult, GraphicsUnit.Pixel); g.Dispose(); //FLIP AND ROTATE - must match the operations in GetDocumentFlippedRotatedMatrix(). if ((settings & ApplySettings.FLIP) != 0) { if (doc.IsFlipped) { cropped.RotateFlip(RotateFlipType.RotateNoneFlipX); } } if ((settings & ApplySettings.ROTATE) != 0) { if (doc.DegreesRotated % 360 == 90) { cropped.RotateFlip(RotateFlipType.Rotate90FlipNone); } else if (doc.DegreesRotated % 360 == 180) { cropped.RotateFlip(RotateFlipType.Rotate180FlipNone); } else if (doc.DegreesRotated % 360 == 270) { cropped.RotateFlip(RotateFlipType.Rotate270FlipNone); } } //APPLY BRIGHTNESS AND CONTRAST - //TODO: should be updated later for more general functions //(create inputValues and outputValues from stored db function/table). if ((settings & ApplySettings.COLORFUNCTION) != 0 && doc.WindowingMax != 0 && //Do not apply color function if brightness/contrast have never been set (assume normal settings). !(doc.WindowingMax == 255 && doc.WindowingMin == 0)) //Don't apply if brightness/contrast settings are normal. { float[] inputValues = new float[] { doc.WindowingMin / 255f, doc.WindowingMax / 255f, }; float[] outputValues = new float[] { 0, 1, }; BitmapData croppedData = null; try { croppedData = cropped.LockBits(new Rectangle(0, 0, cropped.Width, cropped.Height), ImageLockMode.ReadWrite, cropped.PixelFormat); unsafe { byte *pBits; if (croppedData.Stride < 0) { pBits = (byte *)croppedData.Scan0.ToPointer() + croppedData.Stride * (croppedData.Height - 1); } else { pBits = (byte *)croppedData.Scan0.ToPointer(); } //The following loop goes through each byte of each 32-bit value and applies the color function to it. //Thus, the same transformation is performed to all 4 color components equivalently for each pixel. for (int i = 0; i < croppedData.Stride * croppedData.Height; i++) { float colorComponent = pBits[i] / 255f; float rangedOutput; if (colorComponent <= inputValues[0]) { rangedOutput = outputValues[0]; } else if (colorComponent >= inputValues[inputValues.Length - 1]) { rangedOutput = outputValues[outputValues.Length - 1]; } else { int j = 0; while (!(inputValues[j] <= colorComponent && colorComponent < inputValues[j + 1])) { j++; } rangedOutput = ((colorComponent - inputValues[j]) * (outputValues[j + 1] - outputValues[j])) / (inputValues[j + 1] - inputValues[j]); } pBits[i] = (byte)Math.Round(255 * rangedOutput); } } } catch { } finally { try { cropped.UnlockBits(croppedData); } catch { } } } return(cropped); }
// OnDeactivate is called when the user changes the profile to other camera behaviour or when the application is about to close. // The camera behaviour should clean everything it created when the behaviour is deactivated. public void OnDeactivate() { ApplySettings?.Invoke(this, EventArgs.Empty); }
void setSettings() { int[] resol = ResolutionComboBox.SelectedValue as int[]; ApplySettings?.Invoke(resol[0], resol[1], (int)FPSComboBox.SelectedValue, (int)AnitialisingComboBox.SelectedValue, VSyncCheckBox.Checked, Convert.ToInt32(MaxItemCountNumeric.Value)); }
private void applySettings_Click(object sender, EventArgs e) { ApplySettings?.Invoke(); }