Beispiel #1
0
 public void Click_AddFrames()
 {
     if (CheckBusy())
     {
         return;
     }
     if (ProjectManager.CurrentProject.Frames.Count == 0)
     {
         using (FileDialog fdlg = FDialog.CreateDialog(FileDialogType.SelectFolder, Message.GetString("Select Folder")))
         {
             if (Directory.Exists(LSSettings.LastImgDir))
             {
                 fdlg.InitialDirectory = LSSettings.LastImgDir;
             }
             if (fdlg.Show() == WindowResponse.Ok)
             {
                 LSSettings.LastImgDir = fdlg.SelectedPath;
                 LSSettings.Save();
                 if (ProjectManager.AddFrames(fdlg.SelectedPath))
                 {
                     SetSaveStatus(false);
                 }
                 else
                 {
                     MsgBox.ShowMessage(MessageContent.NotEnoughValidFiles);
                 }
             }
         }
     }
     else
     {
         MsgBox.ShowMessage(MessageContent.FramesAlreadyAdded);
     }
 }
Beispiel #2
0
 public void Click_SaveProject(bool alwaysAsk)
 {
     if (CheckBusy())
     {
         return;
     }
     if (File.Exists(ProjectSavePath) && !alwaysAsk)
     {
         SavingProject();
     }
     else
     {
         using (FileDialog fdlg = FDialog.CreateDialog(FileDialogType.SaveFile, Message.GetString("Save Project")))
         {
             fdlg.AddFileTypeFilter(new FileTypeFilter(Message.GetString("LapseStudio Project"), "lasp"));
             if (Directory.Exists(LSSettings.LastProjDir))
             {
                 fdlg.InitialDirectory = LSSettings.LastProjDir;
             }
             if (fdlg.Show() == WindowResponse.Ok)
             {
                 if (Path.GetExtension(fdlg.SelectedPath) != ".lasp")
                 {
                     Path.ChangeExtension(fdlg.SelectedPath, ".lasp");
                 }
                 LSSettings.LastProjDir = Path.GetDirectoryName(fdlg.SelectedPath);
                 LSSettings.Save();
                 ProjectSavePath = fdlg.SelectedPath;
                 SavingProject();
             }
         }
     }
     SetSaveStatus(true);
 }
Beispiel #3
0
        public bool Quit(ClosingReason reason)
        {
            //the return value defines if the quiting should get canceled or not
            if (reason != ClosingReason.Error)
            {
                WindowResponse res;

                if (ProjectManager.CurrentProject.IsWorking)
                {
                    res = MsgBox.ShowMessage(MessageContent.BusyClose);
                    if (res == WindowResponse.No)
                    {
                        return(true);
                    }
                    else if (res == WindowResponse.Yes)
                    {
                        ProjectManager.Cancel();
                    }
                }

                res = AskForSaving();
                if (res == WindowResponse.Cancel)
                {
                    return(true);
                }
            }
            else
            {
                ProjectManager.Cancel();
            }

            LSSettings.Save();

            ProjectManager.BrightnessCalculated -= CurrentProject_BrightnessCalculated;
            ProjectManager.FramesLoaded         -= CurrentProject_FramesLoaded;
            ProjectManager.ProgressChanged      -= CurrentProject_ProgressChanged;
            ProjectManager.WorkDone             -= CurrentProject_WorkDone;

            if (ProjectManager.CurrentProject.IsWorking)
            {
                ProjectManager.CurrentProject.IsWorkingWaitHandler.WaitOne(10000);
            }

            UIHandler.ReleaseUIData();
            ProjectManager.Close();

            UIHandler.QuitApplication();
            return(false);
        }
Beispiel #4
0
 public void Save()
 {
     LSSettings.Threadcount     = ThreadCount;
     LSSettings.Autothread      = AutoThread;
     LSSettings.UsedLanguage    = (Language)LanguageSelection;
     LSSettings.UsedProgram     = (ProjectType)ProgramSelection;
     LSSettings.RunRT           = RunRT;
     LSSettings.SaveFormat      = (FileFormat)SaveFormatSelection;
     LSSettings.BitDepth        = (ImageBitDepth)BitDepthSelection;
     LSSettings.JpgQuality      = JpgQuality;
     LSSettings.TiffCompression = (TiffCompressionFormat)TiffCompressionSelection;
     LSSettings.RTPath          = RTPath;
     LSSettings.KeepPP3         = KeepPP3;
     LSSettings.Save();
 }
Beispiel #5
0
 public void Click_OpenProject()
 {
     if (CheckBusy())
     {
         return;
     }
     using (FileDialog fdlg = FDialog.CreateDialog(FileDialogType.OpenFile, Message.GetString("Open Project")))
     {
         fdlg.AddFileTypeFilter(new FileTypeFilter(Message.GetString("LapseStudio Project"), "lasp"));
         if (Directory.Exists(LSSettings.LastProjDir))
         {
             fdlg.InitialDirectory = LSSettings.LastProjDir;
         }
         if (fdlg.Show() == WindowResponse.Ok)
         {
             LSSettings.LastProjDir = System.IO.Path.GetDirectoryName(fdlg.SelectedPath);
             LSSettings.Save();
             ProjectSavePath = fdlg.SelectedPath;
             OpeningProject();
         }
     }
     SetSaveStatus(true);
 }
