Ejemplo n.º 1
0
    protected void OnBrScaleValueChanged(object sender, EventArgs e)
    {
        try
        {
            if (BrightnessCalculated)
            {
                BrScaleEntry.Text = BrScale.Value.ToString("N2");

                double   oldBr  = AllFiles[0].AltBrightness;
                double[] change = new double[AllFiles.Count];

                for (int i = 1; i < AllFiles.Count; i++)
                {
                    change[i] = (AllFiles[i].Brightness - AllFiles[i - 1].Brightness) * BrScale.Value / 100;
                }

                for (int i = 1; i < AllFiles.Count; i++)
                {
                    if (change[i] >= 0)
                    {
                        AllFiles[i].AltBrightness = AllFiles[i - 1].AltBrightness + change[i];
                    }
                }

                double min = AllFiles.Min(p => p.AltBrightness);
                if (min <= 0)
                {
                    for (int i = 0; i < AllFiles.Count; i++)
                    {
                        AllFiles[i].AltBrightness += min + 5;
                    }
                }

                double BrCh = AllFiles[0].AltBrightness - oldBr;

                List <double> tmpbr = new List <double>();
                for (int i = 0; i < AllFiles.Count; i++)
                {
                    tmpbr.Add(AllFiles[i].AltBrightness);
                }
                AllCurves.UpdateBrCurve(tmpbr, BrCh, 0);
                RefreshGraph(true);
                UpdateTable();
            }
        }
        catch (Exception ex) { ReportError("Brightness Slider", ex); }
    }
Ejemplo n.º 2
0
    protected void CellEdited(object o, EditedArgs args)
    {
        try
        {
            if (BrightnessCalculated)
            {
                double val;
                try { val = Convert.ToDouble(args.NewText); }
                catch { return; }

                TreeIter iter;
                table.GetIter(out iter, new TreePath(args.Path));
                int index = table.GetPath(iter).Indices[0];

                double change = val - AllFiles[index].AltBrightness;
                AllFiles[index].AltBrightness = val;

                for (int i = index + 1; i < AllFiles.Count; i++)
                {
                    AllFiles[i].AltBrightness += change;
                }

                double min = AllFiles.Min(p => p.AltBrightness);
                if (min < 0)
                {
                    for (int i = 0; i < AllFiles.Count; i++)
                    {
                        AllFiles[i].AltBrightness += min + 5;
                    }
                    change += min + 5;
                }

                List <double> tmpbr = new List <double>();
                for (int i = 0; i < AllFiles.Count; i++)
                {
                    tmpbr.Add(AllFiles[i].AltBrightness);
                }
                AllCurves.UpdateBrCurve(tmpbr, change, index);
                UpdateTable();
            }
        }
        catch (Exception ex) { ReportError("Brightness Cell Edited", ex); }
    }