partial void OkButton_Clicked(NSObject sender)
 {
     try
     {
         Settings.Save();
         Result = WindowResponse.Ok;
         this.Close();
     }
     catch (Exception ex) { Error.Report("OkButton_Clicked", ex); }
 }
Example #2
0
        public override WindowResponse Show(object parent, string message, string title, MessageWindowType type, MessageWindowButtons bType)
        {
            NSAlert al = new NSAlert();

            al.AlertStyle      = CocoaHelper.GetWinType(type);
            al.MessageText     = title;
            al.InformativeText = message;

            switch (bType)
            {
            case MessageWindowButtons.AbortRetryIgnore:
                al.AddButton(Message.GetString("Abort"));
                al.AddButton(Message.GetString("Retry"));
                al.AddButton(Message.GetString("Ignore"));
                break;

            case MessageWindowButtons.Cancel:
                al.AddButton(Message.GetString("Cancel"));
                break;

            case MessageWindowButtons.Close:
                al.AddButton(Message.GetString("Close"));
                break;

            case  MessageWindowButtons.Ok:
                al.AddButton(Message.GetString("Ok"));
                break;

            case MessageWindowButtons.OkCancel:
                al.AddButton(Message.GetString("Ok"));
                al.AddButton(Message.GetString("Cancel"));
                break;

            case MessageWindowButtons.RetryCancel:
                al.AddButton(Message.GetString("Retry"));
                al.AddButton(Message.GetString("Cancel"));
                break;

            case MessageWindowButtons.YesNo:
                al.AddButton(Message.GetString("Yes"));
                al.AddButton(Message.GetString("No"));
                break;

            case MessageWindowButtons.YesNoCancel:
                al.AddButton(Message.GetString("Yes"));
                al.AddButton(Message.GetString("No"));
                al.AddButton(Message.GetString("Cancel"));
                break;
            }

            WindowResponse resp = CocoaHelper.GetResponse(al.RunModal(), bType);

            al.Dispose();
            return(resp);
        }
Example #3
0
        public WindowResponse Click_NewProject()
        {
            if (CheckBusy())
            {
                return(WindowResponse.Cancel);
            }
            WindowResponse res = AskForSaving();

            if (res == WindowResponse.Ok)
            {
                InitBaseUI();
                SetSaveStatus(true);
            }
            return(res);
        }
        public override WindowResponse Show()
        {
            if (DialogType == FileDialogType.SelectFolder)
            {
                fbdlg = new OpenFolderDialog();
                fbdlg.InitialFolder = InitialDirectory;
                fbdlg.Title         = Title;

                WindowResponse resp = WinFormHelper.GetResponse(fbdlg.ShowDialog(owner));
                SelectedPath = fbdlg.Folder;
                return(resp);
            }
            else
            {
                switch (DialogType)
                {
                case FileDialogType.OpenFile:
                    fdlg = new OpenFileDialog();
                    break;

                case FileDialogType.SaveFile:
                    fdlg = new SaveFileDialog();
                    break;
                }

                fdlg.InitialDirectory = InitialDirectory;
                fdlg.Title            = Title;
                string tmpFilter = string.Empty;

                foreach (FileTypeFilter filter in FileTypeFilters)
                {
                    tmpFilter += filter.FilterName + "|";
                    for (int i = 0; i < filter.Filter.Length; i++)
                    {
                        tmpFilter += (i == 0 ? "" : ";") + "*." + filter.Filter[i];
                    }
                }
                fdlg.Filter = tmpFilter;
                WindowResponse resp = WinFormHelper.GetResponse(fdlg.ShowDialog());
                SelectedPath = fdlg.FileName;
                return(resp);
            }
        }
Example #5
0
 public WindowResponse AskForSaving()
 {
     if (!ProjectSaved)
     {
         WindowResponse res = MsgBox.ShowMessage(MessageContent.SaveQuestion);
         if (res == WindowResponse.Yes)
         {
             Click_SaveProject(false); return(WindowResponse.Ok);
         }
         else if (res == WindowResponse.No)
         {
             return(WindowResponse.Ok);
         }
         else
         {
             return(WindowResponse.Cancel);
         }
     }
     return(WindowResponse.Ok);
 }