Beispiel #6
0
        public void OpenMetaData(int index)
        {
            if (LSSettings.UsedProgram == ProjectType.CameraRaw)
            {
                XMP CurXmp = ((FrameACR)ProjectManager.CurrentProject.Frames[index]).XMPFile;
                if (CurXmp == null || (CurXmp != null && CurXmp.Values.Count == 0))
                {
                    WindowResponse res = MsgBox.Show(Message.GetString(@"No XMP associated with this file. Do you want to reload to check if there is one now?
Yes reloads the files XMP values.
No lets you load values from a standalone XMP file."), MessageWindowType.Question, MessageWindowButtons.YesNoCancel);
                    if (res == WindowResponse.Yes)
                    {
                        ProjectManager.ReadXMP(); return;
                    }
                    else if (res == WindowResponse.Cancel)
                    {
                        return;
                    }

                    using (FileDialog fdlg = FDialog.CreateDialog(FileDialogType.OpenFile, Message.GetString("Open XMP")))
                    {
                        fdlg.AddFileTypeFilter(new FileTypeFilter(Message.GetString("XMP"), "xmp", "XMP"));
                        if (Directory.Exists(LSSettings.LastMetaDir))
                        {
                            fdlg.InitialDirectory = LSSettings.LastMetaDir;
                        }

                        if (fdlg.Show() == WindowResponse.Ok)
                        {
                            LSSettings.LastMetaDir = Path.GetDirectoryName(fdlg.SelectedPath);
                            LSSettings.Save();
                            ProjectManager.AddKeyframe(index, fdlg.SelectedPath);
                        }
                    }
                }
                else
                {
                    ProjectManager.AddKeyframe(index);
                }
            }
            else if (LSSettings.UsedProgram == ProjectType.RawTherapee)
            {
                using (FileDialog fdlg = FDialog.CreateDialog(FileDialogType.OpenFile, Message.GetString("Open PP3")))
                {
                    fdlg.AddFileTypeFilter(new FileTypeFilter(Message.GetString("Postprocessing Profile"), "PP3", "pp3"));
                    if (Directory.Exists(LSSettings.LastMetaDir))
                    {
                        fdlg.InitialDirectory = LSSettings.LastMetaDir;
                    }

                    if (fdlg.Show() == WindowResponse.Ok)
                    {
                        LSSettings.LastMetaDir = Path.GetDirectoryName(fdlg.SelectedPath);
                        LSSettings.Save();
                        ProjectManager.AddKeyframe(index, fdlg.SelectedPath);
                    }
                }
            }
            else
            {
                ProjectManager.AddKeyframe(index);
            }

            if (ProjectManager.CurrentProject.Frames[index].IsKeyframe)
            {
                MsgBox.ShowMessage(MessageContent.KeyframeAdded);
            }
            else
            {
                MsgBox.ShowMessage(MessageContent.KeyframeNotAdded);
            }
        }
Beispiel #7
0
        public void ProcessFiles()
        {
            bool ask = true;

            if (LSSettings.UsedProgram == ProjectType.CameraRaw)
            {
                ask = false;
            }
            else if (LSSettings.UsedProgram == ProjectType.LapseStudio)
            {
                ask = true;
                ((ProjectLS)ProjectManager.CurrentProject).SaveFormat = LSSettings.SaveFormat;
            }
            else if (LSSettings.UsedProgram == ProjectType.RawTherapee)
            {
                if (!File.Exists(LSSettings.RTPath))
                {
                    string NewRTPath = ProjectRT.SearchForRT();
                    if (NewRTPath != null)
                    {
                        LSSettings.RTPath = NewRTPath;
                        LSSettings.Save();
                        ((ProjectRT)ProjectManager.CurrentProject).RTPath = NewRTPath;
                    }
                    else
                    {
                        MsgBox.Show(Message.GetString("RawTherapee can't be found. Abort!"));
                        return;
                    }
                }
                ask = ((ProjectRT)ProjectManager.CurrentProject).RunRT;
                ((ProjectRT)ProjectManager.CurrentProject).SaveFormat = LSSettings.SaveFormat;
            }

            if (ask)
            {
                using (FileDialog fdlg = FDialog.CreateDialog(FileDialogType.SelectFolder, Message.GetString("Select Folder")))
                {
                    if (Directory.Exists(LSSettings.LastProcDir))
                    {
                        fdlg.InitialDirectory = LSSettings.LastProcDir;
                    }
                    if (fdlg.Show() == WindowResponse.Ok)
                    {
                        LSSettings.LastProcDir = fdlg.SelectedPath;
                        LSSettings.Save();
                        if (ProjectManager.CurrentProject.IsBrightnessCalculated)
                        {
                            ProjectManager.SetAltBrightness(MainGraph.Points);
                        }
                        ProjectManager.ProcessFiles(fdlg.SelectedPath);
                    }
                }
            }
            else
            {
                if (ProjectManager.CurrentProject.IsBrightnessCalculated)
                {
                    ProjectManager.SetAltBrightness(MainGraph.Points);
                }
                ProjectManager.ProcessFiles();
            }
            SetSaveStatus(false);
        }