示例#1
0
    protected void OnProcOpenButtonClicked(object sender, EventArgs e)
    {
        try
        {
            if (!IsBusy() && AllFiles.Count > 1)
            {
                FileChooserDialog fc = new FileChooserDialog("Open PP3", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
                if (Directory.Exists(MySettings.LastPPDir))
                {
                    fc.SetCurrentFolder(MySettings.LastPPDir);
                }

                FileFilter filter = new FileFilter();
                filter.Name = "Postprocessing Profile";
                filter.AddPattern("*.pp3");
                fc.AddFilter(filter);

                if (fc.Run() == (int)ResponseType.Accept)
                {
                    MySettings.LastPPDir = System.IO.Path.GetDirectoryName(fc.Filename);
                    MySettings.Save();
                    SetSaveStatus(false);

                    MainPP3.ReadFile(fc.Filename);
                    MainPP3.Name = "Main";
                    PPfileOpened = true;

                    if (AllFiles.Count > 0)
                    {
                        AllFiles[0].IsKeyframe = true;
                    }

                    for (int i = 0; i < AllFiles.Count; i++)
                    {
                        if (!AllFiles[i].IsKeyframe || i == 0)
                        {
                            AllFiles[i].PP3 = new PP3Values(fc.Filename); AllFiles[i].PP3.Name = "Main";
                        }
                    }
                    AllFiles[0].IsKeyframe = true;

                    AllCurves.InitPP3Curves(MainPP3, AllFiles.Count);
                    UpdateTable();
                    FillCurveSelectBox();
                    UpdateInfo(InfoType.PPFile, 1);
                }
                fc.Destroy();
            }
            else if (AllFiles.Count < 2)
            {
                UpdateInfo(InfoType.Imagecount, 0);
            }
        }
        catch (Exception ex) { ReportError("Browse PP File", ex); PPfileOpened = false; }
    }
示例#2
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); }
    }
示例#3
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); }
    }