private void ColorWheelChangedHandler(Color newColor, int id) { SettingsDelta Delta = new SettingsDelta(); Delta.changes[SettingValue.REDBIAS] = Convert.ToInt16(control.R - newColor.R); Delta.changes[SettingValue.GREENBIAS] = Convert.ToInt16(control.G - newColor.G); Delta.changes[SettingValue.BLUEBIAS] = Convert.ToInt16(control.B - newColor.B); settingsManager.getSettings(id).ApplyChanges(Delta); }
private void UpdatePollingSelection(int id, int x, int y, int width, int height) { SettingsDelta Delta = new SettingsDelta(); Delta.changes[SettingValue.X] = x; Delta.changes[SettingValue.Y] = y; Delta.changes[SettingValue.WIDTH] = width; Delta.changes[SettingValue.HEIGHT] = height; settingsManager.getSettings(id).ApplyChanges(Delta); settingsManager.UpdateBoundingBox(); }
public void brightnessValueChanged(object sender, EventArgs args) { if(sender is double) { double value = (double)sender; SettingsDelta Delta = new SettingsDelta(); Delta.changes[SettingValue.MAXBRIGHTNESS] = value; for(int i = 0; i < connectionManager.GlowsFound; i += 1) { settingsManager.getSettings(i).ApplyChanges(Delta); } } }
/// <summary> /// Update the bounding box which contains all device's mirroring zones /// </summary> public void UpdateBoundingBox() { int minTop = int.MaxValue, maxBot = int.MinValue, minLeft = int.MaxValue, maxRight = int.MinValue; foreach(int id in Settings.Keys) { DeviceSettings settings = Settings[id]; int left = settings.x; int right = settings.width + left; int top = settings.y; int bot = top + settings.height; minTop = minTop < top ? minTop : top; maxBot = maxBot > bot ? maxBot : bot; minLeft = minLeft < left ? minLeft : left; maxRight = maxRight > right ? maxRight : right; } boundX = minLeft; boundY = minTop; boundWidth = maxRight - minLeft; boundHeight = maxBot - minTop; SettingsDelta Delta = new SettingsDelta(); Delta.changes[SettingValue.BOUNDX] = boundX; Delta.changes[SettingValue.BOUNDY] = boundY; Delta.changes[SettingValue.BOUNDWIDTH] = boundWidth; Delta.changes[SettingValue.BOUNDHEIGHT] = boundHeight; Log("New bounding box calculated.\n" + Delta.ToString()); foreach(int id in Settings.Keys) { Settings[id].ApplyChanges(Delta); } }
public void ApplyChanges(SettingsDelta delta) { Log(delta.changes.Count + " settings updated.\t" + delta.ToString()); foreach(SettingValue variable in delta.changes.Keys) { switch(variable) { case SettingValue.BLUEBIAS: blueBias = (Int16)delta.changes[SettingValue.BLUEBIAS]; break; case SettingValue.BOUNDHEIGHT: boundHeight = (int)delta.changes[SettingValue.BOUNDHEIGHT]; break; case SettingValue.BOUNDWIDTH: boundWidth = (int)delta.changes[SettingValue.BOUNDWIDTH]; break; case SettingValue.BOUNDX: boundX = (int)delta.changes[SettingValue.BOUNDX]; break; case SettingValue.BOUNDY: boundY = (int)delta.changes[SettingValue.BOUNDY]; break; case SettingValue.CAPTURETHROTTLE: captureThrottle = (int)delta.changes[SettingValue.CAPTURETHROTTLE]; break; case SettingValue.GREENBIAS: greenBias = (Int16)delta.changes[SettingValue.GREENBIAS]; break; case SettingValue.HEIGHT: height = (int)delta.changes[SettingValue.HEIGHT]; break; case SettingValue.MAXBRIGHTNESS: maxBrightness = (double)delta.changes[SettingValue.MAXBRIGHTNESS]; break; case SettingValue.NEWCOLORWEIGHT: newColorWeight = (double)delta.changes[SettingValue.NEWCOLORWEIGHT]; break; case SettingValue.REDBIAS: redBias = (Int16)delta.changes[SettingValue.REDBIAS]; break; case SettingValue.STEPSLEEP: stepSleep = (int)delta.changes[SettingValue.STEPSLEEP]; break; case SettingValue.WEIGHTINGENABLED: weightingEnabled = (bool)delta.changes[SettingValue.WEIGHTINGENABLED]; break; case SettingValue.WIDTH: width = (int)delta.changes[SettingValue.WIDTH]; break; case SettingValue.X: x = (int)delta.changes[SettingValue.X]; break; case SettingValue.Y: y = (int)delta.changes[SettingValue.Y]; break; default: Log("Unknown SettingValue " + variable); break; } } Save(); Notify(); }