Example #6
0
        public override WindowResponse Show()
        {
            FileChooserAction fca = FileChooserAction.Open;

            switch (DialogType)
            {
            case FileDialogType.OpenFile:
                fca = FileChooserAction.Open;
                break;

            case FileDialogType.SelectFolder:
                fca = FileChooserAction.SelectFolder;
                break;

            case FileDialogType.SaveFile:
                fca = FileChooserAction.Save;
                break;
            }

            fc = new FileChooserDialog(Title, null, fca, Message.GetString("Cancel"), ResponseType.Cancel, Message.GetString("Select"), ResponseType.Ok);
            fc.SetCurrentFolder(InitialDirectory);
            foreach (FileTypeFilter filter in FileTypeFilters)
            {
                FileFilter ft = new FileFilter();
                ft.Name = filter.FilterName;
                foreach (string pat in filter.Filter)
                {
                    ft.AddPattern("*." + pat);
                }
                fc.AddFilter(ft);
            }
            WindowResponse resp = GtkHelper.GetResponse((ResponseType)fc.Run());

            SelectedPath = fc.Filename;
            return(resp);
        }
partial         void OkButton_Clicked(NSObject sender)
        {
            try
            {
                Settings.Save();
                Result = WindowResponse.Ok;
                this.Close();
            }
            catch (Exception ex) { Error.Report("OkButton_Clicked", ex); }
        }
Example #8
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);
            }
        }
Example #9
0
        public WindowResponse ShowMessage(MessageContent content, object args)
        {
            WindowResponse res = WindowResponse.None;

            switch (content)
            {
            case MessageContent.IsBusy:
                SendInfoText(Message.GetString("LapseStudio is currently busy"));
                break;

            case MessageContent.SaveQuestion:
                res = this.Show(Message.GetString("Do you want to save the current project?"), Message.GetString("Save Project?"), MessageWindowType.Question, MessageWindowButtons.YesNoCancel);
                break;

            case MessageContent.FramesAlreadyAdded:
                SendInfoText(Message.GetString("Frames already added"));
                break;

            case MessageContent.BusyClose:
                res = this.Show(Message.GetString("LapseStuio is currently busy. Do you want to close anyway?"), Message.GetString("Close LapseStudio?"), MessageWindowType.Question, MessageWindowButtons.YesNo);
                break;

            case MessageContent.BrightnessNotCalculatedError:
                SendInfoText(Message.GetString("Brightness is not calculated yet"));
                break;

            case MessageContent.BrightnessNotCalculatedWarning:
                res = this.Show(Message.GetString("Brightness is not calculated yet. Do you want to proceed anyway?"), Message.GetString("Proceed?"), MessageWindowType.Question, MessageWindowButtons.YesNo);
                break;

            case MessageContent.KeyframecountLow:
                SendInfoText(Message.GetString("Not enough keyframes added"));
                break;

            case MessageContent.NotEnoughFrames:
                SendInfoText(Message.GetString("Not enough frames loaded"));
                break;

            case MessageContent.ProjectSaved:
                SendInfoText(Message.GetString("Project saved"));
                break;

            case MessageContent.RemoveMetadataLink:
                res = this.Show(Message.GetString("Remove the link to the original metadata file?"), Message.GetString("Remove link?"), MessageWindowType.Question, MessageWindowButtons.YesNo);
                break;

            case MessageContent.UseReadXMP:
                res = this.Show(Message.GetString("There is no XMP linked to this file.") + Environment.NewLine + Message.GetString("Do you want to try to exctract it from the file?"), Message.GetString("Search for XMP?"), MessageWindowType.Question, MessageWindowButtons.YesNo);
                break;

            case MessageContent.NotEnoughValidFiles:
                this.Show(Message.GetString("Not enough valid images found for this kind of project."), MessageWindowType.Warning);
                break;

            case MessageContent.BrightnessAlreadyCalculated:
                res = this.Show(Message.GetString("Brightness is already calculated. Do you want to calculate again?"), Message.GetString("Calculate Again?"), MessageWindowType.Question, MessageWindowButtons.YesNo);
                break;

            case MessageContent.KeyframeAdded:
                SendInfoText(Message.GetString("Keyframe set!"));
                break;

            case MessageContent.KeyframeNotAdded:
                SendInfoText(Message.GetString("Keyframe not set!"));
                break;

            default:
                res = this.Show(Message.GetString("Something happened!") + Environment.NewLine + Message.GetString("(There is not more information available)"), MessageWindowType.Warning, MessageWindowButtons.Ok);
                break;
            }

            return(res);
        }