// Show gradient (enable/disable controls) public void ShowGradientPoint(SelectInformation selectInformation, bool updateListBoxSelection, bool refillListBox = false) { if (refillListBox) { updatingPoint = true; PointGridHandler.RefillGridPoints(grdPoints, getCurrentGradient()); updatingPoint = false; } if (refillListBox || updateListBoxSelection) { updatingPoint = true; grdPoints.ClearSelection(); PointGridHandler.SelectGridCellsFromSelection(grdPoints, selectInformation); grdPoints.Refresh(); updatingPoint = false; } if (selectInformation.Keys.Length == 0) { UpdatePictureGraphics(); NoPointInputs(); return; } AllowPointInputs(); FillGradientPointControls(selectInformation); UpdatePictureGraphics(); }
private void tbrPosition_Scroll(object sender, EventArgs e) { if (updatingPoint) { return; } TrackBar trackBar = (TrackBar)sender; float position = trackBar.Value / 1000.0f; position = Utils.LimitFloatZeroToOne(position); foreach (Data.Key key in selection.Keys) // Anchors will be updated in recalc { key.Position.X = position; } getCurrentGradient().SortPoints(); updatingPoint = true; txtPosition.Text = position.ToString("0.000"); PointGridHandler.RefillGridPoints(grdPoints, getCurrentGradient()); grdPoints.ClearSelection(); PointGridHandler.SelectGridCellsFromSelection(grdPoints, this.selection); grdPoints.Refresh(); graphViewHandler.RefreshPicture(); updatingPoint = false; }
private void txtPosition_TextChanged(object sender, EventArgs e) { if (updatingPoint) { return; } TextBox textBox = (TextBox)sender; float position = Utils.LimitTextZeroToOne(textBox.Text); foreach (Data.Key key in selection.Keys) // Anchors will be updated in recalc { key.Position.X = position; } getCurrentGradient().SortPoints(); updatingPoint = true; tbrPosition.Value = (int)(position * 1000); PointGridHandler.RefillGridPoints(grdPoints, getCurrentGradient()); grdPoints.ClearSelection(); PointGridHandler.SelectGridCellsFromSelection(grdPoints, selection); graphViewHandler.RefreshPicture(); updatingPoint = false; }
// Control events private void grdPoints_SelectionChanged(object sender, EventArgs e) { if (updatingPoint) { return; } if (selectingCell) { return; } PointGridHandler.SelectInformationFromCells(grdPoints, selection); ShowGradientPoint(selection, false); graphViewHandler.RefreshPicture(); }
// Show gradient (move values into controls) private void FillGradientControls(Data.Gradient gradient) { if (gradient == null) { return; } // textbox txtName.Text = gradient.name; // Fill PointGrid updatingPoint = true; PointGridHandler.RefillGridPoints(grdPoints, gradient); PointGridHandler.SelectfirstGridRowsCells(grdPoints); PointGridHandler.SelectInformationFromCells(grdPoints, selection); updatingPoint = false; ShowGradientPoint(selection, false); }